I'm trying to use the MICE package to do multiple imputation of missing data in a dataset (dataframe) with with about 2500 observations and 70 variables. When I run the following code, I get the following error.
Code:
imp2 <- mice(data = noascvd_ltd2 , m = 5)
Error message:
iter imp variable
1 1 primary_payor_most_recentError in eval(predvars, data, env) : object 'Anti' not found
I don't understand what "object 'Anti' " refers to or why including certain variables leads to this error message. I found other questions posted about similar Error messages, but none seem to be with the MICE package for multiple imputation.
I have tried removing that variable called "primary_payor_most_recent", but I will then get the error message for another variable in the dataset. I tried sequentially removing each variable that was giving the error message, and I still keep getting it after removing more than 10 variables. All of the variables that seem to be causing the error message are either integers or factors (none are character variables).
Finally, I tried creating a subset of the data that only contains 3 variables (age, hospital site, and our outcome), and then the mice function seemed to work with no error message.