This function is only suitable to analyze residuals of ANOVA models. It must not be used to analyze residuals from regression or ANCOVA models.
an object of the class lm or aov.
type of normality test; currently Shapiro-Wilk (SW) and Anderson-Darling (AD) tests are available
type of homogeneity test of variances; currently Bartlett and Levene tests are available
residuals' normality test and residuals' homoneity test of variances.
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