[R] rpart-question regarding relation between cp and rel error

Ulrike Grömping groemp at tfh-berlin.de
Tue Mar 6 18:47:44 CET 2007


Dear useRs,

I may be temporarily (I hope :-)) confused, and I hope that someone can
answer this question that bugs me at the moment:

In the CP table of rpart, I thought the following equation should hold: 
     rel error = rel error(before) - (nsplit - nsplit(before)) * CP(before),
where (before) always denotes the entry in the row above.
While this equation holds for many rows of the CP tables I've looked at, it
doesn't hold for all. 

For example, in the table below, 0.67182 != 0.68405 - (47-38)*0.0010616,
with a difference of 0.002676 which appears larger than just numerical
inaccuracy.

          CP nsplit rel error  xerror     xstd
1  0.1820909      0   1.00000 1.00000 0.012890
2  0.0526194      1   0.81791 0.81768 0.012062
3  0.0070390      2   0.76529 0.76529 0.011780
4  0.0043850      4   0.75121 0.77660 0.011842
5  0.0036157      5   0.74683 0.77106 0.011812
6  0.0032310      8   0.73598 0.77083 0.011810
7  0.0026541      9   0.73275 0.77083 0.011810
8  0.0025387     14   0.71936 0.76829 0.011796
9  0.0016155     16   0.71429 0.76644 0.011786
10 0.0013847     20   0.70759 0.76206 0.011761
11 0.0011539     28   0.69605 0.76621 0.011785
12 0.0010616     38   0.68405 0.76875 0.011799
13 0.0010001     47   0.67182 0.76991 0.011805
14 0.0010000     57   0.66144 0.77060 0.011809

Can someone explain why/when this happens?

Regards, Ulrike
-- 
View this message in context: http://www.nabble.com/rpart-question-regarding-relation-between-cp-and-rel-error-tf3356652.html#a9335690
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list