-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error from mice.impute.2l.lmer() when specifying fixed effects only #384
Comments
Hmm, that doesn't look OK. Could you make a small reprex that shows the problem? |
Thank you for this quick response! I've created a synthetic dataset data_long.csv that can be plugged into the following code:
I checked and get the same behavior: Error for specifying everything as a fixed effect, Flat diagnostics when everything is a random effect. Please let me know if you have any trouble with the data file. |
…tead of row vector when the cluster contains only 1 observation (#384)
Thanks. I could reproduce and found the problem. Cluster 14 in your data contains just one observation, which confused
|
@shahabjolani Could you perhaps take a look at the flat lines plots, which look interesting/curious? |
@stefvanbuuren @cshawsome Based on your toy example, it seems the imputation model is over-parameterised. I got the following warning for your example: In mice.impute.2l.lmer(y = c(0.410241097375509, 0.502364878854811, : This implies the multilevel imputation model (i.e., 2l.lmer) is not run so that no imputations should be produced. Nevertheless, when I look at the imputed data using the 'complete' function, the missing values are imputed! I have no idea what has been imputed but I am almost certain that the 2l.lmer is not used. @stefvanbuuren Do you have any idea? Now, if you look at the mean of the imputed(!) values at each iteration, you realise the mean and sd of imputations are identical across iterations. This explains why you get the flat lines |
OK, thanks. I understand that the cause of the flat lines is that I'll open a new issue for this. |
Indeed, the flat lines can act as an alert. However, this is not necessarily the behaviour of mice.impute.2l.lmer(), I think. If an imputation function (like this one) does not run, you will get such flat lines anyway... |
checked the fix on my real data and it works-- thank you! |
I'm having trouble imputing with 2l.lmer() when I only include fixed effects in the predictor matrix. I specify ID as the clustering variable by using -2 and specify the other 23 variables as fixed effects by using 1 in the predictor matrix. When I run the function I get this error message:
Error in Xi %*% beta.star : non-conformable arguments
I thought this might be related to a previously closed issue about 2l.norm() where the solution at that time was to include every predictor as a random effect: #62
When I specify all predictors as random effects in 2l.lmer(), the function runs but my diagnostic plots are completely flat.
Using 2l.norm() with fixed effects only with the same dataset runs and produces chains that mix, though. Is there something I'm missing about the 2l.lmer() function?
The text was updated successfully, but these errors were encountered: