I think that your approach is correct. Model m1
specifies a separate intercept for each subject. Model m2
adds a separate slope for each subject. Your slope is across days as subjects only participate in one treatment group. If you write model m2
as follows it's more obvious that you model a separate intercept and slope for each subject
m2 <- lmer(Obs ~ Treatment * Day + (1+Day|Subject), mydata)
m2 <- lmer(Obs ~ Treatment * Day + (1+Day|Subject), mydata)
This is equivalent to:
m2 <- lmer(Obs ~ Treatment + Day + Treatment:Day + (1+Day|Subject), mydata)
m2 <- lmer(Obs ~ Treatment + Day + Treatment:Day + (1+Day|Subject), mydata)
I.e. the main effects of treatment, day and the interaction between the two.
I think that you don't need to worry about nesting as long as you don't repeat subject ID's within treatment groups. Which model is correct, really depends on your research question. Is there reason to believe that subjects' slopes vary in addition to the treatment effect? You could run both models and compare them with anova(m1,m2)
to see if the data supports either one.
I'm not sure what you want to express with model m3
? The nesting syntax uses a /
, e.g. (1|group/subgroup)(1|group/subgroup)
.
I don't think that you need to worry about autocorrelation with such a small number of time points.