This function is only suitable to analyze residuals of ANOVA models. It must not be used to analyze residuals from regression or ANCOVA models.

testResiduals(
  model,
  normality.test = c("sw", "ad"),
  var.test = c("bartlett", "levene")
)

Arguments

model

an object of the class lm or aov.

normality.test

type of normality test; currently Shapiro-Wilk (SW) and Anderson-Darling (AD) tests are available

var.test

type of homogeneity test of variances; currently Bartlett and Levene tests are available

Value

residuals' normality test and residuals' homoneity test of variances.

Examples

library(planex)
library(tidyverse)
baterias <- mutate(baterias,
  temperatura = as.factor(temperatura),
  tipo = as.factor(tipo)
)

mod <- aov(tempo ~ temperatura*tipo, data=baterias)
testResiduals(mod)
#> 
#> 	Shapiro-Wilk normality test
#> 
#> data:  resid
#> W = 0.97606, p-value = 0.6117
#> 
#> ------------------------------------------ 
#> Bartlett test of Homogeneity of Variances: 
#>             Bartlett's K-squared df   p.value
#> temperatura             3.311821  2 0.1909182
#> tipo                    3.173694  2 0.2045696
#> 
#> ----------------------------------------------- 
#> Durbin-Watson Test for Autocorrelated Errors: 
#>  lag Autocorrelation D-W Statistic p-value
#>    1      -0.3751937      2.713482    0.36
#>  Alternative hypothesis: rho != 0