I have the following design: Participants are randomly assigned to either a control group $C$ or an intervention group $I$. Each participant is measured at two times, $T_0$ and $T_1$. At each time point, each participant is measured three times. The dataset looks like this:
$$ \begin{array}{c|c|c|c|c} y & \text{ID} & \text{Group} & \text{Time} & \text{Repetition} \\ \hline \ldots & 1 & C & 0 & 1 \\ \ldots & 1 & C & 0 & 2 \\ \ldots & 1 & C & 0 & 3 \\ \ldots & 1 & C & 1 & 1 \\ \ldots & 1 & C & 1 & 2 \\ \ldots & 1 & C & 1 & 3 \\ \ldots & 2 & I & 0 & 1 \\ \ldots & 2 & I & 0 & 2 \\ \ldots & 2 & I & 0 & 3 \\ \ldots & 2 & I & 1 & 1 \\ \ldots & 2 & I & 1 & 2 \\ \ldots & 2 & I & 1 & 3 \\ \ldots & \ldots & \ldots & \ldots \\ \end{array} $$
A descriptive graph of the data is here:
Each participant has its own color and the points are slightly dodged for each participants. The lines connect the individual and time-specific means for each participant.
I want to fit a linear mixed effects model to these data with the following fixed and random effects:
- Fixed effects for $\text{Group}$ and $\text{Time}$, together with an interaction between the two ($\text{Group}\times\text{Time}$).
- A random intercept for $\text{ID}$
- A random intercept for $\text{Repetition}$
Because each participant has three measurements at each time point, I would think that $\text{ID}$ and $\text{Repetition}$ are crossed, not nested random effects.
Using lmer
from the lme4
package:
lmer(y~Time*Group + (1|ID) + (1|Repetition), data = dat)
Random effects:
Groups Name Std.Dev.
ID (Intercept) 561.4
Repetition (Intercept) 0.0
Residual 494.0
Number of obs: 108, groups: ID, 21; Repetition, 3
Fixed Effects:
(Intercept) TimeT1 GroupK TimeT1:GroupK
1758.2 -266.0 -262.0 140.3
However, this results in a singular fit with the variance of Repetition
being $0$. If I fit a random intercept for $\text{Repetition}$ separately for each $\text{Time}$, the model converges:
lmer(y~Time*Group + (1|ID) + (1|Repetition:Time), data = dat)
Random effects:
Groups Name Std.Dev.
ID (Intercept) 561.33
Repetition:Time (Intercept) 50.86
Residual 491.96
Number of obs: 108, groups: ID, 21; Repetition:Time, 6
Fixed Effects:
(Intercept) TimeT1 GroupK TimeT1:GroupK
1756.7 -264.5 -261.3 139.6
Even if I fit seperate intercepts for $\text{ID}$ per time, the model converges:
mod <- lmer(y~Time*Group + (1|ID:Time) + (1|Repetition), data = dat_mono2)
Random effects:
Groups Name Std.Dev.
ID:Time (Intercept) 609.0
Repetition (Intercept) 29.1
Residual 442.9
I can't wrap my head around why it works in these cases. Hence my questions:
- Why does the second model converge and the first one not?
- What would an appropriate random effects structure be for this design?
Edit
I simulated some values according to my design and the model converged with no problems and it successfully recovered the parameters of the simulation. This indicates to me that the model could converge in theory but doesn't because the variance of $\text{Repetition}$ is quite small. It's still a mystery why the more complex model does converge with my data, however.