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", header=T) attach(study.data) 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 library(nlme) study.lme = lme(value~condition*diff,random=~1|subject/rep) summary(study.lme) Thank you so much for your generous help!!! Best, Dave Deriso UCSD Psychology [[alternative HTML version deleted]] ______________________________________________ R-help@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.