I want to predict the relationship between the number of groups a person belongs to and their overall well-being (totalwell). However, I would like to consider the possibility that a person could belong to numerous groups of low quality. To address this, I intend to use participant MapID
and group_quality
as random effects, while using the number of groups a person belongs to as the predictor and total well-being as the outcome variable.
I have this dataset:
MapID CircleID TotalNumberofCircles totalwell group_quality
<dbl> <int> <dbl> <dbl> <dbl>
1 1381 1 5 4.93 8.67
2 1381 2 5 4.93 2.67
3 1381 3 5 4.93 10
4 1381 4 5 4.93 7.67
5 1381 5 5 4.93 5.33
6 1391 1 7 4.53 9
7 1391 2 7 4.53 7
8 1391 3 7 4.53 5
9 1391 4 7 4.53 8
10 1391 6 7 4.53 7
# ... with 190 more rows
>
And this is the model I'd like to run:
ctrl <- lmerControl(optimizer = "Nelder_Mead", optCtrl = list(maxfun = 100))
MLM <- lmer(totalwell ~ CircleID + (1 | MapID:group_quality), data = df, control = ctrl)
And I'm getting the following convergence issues. Can anyone help me out here? Is there a problem with how my data is structured?
> ctrl <- lmerControl(optimizer = "Nelder_Mead", optCtrl = list(maxfun = 100))
> MLM <- lmer(totalwell ~ CircleID + (1 | MapID:group_quality), data = df, control = ctrl)
Warning messages:
1: In (function (fn, par, lower = rep.int(-Inf, n), upper = rep.int(Inf, :
failure to converge in 100 evaluations
2: In optwrap(optimizer, devfun, getStart(start, rho$pp), lower = rho$lower, :
convergence code 4 from Nelder_Mead: failure to converge in 100 evaluations
3: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.237603 (tol = 0.002, component 1)
4: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
EDIT!!
Okay so I have since restructured the model and this is what I'm trying to run:
MLM <- lmer(totalwell ~ CircleID + (1 + group_quality | MapID),
data = df)
and my fit is now singular
> MLM <- lmer(totalwell ~ CircleID + (1 + group_quality | MapID),
+ data = df)
boundary (singular) fit: see help('isSingular')
>
I've tried simplifying the model by taking out group_quality
, and just holding Map ID as the only random effect. but this didn't work. In fact, it failed to converge when I took out group_quality
I'm wondering if perhaps I could run a bayesian analysis instead or if maybe I could use a different kind of model?
EDIT #2: I have since been trying this model instead, but still no luck with fixing the singular fit:
MLM <- lmer(totalwell ~ TotalNumberofCircles + (1 + group_quality | CircleID) + (1| MapID),
data = df)