I'm in the process of building my mixed models, and unfortunately I encountered a problem when creating the random effects structure. I have two random effects: ResponseId (i.e., participant number) and stim_Id (i.e., item number). I have added random intercepts for both effects, since they are both source of non-independence in my data. I have also added two by-participant random slopes, for each of my two within-subject variables, here named face_type and stim_gender, both being two-level factors. Unfortunately, if I do add both of the random slopes, the model fails to converge. I have tried some ways to solve it but I think the rigth thing to do is to get rid of one of the random slopes.
I have looked at the output of my model (model and output showed below) and I can see that the intercept for ResponseId is 0 or close to 0, which means it doesn't add much to the overall model. But, does it mean that I should get rid of the random intercept here? I would find it unusual to have a model with fixed intercept and random slope. I'd rather expect to remove the random slope and keep the random intercept, however the 0 value of intercept (while the value of slope seems to be 0.04) somewhat confuses me. Does anyone have experience with this?
Important note:
- After fitting the fixed effects, only the predictor of face_type is significant, no matter how I structure the random effects. I suppose that would in itself predict that random slope with stim_gender doesn't add much, is that correct? Even if that's true, I don't want to use this backwards approach as justification to get rid of one variable of another...
My model and the output:
lmer(rating ~ 1 + (1|stim_Id) + (1 + face_type|ResponseId) + (1 + stim_gender|ResponseId), REML=F, data=df)
Linear mixed model fit by maximum likelihood . t-tests useSatterthwaite's method [lmerModLmerTest]
AIC BIC logLik deviance df.resid
13883.8 13942.5 -6932.9 13865.8 5047
Scaled residuals:
Min 1Q Median 3Q Max
-4.8467 -0.3878 -0.0989 0.1336 6.1131
Random effects:
Groups Name Variance Std.Dev. Corr
ResponseId (Intercept) 0.24997 0.5000
face_typereal 0.09006 0.3001 -1.00
ResponseId.1 (Intercept) 0.00000 0.0000
stim_gendermale 0.03962 0.1990 NaN
stim_Id (Intercept) 0.53824 0.7336
Residual 0.82318 0.9073
Number of obs: 5056, groups: ResponseId, 79; stim_Id, 64
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 0.4592 0.1010 85.8841 4.547 0.0000177 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
optimizer (nloptwrap) convergence code: 0 (OK)
boundary (singular) fit: see ?isSingular