[R] cforest() and missing values (party package)
Florian Kiefer
florian.kiefer at stud.unibas.ch
Tue Feb 22 14:53:49 CET 2011
Dear mailing list,
I am using the cforest() method from the party package to train a
randomForest with ten input parameters which sometimes contain "NA"s.
The predicted variable is a binary decision. Building the tree works
fine without warnings or error messages, but when using the predict()
statement for validation, I run in an error:
forest <- cforest(V31 ~ V1+V2+V3, data=training)
prediction <- predict(forest, testset)
"Error in OOB && is.null(newdata) : invalid 'x' type in 'x && y'"
On the other hand: Creating a tree, using the ctree() method and
validating the prediction using the predict() method works fine:
tree <- ctree(V31 ~ V1+V2+V3, data=training)
prediction <- predict(tree, testset)
"training" and "testset" are sampled from the same data.frame. Does
anyone has an explanation for this behavior? I would like to test if
cforest() outperforms ctree()!
Thank you for your help!
Florian Kiefer
More information about the R-help
mailing list