I'm using the mice package to interpolate some missing values. I've successfully been using mice in many cases without any problem. However I am now facing an unprecedented problem, that is, after the first iteration I get the following error:
mice(my_data)
iter imp variable
1 1 sunlight
Show Traceback
Rerun with Debug
Error in cor(xobs[, keep, drop = FALSE], use = "all.obs") : 'x' is empty
I have tried to look in the documentation but I cannot find anything useful. I looked up the error on the internet and found this https://stat.ethz.ch/pipermail/r-help/2015-December/434914.html but I was unable to find the answer to the problem described.
Sadly I cannot provide a working example of the data since my_data contains private data that I do not own and therefore cannot make publicly available. my_data is a dplyr dataframe however it looks like there's no difference in using a dplyr or a "base" dataframe.
Could anyone please explain me what is happening and (possibly) how to fix it? Thank you.
EDIT: added some more info on traceback:
cor(xobs[, keep, drop = FALSE], use = "all.obs")
4 remove.lindep(x, y, ry, ...)
3 sampler(p, data, m, imp, r, visitSequence, c(from, to), printFlag,
...)
2 mice::mice(my_data)
Very possible, some columns in the data input are overly correlated that certain methods of imputation are not applicable.
来源:https://stackoverflow.com/questions/38153385/unclear-error-with-mice-package