[R] library(car) Anova() and Error-term in aov()

Kjetil Brinchmann Halvorsen kjetil at acelerate.com
Thu Aug 26 22:25:24 CEST 2004


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: r-help-bounces at stat.math.ethz.ch 
>>[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Peter Dalgaard
>>Sent: Thursday, August 26, 2004 7:08 AM
>>To: Paul Lemmens
>>Cc: r-help at stat.math.ethz.ch
>>Subject: Re: [R] library(car) Anova() and Error-term in aov()
>>
>>Paul Lemmens <P.Lemmens at nici.kun.nl> writes:
>>
>>    
>>
>>>Dear all,
>>>
>>>Type III SS time again. This case trying to reproduce some 
>>>      
>>>
>>SPSS (type
>>    
>>
>>>III) data in R for a repeated measures anova with a betwSS factor 
>>>included. As I understand this list etc, if I want type III 
>>>      
>>>
>>then I can 
>>    
>>
>>>do
>>>
>>>library(car)
>>>Anova(lm.obj, type="III")
>>>
>>>But for the repeated measures anova, I need to include an 
>>>      
>>>
>>Error-term 
>>    
>>
>>>in the aov() call (Psychology-guide from Jonathan Baron) 
>>>      
>>>
>>which results 
>>    
>>
>>>in multiple lm() calls. Anova() does not seem capable to 
>>>      
>>>
>>handle this 
>>    
>>
>>>situation. Or am I tackling Type III calculation, in this case with 
>>>Error(), the wrong way (besides ignoring advice concerning 
>>>      
>>>
>>Type I vs 
>>    
>>
>>>III)??
>>>
>>>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 
>>>      
>>>
>>wrong with 
>>    
>>
>>>following error.
>>>#Error in Anova(taov, type = "III") : no applicable method 
>>>      
>>>
>>for "Anova"
>>    
>>
>>>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
>>~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: 
>>(+45) 35327907
>>
>>______________________________________________
>>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
>>    
>>
>
>______________________________________________
>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
>
>
>  
>




More information about the R-help mailing list