I'm trying to run a simple mixed model by subject id: y=week. Since it's repeated measures, I assumed that I need to use mixed model to account for within subject variability, even though I want to run the model by subject id? In addition, since the measurements are equally spaced, I tried to use AR(1) covariance structure. However, my code: fm <- lme(y ~ week , correlation = corAR1(), data = test) didn't work and I don't know what's the problem.
I'm new to R and my questions are:
- How to run mixed model by study id, so that each model is for each participant?
- Since I want to run each model by study id, there is only within subject variability. Is nlme:lme with AR structure over complicated ?
here is my sample data:
Thanks everyone's feedback, much appreciated!