John Fox wrote:
Dear Peter and Paul,
As Paul discovered, Anova() doesn't handle aovlist objects.
As a general matter, one should be careful with "type-III" tests, since it's
easy to test hypotheses that aren't sensible (e.g., tests ostensibly of main
effects that aren't reasonably interpretable as tests of main effects). For
example, SAS (and I assume SPSS) produce type-III tests in analysis of
covariance that aren't generally sensible. I haven't thought about whether
there's a similar trap in unbalanced repeated-measures ANOVA. By the way,
sequential (or "type-I") tests are rarely sensible in my opinion.
With the computing power of today, are there any reason not to do the easy and sensible thing,
to test the hypothesis which interest YOU, by estimating to models, large and small, and test the
small within the large?
Kjetil Halvorsen
Regards, John
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard
Sent: Thursday, August 26, 2004 7:08 AM
To: Paul Lemmens
Cc: [EMAIL PROTECTED]
Subject: Re: [R] library(car) Anova() and Error-term in aov()
Paul Lemmens <[EMAIL PROTECTED]> writes:
SPSS (typeDear all,
Type III SS time again. This case trying to reproduce some
III) data in R for a repeated measures anova with a betwSS factor included. As I understand this list etc, if I want type IIIthen I can
Error-termdo
library(car) Anova(lm.obj, type="III")
But for the repeated measures anova, I need to include an
in the aov() call (Psychology-guide from Jonathan Baron)which results
in multiple lm() calls. Anova() does not seem capable tohandle this
situation. Or am I tackling Type III calculation, in this case with Error(), the wrong way (besides ignoring advice concerningType I vs
wrong withIII)??
For instance,
dat <- rnorm(12)
pp <- factor(c(rep(1:3,2), rep(4:6,2))) betw <- gl(2,6) A <- factor(rep(c(rep('a',3),rep('b',3)), 2)) taov <- aov(dat~betw*A+Error(pp/A)) Anova(taov, type="III") # Goes
following error.for "Anova"
#Error in Anova(taov, type = "III") : no applicable method
Phrased differently, ?Anova says "Calculates type-II or type-III analysis-of-variance tables for model objects produced by 'lm' and 'glm'", so it's not suitable for the aovlist that aov() with Error()-term returns. How can I compute Type III SS for
such objects?
Well, ...
In a balanced design you don't need Type III SS (because they are all the same) -- summary(taov) will do.
In an unbalanced design, you don't want to use aov() with an Error term. (Slightly overstated, but you certainly get to think very closely if the unbalance is in the Error model).
I'm not actually sure what SPSS does in the case of unbalanced designs (complete-case analysis?).
In principle, with a balanced Error model, you should be able to extract, say, taov[[2]] and do an Anova() or drop1() on that, but it doesn't work because the object is not really an "lm" object, even though
class(taov[[2]])
[1] "aov" "lm"
but we get things like
model.frame(as(taov[[2]],"lm"))
$method lm
--
O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907
______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
