Your first model is a random-intercept model; it assumes individuals vary only in their intercepts (test result at time 0/beginning of measurement).
m1 <- lme(Y ~ Group + minutes, data = datas,
random = ~1|ID, na.action=na.omit)
Your second model is a random-slopes model; it allows for random variation in the individual-level slopes (and in the intercept, and a correlation between slopes and intercepts)
m2 <- update(m1, random = ~ minutes|ID)
I'd suggest the random-slopes model is more appropriate (see e.g. Schielzeth and Forstmeier 2009).
Some other considerations:
- might there be an overall difference in time trends across treatments? Perhaps, so I'd suggest including an interaction between
Group
and minutes
(Group*minutes
== 1 + Group + minutes + Group:minutes
- there might be an order effect
- you might want to allow for/check for temporal autocorrelation (e.g.
correlation=corAR1(form = ~ minutes | ID)
, although things might get complicated if you have missing data, see ?nlme::corCAR1
)
BTW there's no such thing as nlme4
: there's an nlme
package, which you'r using (it includes the lme
function), and an lme4
package, which includes the lmer
function ...
Schielzeth, Holger, and Wolfgang Forstmeier. “Conclusions beyond Support: Overconfident Estimates in Mixed Models.” Behavioral Ecology 20, no. 2 (March 1, 2009): 416–20. https://doi.org/10.1093/beheco/arn145.