Reputation: 6423
I am a total novice in R. I am trying to test the mice package for missing imputation using the random forest method as the imputation algorithm:
library(mice)
data <- matrix(c(1.0, 10.5, 1.5, 13.2, 1.8, 8.0, 1.7, 15.0, 23, 40.0, 2.0, 21.0, 3.3, 38.0, 4.5, -2.3, NA, -2.4),nrow=9,ncol=2, byrow=TRUE)
impObject <- mice(as.data.frame(data),m=1,meth='rf',printFlag=FALSE)
completedData <- complete(impObject,1)
print(completedData)
The code above already gives me the error: Error in nodes_mis[, i] : incorrect number of dimensions
.
If I use other imputation methods, or if I use slightly modified input data (let's say data <- matrix(c(1.0, 10.5, 1.5, 13.2, 1.8, 8.0, 1.7, NA, 23, 40.0, 2.0, 21.0, 3.3, 38.0, 4.5, -2.3, NA, -2.4),nrow=9,ncol=2, byrow=TRUE)
) it works.
Is it a bug in the package implementing the rf method for mice (that by the way I can't find its name, it did ask me to install it but I can't retrieve back its name) ?
Eventually, as do you report bugs in R packages ?
Upvotes: 0
Views: 1196
Reputation: 3235
This issue has since been solved, which is discussed here.
In brief, in mice
version 3.14.0, the default value for the rfPackage
argument of mice:::mice.impute.rf
switched from randomForest
to ranger
(see here). When there was only one missing value, something went wrong with subsetting one of the matrices. This has been fixed (see here) and implement in version 3.14.2.
Upvotes: 1