Hi,

I wish to compute multivariate test statistics for a within-subjects repeated 
measures design with anova.mlm. 

This works great if I only have two factors, but I don't know how to compute 
interactions with more than two factors. 
I suspect, I have to create a new "grouping" factor and then test with this 
factor to get these interactions (as it is hinted in R News 2007/2), 
but I don't really know how to use this approach. 

Here is my current code:

Two Factors: fac1, fac2

mlmfit <- lm(mydata~1)
mlmfit0 <- update(mlmfit, ~0)

% test fac1, works, produces same output as SAS
anova(mlmfit, mlmfit0, M = ~ fac1 + fac2, X = ~ fac2, idata = idata, test = 
"Wilks")

% test fac1*fac2 interaction, also works, also the same output as SAS
anova(mlmfit, mlmfit0, X = ~ fac1 + fac2, idata = idata, test = "Wilks")



Three Factors: fac1, fac2, fac3 

mlmfit <- lm(mydata~1)
mlmfit0 <- update(mlmfit, ~0)

% test fac1, works, same as SAS
anova(mlmfit, mlmfit0, M = ~ fac1 + fac2 + fac3, X = ~ fac2 + fac3, idata = 
idata, test = "Wilks")



Now, I try to compute the interactions the same way, but this doesn't work:

% fac1*fac2
anova(mlmfit, mlmfit0, M = ~ fac1 + fac2 + fac3, X = ~ fac3, idata = idata, 
test = "Wilks") 

% fac1*fac2*fac3
anova(mlmfit, mlmfit0, X = ~ fac1 + fac2 + fac3, idata = idata, test = "Wilks")


Both of these above differ quite much from the SAS output and I suspect, my 
understanding of X and M is somewhat flawed. 

I would be very happy, if someone could tell me how to compute the two 
interactions above and an interaction of N factors in general.

I would also be interested in computing linear contrasts using the T matrix and 
anova.mlm.

Thank you very much,

Stefan 

 

--
Stefan Schadwinkel, Dipl.-Inf.
Neurologische Klinik
Sektion Biomagnetismus
Universität Heidelberg
Im Neuenheimer Feld 400
69120 Heidelberg

Telefon:  06221 - 56 5196
Email:    [EMAIL PROTECTED] 

______________________________________________
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.

Reply via email to