amices / mice

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

Fail to impute categorical variables - loggedEvents: constant #461

Closed xiw588 closed 2 years ago

xiw588 commented 2 years ago

Hi, I am trying to impute two ordered categorical variables. The dataset I input to mice contains seven columns and only two had missingness. groups had 30% missingness and PS had 4 missingness.

I tried to impute using the following code a<-mice(CI_impute,m=3,diagnostics = TRUE,method = 'polr')

Below is the logged events I got. The is a numeric variable called age in this dataset and it is complete. I am wondering where does the problem come. Can you please help me with this? Thank you!

a$loggedEvents it im dep meth out 1 0 0 constant groups 2 0 0 constant Sex 3 0 0 constant histology 4 0 0 constant PS 5 0 0 constant therapy 6 0 0 constant smok

gerkovink commented 2 years ago

First, is the measurement level of your variables correctly coded? I ask because the data are kicked out by the algorithm because they are constant. Second, can you create a reprex? Without a reproducible example it is challenging to be of help.

gerkovink commented 2 years ago

Assuming this has been solved. Feel free to re-open.