Dear R-helpers,

In the case of two categorical factors, say a and b, once I have 
fixed the constrasts, the model matrix is set according to these 
contrasts with "lm", and the t-tests for the significance of the 
parameters provided by "summary" indeed concern the comparison of the 
model with each submodel obtained by removing the corresponding 
column of the model matrix. So :

options(contrasts=c("contr.sum", "contr.poly"))
mod = lm(Y ~ a*b, x=TRUE)
print(mod$x)
print(summary(mod))

provide the expected results.

When using "anova" for the corresponding two-way anova, I was 
expecting to obtain the p-values of the Fisher tests corresponding to 
:
a : the removal of the columns coding for factor a
b : the removal of the columns coding for factor b
a:b : the removal of the columns coding for the interaction of factors a and b
BUT :

print(anova(mod))

does not provide the expected results. Moreover, the results of 
"anova" do not depend on the contrasts, since setting

options(contrasts=c("contr.treeatment", "contr.poly"))

leads to the same result.

I manage to obtain the desired results by creating the submodels 
without the corresponding columns, and by comparing them with "anova" 
, for example :

xsub = mod$x[,-c(2)]
submod = lm(Y ~ xsub-1)
print(anova(submod,mod))

So my questions are :
1) is there a direct way to perform the anova I want ?
2) what does "anova" really test, and why is it independant from the 
chosen model matrix ?

Thanks in advance,

Isabelle

P.S. I do not directly see the answers to my questions in MASS by 
Venables and Ripley.
	[[alternative HTML version deleted]]

