Jarrett Byrnes
2005-Nov-08 20:26 UTC
[R] Type II and III sums of squares with Error in AOV
I've recently run into the problem of using aov with nested factors, and wanting to get the type II and III sums of squares. Normally Anova from the car package would do fine, but it doesn't like having an Error included, so my.aov <-aov(Response ~ Treatment + Error(Treatment:Replicate)) Anova(my.aov, type="II") yields Error in Anova(nested.anova) : no applicable method for "Anova" And lm does not take Error as an argument. Error in eval(expr, envir, enclos) : couldn't find function "Error" Is there a way to get these additional types of sums of squares when Error is included in an aov model?
Prof Brian Ripley
2005-Nov-09 11:12 UTC
[R] Type II and III sums of squares with Error in AOV
A multistratum aov() fit is just a list of aov() fits, so you can apply functions such as Anova to the individual strata. However, why do you want types II and III sums of squares? It is usual to do this type of analysis only with balanced designs. In the cases I can envisage that these make any sense, they are the same as type I (and in cases with only one treatment effect, they always are). On Tue, 8 Nov 2005, Jarrett Byrnes wrote:> I've recently run into the problem of using aov with nested factors, > and wanting to get the type II and III sums of squares. Normally Anova > from the car package would do fine, but it doesn't like having an Error > included, so > > my.aov <-aov(Response ~ Treatment + Error(Treatment:Replicate)) > Anova(my.aov, type="II") > > yields > > Error in Anova(nested.anova) : no applicable method for "Anova" > > And lm does not take Error as an argument.Nor does log()! Is that relevant?> Error in eval(expr, envir, enclos) : couldn't find function "Error" > > Is there a way to get these additional types of sums of squares when > Error is included in an aov model?Have you read the reference on the aov help page? That might be a good step to deepening your understanding of what Error() does. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595