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
Dear Prof.Van Buuren, thank you very much for your book.
I am glad I have a chance to ask you a question here about it as well!
I have the following problem. It happened that I have only one level-2 variable and it has several missing values(it was an online survey from two organizations and there was a trouble with the data collection, so I am am sure the missing data is MCAR). I try to use 2lonly.pmm to fill in the gaps. I specify this variable as a -2 in pred: suppressWarnings(suppressMessages( ini <- mice(df, maxit = 0) )) pred <- ini$pred pred [,"school"] <- -2
When running the mice function it gives me the following error: Error in check.cluster(data, predictorMatrix) : Convert cluster variable school to integer by as.integer()
I switched the organization variable to an integer and the error message then became as the following: Error in .imputation.level2(y = y, ry = ry, x = x, type = type, wy = wy, : No class variable
I added additional variable "city", where both organizations are at, and specified it as a cluster variable in the pred. It didn't help, same error.
Then I tried to specify the full pred matrix in excel and read it from a csv file as a matrix, the error changed to: Error in predictorMatrix[h, ] : subgroup out of bounds
I consulted your book again and saw the following passage:
"It is conceptually straightforward to extend imputations to higher levels (Yucel 2008). If there are two levels, combine all level-2 predictors with an aggregate (e.g., the cluster means) of the level-1 predictors and the level-1 outcomes. Once we have this, we may choose suitable methods from Chapter 3 to impute the missing level-2 variables in the usual way. No new issues arise."
Is there a way to fix my problem? Or, given the above, is there maybe a way to not treat this variable as a cluster variable and just impute it with logreg in mice since it's the only one variable? Do you mean by aggregate to compute mean values or cluster variables?
Thank you in advance for reading the post and have a great day ahead!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Dear Prof.Van Buuren, thank you very much for your book.
I am glad I have a chance to ask you a question here about it as well!
I have the following problem. It happened that I have only one level-2 variable and it has several missing values(it was an online survey from two organizations and there was a trouble with the data collection, so I am am sure the missing data is MCAR). I try to use 2lonly.pmm to fill in the gaps. I specify this variable as a -2 in pred:
suppressWarnings(suppressMessages( ini <- mice(df, maxit = 0) ))
pred <- ini$pred
pred [,"school"] <- -2
When running the mice function it gives me the following error:
Error in check.cluster(data, predictorMatrix) : Convert cluster variable school to integer by as.integer()
I switched the organization variable to an integer and the error message then became as the following:
Error in .imputation.level2(y = y, ry = ry, x = x, type = type, wy = wy, : No class variable
I added additional variable "city", where both organizations are at, and specified it as a cluster variable in the pred. It didn't help, same error.
Then I tried to specify the full pred matrix in excel and read it from a csv file as a matrix, the error changed to:
Error in predictorMatrix[h, ] : subgroup out of bounds
I consulted your book again and saw the following passage:
"It is conceptually straightforward to extend imputations to higher levels (Yucel 2008). If there are two levels, combine all level-2 predictors with an aggregate (e.g., the cluster means) of the level-1 predictors and the level-1 outcomes. Once we have this, we may choose suitable methods from Chapter 3 to impute the missing level-2 variables in the usual way. No new issues arise."
Is there a way to fix my problem? Or, given the above, is there maybe a way to not treat this variable as a cluster variable and just impute it with logreg in mice since it's the only one variable? Do you mean by aggregate to compute mean values or cluster variables?
Thank you in advance for reading the post and have a great day ahead!
Best Regards,
Yulia
Beta Was this translation helpful? Give feedback.
All reactions