I am using R to make two-way ANOVA on a number of variables using g <- aov(var ~ fact1*fact2) where var is a matrix containing the variables. However the outcome seem to be dependent on the order of fact1 and fact2 (i.e. fact2*fact1) gives a slightly (factor of 1.5) different result. Any ideas why this is? Thanks for any help Anders
Anders Malmendal wrote:> I am using R to make two-way ANOVA on a number of variables using > > g <- aov(var ~ fact1*fact2) > > where var is a matrix containing the variables. > However the outcome seem to be dependent on the order of fact1 and fact2 > (i.e. fact2*fact1) gives a slightly (factor of 1.5) different result. > Any ideas why this is?RSiteSearch("sequential sums of squares")> Thanks for any help > Anders > > ______________________________________________ > R-help at stat.math.ethz.ch 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.-- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894
You probably have an unbalanced design (different number of cases in the different conditions defined by the crossing "fact1*fact2"). One possiblity is to use the 'car' package and Anova to get "type III" sums of squares. This is equivalent to pretending that there is no "unbalance". Christophe Pallier On 5/15/07, Anders Malmendal <anders@chem.au.dk> wrote:> > I am using R to make two-way ANOVA on a number of variables using > > g <- aov(var ~ fact1*fact2) > > where var is a matrix containing the variables. > However the outcome seem to be dependent on the order of fact1 and fact2 > (i.e. fact2*fact1) gives a slightly (factor of 1.5) different result. > Any ideas why this is? > > Thanks for any help > Anders > > ______________________________________________ > R-help@stat.math.ethz.ch 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. >-- Christophe Pallier (http://www.pallier.org) [[alternative HTML version deleted]]
On Tue, 2007-05-15 at 15:07 +0200, Anders Malmendal wrote:> I am using R to make two-way ANOVA on a number of variables using > > g <- aov(var ~ fact1*fact2) > > where var is a matrix containing the variables. > However the outcome seem to be dependent on the order of fact1 and fact2 > (i.e. fact2*fact1) gives a slightly (factor of 1.5) different result. > Any ideas why this is? > > Thanks for any help > AndersThis is presumably an unbalanced design and R reports the sequential sum of squares (aka Type I) based upon the order in which the factors enter the model. Using RSiteSearch("aov order") will lead you to many posts on the matter. If you require other 'types' of SS, see the Anova() function in the 'car' package on CRAN by John Fox. You also might want to see Prof. Venables' "Exegeses" paper: http://www.stats.ox.ac.uk/pub/MASS3/Exegeses.pdf HTH, Marc Schwartz