[R] Puzzled at rpart prediction

From: Ajay Narottam Shah <ajayshah_at_mayin.org>
Date: Thu 04 Aug 2005 - 11:03:21 EST


I'm in a situation where I say:

> predict(m.rpart, newdata=D[N1+t,])

      0 1
173 0.8 0.2

which I interpret as meaning: an 80% chance of "0" and a 20% chance of "1". Okay. This is consistent with:

> predict(m.rpart, newdata=D[N1+t,], type="class")
[1] 0
Levels: 0 1

But I'm puzzled at the following. If I say:

> predict(m.rpart, newdata=D[N1+t,], type="vector")
173
  1

What gives?

I will be happy to packup a runnable demonstration for any of you, but I wondered if it was just my lack of knowledge about "type" in predict.rpart; wondered if there was a simple and logical explanation.

-- 
Ajay Shah                                                   Consultant
ajayshah@mayin.org                      Department of Economic Affairs
http://www.mayin.org/ajayshah           Ministry of Finance, New Delhi

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Aug 04 14:12:25 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:40 EST