Hello,
I am trying to use rpart from the rpart library with little success so far,
I have used it in the past though for similar problems but I can't figure
out what I am doing wrong this time, no matter what I do, how I simplify
the problem, I don't get any splits. Here is a simplified run with number
of rows considerably reduced (nsinB2 is a binary variable, 0 or 1):
test.rpart <- rpart(formula =s.factor(nsinB2) ~ priv + kmprom + ageveh,
+ data =est2)
test.rpart
n=05895
node), split, n, loss, yval, (yprob)
* denotes terminal node
1) root 105895 32701 0 (0.6911941 0.3088059) *
The builtin tree function has no problem with the same call, it gives me
lots of splits:
test.tree <- tree(formula =s.factor(nsinB2) ~ priv + kmprom + ageveh,
+ data =est2)
test.tree
node), split, n, deviance, yval, (yprob)
* denotes terminal node
1) root 105895 1.309e+05 0 ( 0.6912 0.30880 )
2) ageveh<6.5 77648 9.865e+04 0 ( 0.6685 0.33150 )
4) ageveh<3.5 47696 6.150e+04 0 ( 0.6543 0.34570 )
8) ageveh<-0.5 3331 3.901e+03 0 ( 0.7277 0.27230 )
16) priv: Non 2856 3.408e+03 0 ( 0.7160 0.28400 )
32) ageveh<-1.5 108 9.732e+01 0 ( 0.8333 0.16670 ) *
33) ageveh>-1.5 2748 3.302e+03 0 ( 0.7114 0.28860 )
66) kmprom<17250 1736 2.055e+03 0 ( 0.7212 0.27880 )
.
.
.
and the output continues for lots more splits. Anyone can figure out what
I am doing wrong?
Thanks for your support,
Gérald Jean
Conseiller senior en statistiques, Actuariat
télephone : (418) 835-4900 poste (7639)
télecopieur : (418) 835-6657
courrier électronique: gerald.jean@dgag.ca
"In God we trust, all others must bring data" W. Edwards Deming
Le message ci-dessus, ainsi que les documents l'accompagnant, sont destinés
uniquement aux personnes identifiées et peuvent contenir des informations
privilégiées, confidentielles ou ne pouvant être divulguées. Si vous avez
reçu ce message par erreur, veuillez le détruire.
This communication (and/or the attachments) is intended for named
recipients only and may contain privileged or confidential information
which is not to be disclosed. If you received this communication by mistake
please destroy all copies.