amices / mice

Multivariate Imputation by Chained Equations
https://amices.org/mice/
GNU General Public License v2.0
424 stars 106 forks source link

Error: If no blocks are specified, predictorMatrix must have same number of rows and columns #590

Closed DanielIAvila closed 9 months ago

DanielIAvila commented 9 months ago

I have a really "big" problem using mice. I have posted a question here.

I am getting an error (displayed in the title), but my df_a has 160 rows and 6 columns, where the predictor_matrix has the same shape, except that the first three columns are set to FALSE and the remaining three to TRUE.

hanneoberman commented 9 months ago

I believe this is not a bug in mice, but a problem with the custom imputation function. The function you wrote does not adhere to the mice.impute.XYZ conventions, where XYZ refers to your imputation model, see e.g. https://github.com/amices/mice/blob/master/R/mice.impute.mpmm.R for an example of a multivariate imputation method.