[R] Help in using multcomp.

A Ezhil ezhil02 at yahoo.com
Sat Feb 10 14:11:06 CET 2007


Hi Chuck,

Thank you very for this help. I am able to store the
results. Now, I am facing the following problems:

1. I am trying to extract only the p-values from 

dunres <- lapply(amod, function(x){summary(glht(x,
linfct=mcp(f = contr)))})

but I am stuck. If I use dunres[[1]], it displays the
results. But I don't know how to extract the p value
from this. 

2. If I want to get raw pvalues instead of adjusted
ones, what should I do in summary(glht)? 

Thanks again for your help. I look forward to your
reply.

Kind regards,
Ezhil


--- Chuck Cleland <ccleland at optonline.net> wrote:

> A Ezhil wrote:
> > Hi All,
> > 
> > I am trying use 'multcomp' for multiple
> comparisons
> > after my ANOVA analysis. I have used the following
> > code to do ANOVA:
> > 
> > dat <- matrix(rnorm(45), nrow=5, ncol=9)
> > f <- gl(3,3,9, label=c("C", "Tl", "T2"))
> > 
> > aof <- function(x) {
> >         m <- data.frame(f, x);
> >         aov(x ~ f, m)
> > }
> > amod <- apply(dat,1,aof)
> > 
> > Now, how can I use 'glht' for the above amod. I
> know
> > that I cannot use simply 
> > 
> > glht(amod, linfct = mcp(f = "Dunnett")). 
> 
>   Since amod is a list of models rather than one
> model, do you want
> something like this?
> 
> lapply(amod, function(x){summary(glht(x, linfct =
> mcp(f = "Dunnett")))})
> 
> > Also, if I want to use Dunnett for comparing C vs
> (T1
> > and T2), how can I specify this in the glht
> function.
> 
>   How about doing it with user-defined contrasts?
> 
> contr <- rbind("C - T1   " = c(-1, 1, 0),
>                "C - T2   " = c(-1, 0, 1),
>                "C - All T" = c(-1,.5,.5))
> 
> lapply(amod, function(x){summary(glht(x, linfct =
> mcp(f = contr)))})
> 
> > Thanks in advance. 
> > Regards,
> > Ezhil
> > 
> > ______________________________________________
> > 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
> 



 
____________________________________________________________________________________
Need a quick answer? Get one in minutes from people who know.
Ask your question on www.Answers.yahoo.com



More information about the R-help mailing list