[R] anova and tukeyHSD

Liaw, Andy andy_liaw at merck.com
Wed Aug 13 15:51:52 CEST 2003


Using some simulated data:

> A <- rnorm(7, mean=1); B <- rnorm(9, mean=2); C <- rnorm(13, mean=2.5)
> y <- c(A, B, C)
> f <- factor(rep(1:3, c(7, 9, 13)))
> TukeyHSD(aov(y~f))
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = y ~ f)

$f
         diff        lwr      upr
2-1 0.9345966 -0.2173612 2.086554
3-1 1.5357566  0.4641358 2.607377
3-2 0.6011600 -0.3900490 1.592369

HTH,
Andy

> -----Original Message-----
> From: Anna H. Pryor [mailto:anna at ptolemy.arc.nasa.gov] 
> Sent: Wednesday, August 13, 2003 9:28 AM
> To: R-help mailing list
> Subject: [R] anova and tukeyHSD
> 
> 
> 
> I would like to do a one way anova and then a tukeyHSD.  I 
> have three vectors 
> A,B and C.  In a previous help message, I was told to do the 
> following for 
> the anova:
> 
> y = c(A,B,C)
> group = factor(rep(a:3,c(7,9,13))) #provided there a 7 
> elements in A,9 in B 
> and 13 in C
> 
> and then
> 
> anova(lm(y~group))
> 
> 
> Looking at the tukeyHSD method it looks like it wants the aov 
> method which I 
> don't understand.  Using the above example, could someone 
> continue the 
> example and get the tukeyHSD method to work?
> 
> Anna
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list 
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
> 

------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA), and/or
its affiliates (which may be known outside the United States as Merck Frosst,
Merck Sharp & Dohme or MSD) that may be confidential, proprietary copyrighted
and/or legally privileged, and is intended solely for the use of the
individual or entity named on this message.  If you are not the intended
recipient, and have received this message in error, please immediately return
this by e-mail and then delete it.




More information about the R-help mailing list