Skip to content
Prev 262697 / 398502 Next

In rpart, how is "improve" calculated? (in the "class" case)

Tal,

For the Gini criterion, the "improve" value can be calculated as a 
weighted sum of the improvement in impurity.  Continuing with your 
original code:

# for "gini"
impurity_root<- gini(prop.table(table(y)))
impurity_l<- gini(prop.table(table(obs_0)))
impurity_R<-gini(prop.table(table(obs_1)))

# (13 and 7 are sample sizes in respective nodes)
13*(impurity_root - impurity_l) + 7*(impurity_root - impurity_R)
[1] 5.384615

This does not appear to extend immediately to the information criterion, 
however.  I'm not sure about the 6.84.

Ed
On 6/14/11 5:00 AM, r-help-request at r-project.org wrote: