[R] Problems with tree package
Hugo Morganho
hjm at holos.pt
Thu Jan 31 11:11:48 CET 2002
Hi,
I'm getting a problem with the tree package under windows nt
I'm using the package to produce a tree. The training set has +- 4000
examples.
I use the instruction
hm.tr <-tree(X1~.,teste2)
wich produces me this tree
1) root 4272 4037.000 0 ( 0.819288 0.180712 )
2) X2: 0 1640 2261.000 0 ( 0.543902 0.456098 )
4) X4: 0 357 170.600 1 ( 0.064426 0.935574 ) *
5) X4: 1 1283 1614.000 0 ( 0.677319 0.322681 )
10) X8: 0 849 1172.000 0 ( 0.538280 0.461720 )
20) X34: 0 701 965.800 1 ( 0.453638 0.546362 )
40) X20: 0 618 823.800 1 ( 0.385113 0.614887 )
80) X31: 0 516 629.100 1 ( 0.298450 0.701550 )
160) X3: 0 247 166.200 1 ( 0.105263 0.894737 ) *
161) X3: 1 269 372.300 1 ( 0.475836 0.524164 )
322) X35: 0 200 262.500 0 ( 0.635000 0.365000 )
644) X30: 0 99 131.900 1 ( 0.383838 0.616162 ) *
645) X30: 1 101 73.640 0 ( 0.881188 0.118812 ) *
323) X35: 1 69 10.450 1 ( 0.014493 0.985507 ) *
81) X31: 1 102 95.060 0 ( 0.823529 0.176471 ) *
41) X20: 1 83 25.810 0 ( 0.963855 0.036145 ) *
21) X34: 1 148 67.840 0 ( 0.939189 0.060811 ) *
11) X8: 1 434 174.100 0 ( 0.949309 0.050691 ) *
3) X2: 1 2632 273.300 0 ( 0.990881 0.009119 )
6) X9: 0 2553 152.600 0 ( 0.995300 0.004700 ) *
7) X9: 1 79 67.310 0 ( 0.848101 0.151899 )
14) X32: 0 12 6.884 1 ( 0.083333 0.916667 ) *
15) X32: 1 67 10.390 0 ( 0.985075 0.014925 ) *
when i used this examples to classificate
> classifica
X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21
1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 X32 X33 X34 X35 X36
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> predict(hm.tr,classifica,"where")
1
3
> classifica[1,2]<-0
> predict(hm.tr,classifica,"where")
1
1
i have this result.
In the first example, as X2 is 1 and X9 is 0 shouldn't result 20?
Is this a problem of the package or i'm i using it inciorrectly?
Thanks
Hugo
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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