[R] Mixed Effects Model on Within-Subjects Design
dderiso at ucsd.edu
Thu May 20 09:28:46 CEST 2010
Thank you for your helpful advice. I will take a look at the multicomp package.
I was wondering where the lme() function outputs the interaction
Below is the output to the code I had originally sent. Which one of
these is condition*difficulty?
Fixed effects: value ~ condition * diff
Value Std.Error DF t-value p-value
(Intercept) 300109.95 9506.690 688 31.568289 0.0000
condition2 27717.65 9071.048 688 3.055617 0.0023
condition3 -23718.72 9071.048 688 -2.614772 0.0091
diff50 56767.55 9071.048 688 6.258103 0.0000
diff75 120031.80 9071.048 688 13.232408 0.0000
condition2:diff50 -45481.21 12828.399 688 -3.545354 0.0004
condition3:diff50 7333.37 12828.399 688 0.571651 0.5677
condition2:diff75 -38765.77 12828.399 688 -3.021871 0.0026
condition3:diff75 12919.59 12828.399 688 1.007109 0.3142
Also, why are diff25 and condition1 missing from the output??
Thanks again for your generous help!!!
On Wed, May 19, 2010 at 10:08 PM, David Atkins <datkins at u.washington.edu> wrote:
> Given that you want all comparisons among all means in your design, you
> won't get that directly in a call to lme (or lmer in lme4 package). Take a
> look at multcomp package and its vignettes, where I think you'll find what
> you're looking for.
> cheers, Dave
> Dave Atkins, PhD
> Research Associate Professor
> Department of Psychiatry and Behavioral Science
> University of Washington
> datkins at u.washington.edu
> Center for the Study of Health and Risk Behaviors (CSHRB)
> 1100 NE 45th Street, Suite 300
> Seattle, WA 98105
> Center for Healthcare Improvement, for Addictions, Mental Illness,
> Medically Vulnerable Populations (CHAMMP)
> 325 9th Avenue, 2HH-15
> Box 359911
> Seattle, WA 98104?
> Dear R Experts,
> I am attempting to run a mixed effects model on a within-subjects repeated
> measures design, but I am unsure if I am doing it properly. I was hoping
> that someone would be able to offer some guidance.
> There are 5 independent variables (subject, condition, difficulty,
> repetition) and 1 dependent measure (value). Condition and difficulty are
> fixed effects and have 3 levels each (1,2,3 and 25,50,75 respectively),
> while subject and repetition are random effects. Three repeated measurements
> (repetitions) were taken for each condition x difficulty pair for each
> subject, making this an entirely within-subject design.
> I would like an output that compares the significance of the 3 levels of
> difficulty for each condition, as well as the overall interaction of
> condition*difficulty. The ideal output would look like this:
> condition1:diff25 vs. condition1:diff50 p_value = ....
> condition1:diff25 vs. condition1:diff75 p_value = ....
> condition1:diff50 vs. condition1:diff75 p_value = ....
> condition2:diff25 vs. condition1:diff50 p_value = ....
> condition2:diff25 vs. condition1:diff75 p_value = ....
> condition2:diff50 vs. condition1:diff75 p_value = ....
> condition3:diff25 vs. condition1:diff50 p_value = ....
> condition3:diff25 vs. condition1:diff75 p_value = ....
> condition3:diff50 vs. condition1:diff75 p_value = ....
> condition*diff p_value = ....
> Here is my code:
> #get the data
> study.data =read.csv("http://files.davidderiso.com/example_data.csv",
> subject = factor(subject)
> condition = factor(condition)
> diff = factor(diff)
> rep = factor(rep)
> #visualize whats happening
> interaction.plot(diff, condition, value, ylim=c(240000,
> 450000),ylab="value", xlab="difficulty", trace.label="condition")
> #compute the significance
> study.lme = lme(value~condition*diff,random=~1|subject/rep)
> Thank you so much for your generous help!!!
> Dave Deriso
> UCSD Psychology
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help