Dear Marco, You might also take a look at ?Anova (or ?Manova) in the car package; the last examples are for a repeated-measures ANOVA using both MANOVA and univariate approaches, the latter with GG and HF corrections.
I hope this helps, John -------------------------------- John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -------------------------------- > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Marco B > Sent: Sunday, May 13, 2007 10:22 AM > To: [email protected] > Subject: [R] Some questions on repeated measures (M)ANOVA & > mixed modelswith lme4 > > Dear R Masters, > > I'm an anesthesiology resident trying to make his way through > basic statistics. Recently I have been confronted with > longitudinal data in a treatment vs. control analysis. My > dataframe is in the form of: > > subj | group | baseline | time | outcome (long) or subj | > group | baseline | time1 |...| time6 | (wide) > > The measured variable is a continuous one. The null > hypothesis in this analysis is that the Group factor does not > significantly influence the outcome variable. A secondary > null hypothesis is that the Group x Time interaction is not > significant, either. Visual of the group means indicates the > outcome measure decreases linearly (more or less) over time > from baseline values. The time==1...time==6 intervals are > equally-spaced and we have equal sample sizes for the groups. > > I've done a little reading around and found (at least) four > possible approaches: > > A. Linear mixed model using lme4 with random intercept and slope with > lmer() or lme() > > B. Repeated measures ANOVA using aov() with Error() > stratification (found in Baron & Li, 2006), something along > the lines of: > aov(outcome ~ group * time + baseline + Error(subj+subj:time)) > > (from: http://cran.r-project.org/doc/contrib/Baron-rpsych.pdf, p. 41) > > C. "Repeated measures" MANOVA as follows (using data in wide format): > response <- cbind(time1,time2,time3,time4,time5,time6) > mlmfit <- lm(response ~ group) > mlmfit1 <- lm(response ~ 1) > mlmfit0 <- lm(response ~ 0) > # Test time*group effect > anova.mlm(mlmfit, mlmfit1, X=~1, test="Spherical") # Test > overall group effect anova.mlm(mlmfit, mlmfit1, M=~1) # Test > overall time effect anova.mlm(mlmfit1, mlmfit0, X=~1, > test="Spherical") > > (taken from http://tolstoy.newcastle.edu.au/R/help/05/11/15744.html) > > Now, on with the questions: > > 1. This is really a curiosity. I find lmer() easier to use > than lme(), but the former does not allow the user to model > the correlation structure of the data. I figure lmer() is > presently assuming no within-group correlation for the data, > which I guess is unlikely in my example. Is there a way to > compare directly (maybe in terms of > log-likelihood?) similar models fitted in lme() and lmer()? > > 2. Baron & Li suggest a painful (at least for me) procedure > to obtain Greenhouse-Geisser or Huyn-Feldt correction for the > ANOVA analysis they propose. Is there a package or function > which simplifies the procedure? > > 3. I must admit that I don't understand solution C. I can > "hack" it to fit my model, and it seems to work, but I can't > seem to grasp the overall concept, especially regarding the > outer and/or inner projection matrices (M & X). Could anyone > point me to a basic explanation of the procedure? > > 4. Provided the assumptions for ANOVA hold, or that > deviations from them are not horrible, am I correct in saying > that this procedure would be the most powerful one? How would > you choose solution A over solution B (or viceversa)? > > My sincerest gratitude to anyone who will take the time to > answer my questions! > > Best Regards, > > Marco > > ______________________________________________ > [email protected] 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. > ______________________________________________ [email protected] 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.
