[R] multcomp

Chuck Cleland ccleland at optonline.net
Wed Mar 21 11:09:23 CET 2007


Nair, Murlidharan T wrote:
> Thanks for the hint. 
> Here is what I had done earlier according to the old package
>  
>  mult.comp<-simint(a~b, data=z, conf.level=0.99, type=c("Tukey") )
>  isoforms<-as.vector(rownames(mult.comp$estimate))
>  estimate<-as.vector(mult.comp$estimate)
>  lower<-as.vector(mult.comp$conf.int[,1])
>  upper<-as.vector(mult.comp$conf.int[,2])
>  p.val.raw<-as.vector(mult.comp$p.value.raw)
>  
> Here is how I modified the above so that I can use the new package. Can someone comment if what I have done is correct or not?
> amod<-aov(a~b, data=z)
> mult.comp<-glht(amod, linfct=mcp(b="Tukey"))
> estimate<-confint(mult.comp)[1,1]
> lower<-confint(mult.comp)[1,2]
> upper<-confint(mult.comp)[1,3]
> summary(mult.comp) does give the adjusted pvalues.  I tried all the subscripts to extract it to store in a variable but could not, can any one help me here. Also,  how do I specify the conf.level to be equal to 0.99. The default is 0.95

  To specify a confidence level other than the default, see the help
page for confint().

library(multcomp)
amod <- aov(breaks ~ tension, data = warpbreaks)
mc <- glht(amod, linfct = mcp(tension = "Tukey"))
confint(mc, level = .99)

         Simultaneous Confidence Intervals for General Linear Hypotheses

Multiple Comparisons of Means: Tukey Contrasts

Fit: aov(formula = breaks ~ tension, data = warpbreaks)

Estimated Quantile = 3.0494

Linear Hypotheses:
           Estimate lwr      upr
M - L == 0 -10.0000 -22.0764   2.0764
H - L == 0 -14.7222 -26.7986  -2.6458
H - M == 0  -4.7222 -16.7986   7.3542

99% family-wise confidence level

  To see how to extract the p-values, str() is useful:

str(summary(mc))
summary(mc)$test$pvalues

[1] 0.038569618 0.001440005 0.463049425
attr(,"error")
[1] 0.000226511

> Thanks for your help,
> Cheers../Murli
> 
>  
> ________________________________
> 
> From: talepanda [mailto:talepanda at gmail.com]
> Sent: Sun 3/18/2007 11:07 PM
> To: Nair, Murlidharan T
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] multcomp
> 
> 
> 
> ?glht says
>> with 'print', 'summary',  'confint', 'coef' and 'vcov'  methods
>> being available.
> 
> try:
> 
> example(glht)
> summary(glht(amod, linfct = mcp(tension = "Tukey")))
> confint(glht(amod, linfct = mcp(tension = "Tukey")))
> 
> On 3/19/07, Nair, Murlidharan T <mnair at iusb.edu> wrote:
>> I used the multcomp package sometime back for doing multiple
>> comparisons. I see that it has been updated and the methods like simint
>> are no longer supported. When I run the program it prompts to me to use
>> glht. How do I get the lower and upper conf int and the pValues using
>> glht? Does anyone have an example?
>>
>> Thanks ../Murli
>>
>>
>>
>>
>>       [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894



More information about the R-help mailing list