William Simpson
2009-Apr-21 14:12 UTC
[R] broken example: lme() + multcomp() Tukey on repeated measures design
I am trying to do Tukey HSD comparisons on a repeated measures expt. I found the following example on r-help and quoted approvingly elsewhere. It is broken. Can anyone please tell me how to get it to work? I am using R 2.4.1.> require(MASS) ## for oats data set > require(nlme) ## for lme() > require(multcomp) ## for multiple comparison stuff > Aov.mod <- aov(Y ~ N + V + Error(B/V), data = oats) > Lme.mod <- lme(Y ~ N + V, random = ~1 | B/V, data = oats) > summary(Aov.mod) > anova(Lme.mod) > summary(Lme.mod) > summary(glht(Lme.mod, linfct=mcp(V="Tukey")))Error in eval(expr, envir, enclos) : object "Y" not found Error in factor_contrasts(model) : no 'model.matrix' method for 'model' found! It all went ok until the last line, where the actual Tukey multiple comparisons was requested. Thanks very much for any help! Bill
Dieter Menne
2009-Apr-21 14:30 UTC
[R] broken example: lme() + multcomp() Tukey on repeated measures design
William Simpson <william.a.simpson <at> gmail.com> writes:> > I am trying to do Tukey HSD comparisons on a repeated measures expt. > I found the following example on r-help and quoted approvingly elsewhere. > It is broken. Can anyone please tell me how to get it to work? >> I am using R 2.4.1.That's the problem. Not the R-Version, but the likelihood that the multcomp package was not updated also, and lme definitively not in early version.s other attached packages: [1] multcomp_1.0-7 mvtnorm_0.9-5 nlme_3.1-90 MASS_7.2-46> glht(Lme.mod, linfct=mcp(V="Tukey"))General Linear Hypotheses Multiple Comparisons of Means: Tukey Contrasts Linear Hypotheses: Estimate Marvellous - Golden.rain == 0 5.292 Victory - Golden.rain == 0 -6.875 Victory - Marvellous == 0 -12.167 Dieter
David Winsemius
2009-Apr-21 14:31 UTC
[R] broken example: lme() + multcomp() Tukey on repeated measures design
On Apr 21, 2009, at 10:12 AM, William Simpson wrote:> I am trying to do Tukey HSD comparisons on a repeated measures expt. > I found the following example on r-help and quoted approvingly > elsewhere. > It is broken. Can anyone please tell me how to get it to work? > > I am using R 2.4.1.How many years have you had that version without updating?> > >> require(MASS) ## for oats data set >> require(nlme) ## for lme() >> require(multcomp) ## for multiple comparison stuff >> Aov.mod <- aov(Y ~ N + V + Error(B/V), data = oats) >> Lme.mod <- lme(Y ~ N + V, random = ~1 | B/V, data = oats) >> summary(Aov.mod) >> anova(Lme.mod) >> summary(Lme.mod) >> summary(glht(Lme.mod, linfct=mcp(V="Tukey"))) > Error in eval(expr, envir, enclos) : object "Y" not found > Error in factor_contrasts(model) : no 'model.matrix' method for > 'model' found!It is not broken when run in version 2.8.1. David Winsemius, MD Heritage Laboratories West Hartford, CT
William Simpson
2009-Apr-22 09:15 UTC
[R] broken example: lme() + multcomp() Tukey on repeated measures design
Thanks for the helpful replies. I will try updating R and see how it goes. MASS, nlme, multcomp are all the most recent. Bill On Tue, Apr 21, 2009 at 3:12 PM, William Simpson <william.a.simpson at gmail.com> wrote:> I am trying to do Tukey HSD comparisons on a repeated measures expt. > I found the following example on r-help and quoted approvingly elsewhere. > It is broken. Can anyone please tell me how to get it to work? > > I am using R 2.4.1. > >> require(MASS) ## for oats data set >> require(nlme) ## for lme() >> require(multcomp) ## for multiple comparison stuff >> Aov.mod <- aov(Y ~ N + V + Error(B/V), data = oats) >> Lme.mod <- lme(Y ~ N + V, random = ~1 | B/V, data = oats) >> summary(Aov.mod) >> anova(Lme.mod) >> summary(Lme.mod) >> summary(glht(Lme.mod, linfct=mcp(V="Tukey"))) > Error in eval(expr, envir, enclos) : object "Y" not found > Error in factor_contrasts(model) : no 'model.matrix' method for 'model' found! > > It all went ok until the last line, where the actual Tukey multiple > comparisons was requested. > > Thanks very much for any help! > > Bill >
Possibly Parallel Threads
- Tukey HSD (or other post hoc tests) following repeated measures ANOVA
- Tukey HSD plot with lines indicating (non-)significance
- Tukey HSD following lme
- Tukey post hoc test for testing interaction between two or more predictors
- Tukey post hoc test and two way repeated measures ANOVA