[R] multiple comparison (glht) problem

Chuck Cleland ccleland at optonline.net
Wed Nov 21 14:26:09 CET 2007


Anqi Qiu wrote:
> I am not sure whether there is a bug. When I tested the example given for "glht"
> in the help, I entered the following error:
> 
> Running commands:
> 
> amod <- aov(minutes ~ blanket, data = recovery)
> rht <- glht(amod, linfct = mcp(blanket = "Dunnett"),
>               alternative = "less")
> 
> Errors are:
> 
> Error in try(coef.(model)) : could not find function "coef."
> 
> Error in modelparm.default(model, ...) : no 'coef' method for 'model'
> found! 
> 
> Thanks!

  It works for me.

> library(multcomp)
Loading required package: mvtnorm

> amod <- aov(minutes ~ blanket, data = recovery)
> rht <- glht(amod, linfct = mcp(blanket = "Dunnett"),
+               alternative = "less")

> summary(rht)

         Simultaneous Tests for General Linear Hypotheses

Multiple Comparisons of Means: Dunnett Contrasts

Fit: aov(formula = minutes ~ blanket, data = recovery)

Linear Hypotheses:
             Estimate Std. Error t value p value
b1 - b0 >= 0  -2.1333     1.6038  -1.330  0.2412
b2 - b0 >= 0  -7.4667     1.6038  -4.656  <0.001 ***
b3 - b0 >= 0  -1.6667     0.8848  -1.884  0.0924 .
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Adjusted p values reported)

> sessionInfo()
R version 2.6.1 RC (2007-11-20 r43507)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] multcomp_0.992-6 mvtnorm_0.8-1

loaded via a namespace (and not attached):
[1] tools_2.6.1

> Regards,
> 
> Anqi Qiu
> 
> Anqi Qiu
> Center for Imaging Science
> Johns Hopkins University
> Email: anqi at cis.jhu.edu
> tel: 410-516-8103
> 
> Anqi Qiu
> Center for Imaging Science
> Johns Hopkins University
> Email: anqi at cis.jhu.edu
> tel: 410-516-8103
> ______________________________________________
> R-help at r-project.org 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