[R] QUestion on prediction of class from rpart
Kamakshi
laksh004 at tc.umn.edu
Thu Aug 10 21:10:08 CEST 2006
Hello,
I am trying to predict the classes of a test data set after training an
rpart tree.
When I run:
predict(rpart_object_based_on_training_data, newdata = "testdata", type
= "class", na.action = na.pass)
I get an error message saying that a variable that is present in both
training and test data sets has new
levels in the test set. This is true that there are new levels for some
of the variables in the test set, although,
the variables themselves are identical in both. My understanding from
reading the documentation on
predict.rpart is that if one of the facor-variables does have new levels
in the test set, it is passed through the tree and
is left at the deepest possible node. I tried to run predict.rpart
directly but it says "function not found". Does this have
to be installed separately? I have loaded the rpart library to run the
training data. I have not
found this exact situation in the Archives.
Thankyou
Kamakshi
--
laksh004 at umn.edu
More information about the R-help
mailing list