Re: [R] Re peated Measure ANOVA-Old question

From: Gavin Simpson <gavin.simpson_at_ucl.ac.uk>
Date: Wed, 30 Jul 2008 10:22:51 +0100

On Wed, 2008-07-30 at 00:49 -0700, Mark Difford wrote:
> Hi Chunhao,
>
> If you carefully read the posting that was referred to you will see that
> lme() and not lmer() was used as an example (for using with the multcomp
> package). lmer() was only mentioned as an aside... lmer() is S4 and doesn't
> work with multcomp, which is S3.

That is not true (but it may once have been?). multcomp ``suggests'' lme4 and is distributed with a vignette that has a lmer example with the same random effect expression as the R-Help thread you directed the OP to read.

The OP's example works for me with latest CRAN versions of multcomp, lme4 and Matrix installed (well, with a warning about false convergence from nlminb in the lmer call and a warning from the call to glht about the covariate interaction and questioning if the default contrasts are appropriate - all things for Chunhao to consider himself me thinks...).

Chunhoa, I'm not familiar enough with lme4 to know what is the correct way to specify the random effects you want. You could consider moving this onto the R-mixed-models SIG:

https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

or search the archives of that list as lmer/lm4 are discussed there quite a lot.

HTH G

>
> Apropos of specifying random effects: an example was given in the posting
> showing that aov(... +Error(...)) and lme(..., random =...) give the same
> result. Use that as your guideline.
>
> HTH, Mark.
>
>
> ctu wrote:
> >
> > Tank you (Anna & Mark) very much for this super information
> > Let me confirm that IF I want to perform the RM-ANOVA
> > I should use "lmer" and perform the post-hoc test by using "glht", right?
> >
> > Because I am not so familiar with "lmer" so I have two more questions.
> > Let me use that following example again,
> > 1. Is the random effect statement correct? if no what will be?
> > 2. What did I do wrong in glht?
> >
> >
> > require(lme4);require(nlme)
> > group <-rep(rep(1:2, c(5,5)), 3);time <-rep(1:3, rep(10,3));subject <-
> > rep(1:10,3)
> > p.pa <- c(92, 44, 49, 52, 41, 34, 32, 65, 47, 58, 94, 82, 48, 60, 47,
> > 46, 41, 73, 60, 69, 95, 53, 44, 66, 62, 46, 53, 73, 84, 79)
> > P.PA <- data.frame(subject, group, time, p.pa)
> > P.PA$group=factor(P.PA$group);P.PA$time=factor(P.PA$time)
> > P.PA$subject=factor(P.PA$subject)
> >
> > tlmer<-lmer (p.pa ~ time * group + (time*group | subject), data=P.PA )
> >
> >> summary(glht(tlmer,linfct=mcp(group="Tukey")))
> > Error in UseMethod("fixef") : no applicable method for "fixef"
> > In addition: Warning message
> >
> > Thank you very much
> > Chunhao
> >
> > ______________________________________________
> > 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.
> >
> >
>

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

______________________________________________
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.
Received on Wed 30 Jul 2008 - 09:25:42 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 30 Jul 2008 - 10:33:12 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive