Solved – Mixed model repeated measures in R – specific questions

covariancemixed modelrrepeated measuressas

I am using a mixed model repeated measures analysis and have a few questions in terms of how to structure the model.

My setup is 24 individual plots, grouped into 6 blocks. There are 4 treatments in 2 levels: i.e. 2 different treatment types, 4 treatments in total: No treatment, treatment 1, treatment 2, interaction between treatment 1 and 2. Each treatment is replicated once per block, i.e. 6 times in total.

Measurements are repeated over time. I.e. the same plot is repeatedly measured at different time points. All plots are measured once for each time point. The time intervals between each measurement campaign (time point) are not equal (i.e. could vary from a few days to several weeks), which needs to be accounted for in the analysis, if possible. Most likely, the variances are also not equal for each measurement campaign.

I would put Block as a random factor, but it could also be added as a fixed effect.

So to sum up:

Dependent variable – y

Fixed effects – Treatments T1 and T2, separately and interaction

Random effect – Block (could also be fixed?)

Subject – PlotID, individual plots (which are repeated through time)

Repeated measures – Time point (given as day-of-year)

I tried the following syntax for mixed model repeated measures in R (lme4 package, lmerTest for p-values):

a. lmer(y ~ T1 * T2 * Time + (1|Block), data=dataset)

But I understand there are other ways as well:

b. lmer(y ~ T1 * T2 * Time + (1+Time|Block), data=dataset)

c. lmer(y ~ T1 * T2 * Time + (1|Block/Time), data=dataset)

d. lmer(y ~ T1 * T2 * Time + (1|Block:Time), data=dataset)

e. lmer(y ~ T1 * T2 * Time + (1+Block|PlotID), data=dataset)

Here are my questions:

  1. Which model would be most correct in my case? What are the differences between them?
    I should note that when I ran models b-e, my model did not always converge. What would be the reason for this?

  2. Is this the correct way of doing repeated measures – to simply include Time as a fixed factor? Or is there another way of structuring this type of analysis?

  3. Should Time (day-of-year) be classified as factor, numeric or integer?

  4. Should I specify PlotID anywhere (as in e)? I need the model to recognise that I have 24 individual plots repeated over time. At the same time, I want to correct for the noise arising from the differences between blocks. Each combination of treatment and block is unique (i.e. 24 in total).

  5. What covariance structure does R use?
    How are the degrees of freedom calculated?

  6. I previously set up the analysis in SAS Enterprise. Here, I ran into the problem that I got no significant results at all, even though it looks like there should at least be some significance according to my graphs. Also, I get completely different results in R and SAS. What is the reason for this?

Best Answer

I try to answer, or at least give hints, to those questions I feel a little bit familiar with. I'm no statistics expert, but this is what I understood so far about longitudinal data analysis and growth models using lme4.

I found this page quite helpful to decide how to specify the formula depending on the design. Your random part would probably look like (1 + time | Block/PlotID) - however, I'm not sure if you even would want to include the interaction in the random parts as well.

Maybe these link are also helpful:

Question 2) For repeated measure (or growth models), time should be included as fixed and random factor.

Question 3) If you use time as factor, you may get an error (like number of observations <= number of random effects or so). In such cases, use argument control = lmerControl(check.nobs.vs.nRE="ignore") in your lmer-call. See this post for more details. For more than two or three time points, I would include time as numeric.

Question 4) What do you exactly mean by that? You have to transform your data into long format, thus having a subject-ID-variable which repeats its values for each time point (i.e. each subject is represented max. once per time points).