[R] Problem with predict.rpart

Ursula Sondhauss sondhaus at statistik.uni-dortmund.de
Thu Jul 19 11:16:56 CEST 2001


I am using rpart only once in a while. It has been changed and now I
can't get my programs to work again...

predict.rpart used to return posterior probabilities. Now the help
function says it returns:

"if type="vector": vector of predicted responses or, if the response is
a factor, matrix of predicted class probabilities"

Now I hoped

"z <- rpart(as.factor(V1) ~
.,train,method="class",parms=list(prior=apriori,split='information'))
new <- predict.rpart(z,test,type="vector")"

would do the job, but it doesn't. I get predicted responses only.

Trying

"new <- predict.rpart(z,test,type="tree")"

just to see whether I can use tells me

"Error in predict.rpart(z, test, type = "tree") :
        Invalid prediction for rpart objects"

What can I do?

Ursula Sondhauss



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list