Schreiber, Stefan
2011-Nov-16 21:13 UTC
[R] ANOVA on residuals to check for equality of variances
Hi all, I know that I can run an one way ANOVA on the absolute residual values to check the assumption of equal variances: model<- lm(y~x) summary(lm(abs(model$resid~x))) What if I have two factors? As far as I know I have to check this assumption on very factor/level combination. So if I have 3 factors with three levels, I would have to test 9 factor/level combinations. Here comes my questions: Can I do the same thing like above, except, including the "multiply" sign between the factors, check the overall significance (for equal variances) and go from there? model<- lm(y~x1*x2) summary(lm(abs(model$resid~x1*x2))). Right now I am using levene.test() from the 'lawstat' package and just adding another column to my data: mydata$group<-rep(letters[1:9],each=5), where letters[1:9] are for 9 factor/level combination and each=5 since I have 5 replicates each. Then I run levene.test(mydata$y, mydata$group, location="mean") and it works fine. Thanks for any answers on that! Stefan [[alternative HTML version deleted]]