You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to set up a multi-level imputation, but am hitting an error that looks like a bug. The model involves imputation of subject and item level variables (i.e. 2 sets of level 2 variables), and therefore two random intercepts - one for the subject factor, and one for the item factor. When I try to set things up with impute.2l.lmer, I get this error:
Error in str2lang(x) : :1:105: unexpected ')'
1: dv._lmer~1+subid+itemid+cwwt+cagtb+hub_connections+tdiff+rdiff+freq.diff+phonsimdiff+rt+(1+subid+itemid|)
Where the formula seems mangled - the subid and itemid should go on the other side of the |. As well, it seems like subid and itemid are also being included as fixed effects, even though they are coded as 2 for the imputed variable in the predictor matrix.
Appologies for not posting right away with an example - I was hoping this was a known issue or if I broke something obvious. I'm waiting for confirmation from a collaborator that I can share the original data, because I'm having issues reproducing the issue on my own.
There is a pipe symbol | in your code. I believe the language interpreter reads this as a conditional and expects some input, but instead finds a closing parenthesis ). I believe your error will disappear if you adjust the following part in your code:
Thanks for the help. The error isn't happening in the analysis step though, it's happening when I call mice() to do the imputation step. I don't explicitly state an lmer formula anywhere. I've been searching around for any resources on multi-level imputation in mice or other packages or functions to use. I see the mice.impute.ml.lmer in miceadds, but I'm having a hell of a time getting that set up. I'd like to stick to an FCS approach because the analyses I want to do eventually involve random slopes, so joint modelling seems less appealing. But finding clear guidance with good documentation hasn't been easy. Any suggestions on good tutorials or resources for multi-level imputation would be helpful.
@gerkovink Thanks, R expects a variable name after |. It does not make sense to leave it empty. @bryorsnef did you already try specify your class variable?
finding clear guidance with good documentation hasn't been easy. Any suggestions on good tutorials or resources for multi-level imputation would be helpful.
Activity
stefvanbuuren commentedon Dec 9, 2020
Sorry I can't do magic. Please provide a reproducible example in a really simplified case.
bryorsnef commentedon Dec 9, 2020
Appologies for not posting right away with an example - I was hoping this was a known issue or if I broke something obvious. I'm waiting for confirmation from a collaborator that I can share the original data, because I'm having issues reproducing the issue on my own.
gerkovink commentedon Dec 9, 2020
There is a pipe symbol
|in your code. I believe the language interpreter reads this as a conditional and expects some input, but instead finds a closing parenthesis). I believe your error will disappear if you adjust the following part in your code:(1+subid+itemid|)All the best,
Gerko
gerkovink commentedon Dec 9, 2020
I can't even
reprexyour error because the above code breaks thereprex()But in
micethe following code also breaks, which proves my point.bryorsnef commentedon Dec 9, 2020
Thanks for the help. The error isn't happening in the analysis step though, it's happening when I call mice() to do the imputation step. I don't explicitly state an lmer formula anywhere. I've been searching around for any resources on multi-level imputation in mice or other packages or functions to use. I see the mice.impute.ml.lmer in miceadds, but I'm having a hell of a time getting that set up. I'd like to stick to an FCS approach because the analyses I want to do eventually involve random slopes, so joint modelling seems less appealing. But finding clear guidance with good documentation hasn't been easy. Any suggestions on good tutorials or resources for multi-level imputation would be helpful.
stefvanbuuren commentedon Dec 10, 2020
@gerkovink Thanks, R expects a variable name after
|. It does not make sense to leave it empty. @bryorsnef did you already try specify your class variable?gerkovink commentedon Dec 15, 2020
Have a look at the Multilevel Imputation Vignette
Can't help you any further without a proper
reprexsince the error seems to be dependent on your imputation specification.All the best,
Gerko
gerkovink commentedon Dec 23, 2020
Closing as the issue is not reproducible.