Dear professor Fox and R helpers, I have a quick question about the Anova function in the car package. When using the default "type II" SS I get results that I don't understand (see below).
library(car) Data <- data.frame(y=rnorm(10), x1=factor(c(rep("a",4), rep("b",6))), x2 = factor(c(rep("j", 2), rep("k", 3), rep("j", 2), rep("k", 3)))) Data$c1 <- recode(Data$x1, '"a"=-1;"b"=1', as.factor.result=FALSE) Data$c2 <- recode(Data$x2, '"j"=-1;"k"=1', as.factor.result=FALSE) Data$c3 <- Data$c1*Data$c2 options(contrasts=c("contr.Sum", "contr.poly")) m1 <- lm(y ~ x1*x2, data=Data) m2 <- lm(y ~ c1 + c2 + c3, data=Data) Anova(m1)#Why is this Anova(m2)#Different from this? I would greatly appreciate it if someone can help me understand why the results differ. Thanks, Ista ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.