[R] TukeyHSD & Covariates

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Dec 15 22:54:51 CET 2004


Damián Cirelli <damian.cirelli at maine.edu> writes:

> Dear R gurus,
> I have the following model:
> 
> appcov.aov <- aov(yield ~ prevyield + trt + block)
> 
> where prevyield is a continuous numeric covariate and trt and block
> are factors (yes, I did factor()!)
> Now, when I do a TukeyHSD, my diff's are all screwed up!
> For instance:
> treatment mean for treatmen "E" is 277.25 and for treatment "O" is
> 279.5, so I figure the diff O-E should be 2.25, but TukeyHSD says:
> 
>           diff         lwr        upr
> O-E -50.817101 -84.8112057 -16.822996
> 
> So I wonder where is that -50.8 coming from???
> 
> Anybody have a clue?
> 
> Thanks a lot!
> 
> PS: it works if I take prevyield (the covariate) out of the model, but
> the point is I need to analyse it with the covariate.
> Thanks again

If the covariate level differs between the treatment groups, then the
difference in the covariate-adjusted means could well differ quite a
bit from the unadjusted difference. What happens if you do

summary(lm(yield ~ prevyield + trt + block))

(Not sure I'm happy about using the HSD procedure with an unbalanced
design, btw.)

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




More information about the R-help mailing list