[R] model R^2 and partial R^2 values for CART analysis in R

Mirela Tulbure m_tulbure at yahoo.com
Sat Mar 1 01:47:03 CET 2008


Dear R-list members,
 
I am doing a CART analysis in R using the rpart function in the rpart package:
Phrag.rpart=rpart(PhragDiff~., data = Phrag, method="anova", xval=10). 
 
I used the xerror values in the CP table to prune the tree to 4 nsplits:

   CP            nsplit  rel error  xerror    xstd
1 0.098172      0   1.00000 1.02867 0.12768
2 0.055991      3   0.70548 1.00823 0.12911
3 0.029306      4   0.64949 0.83275 0.12074
4 0.018943      5   0.62019 0.86994 0.12467
5 0.010503      6   0.60124 0.86975 0.12080
6 0.010000      7   0.59074 0.87944 0.11757
 
I would like to get R^2 values for the model as well as partial R^2 values for each split. 
I’ve read that the R^2 = 1-rel error, so I am assuming that in my case this would be 1-0.64949. Is this correct? Are the relative R^2 values the CP values? 
 
Your help would be much appreciated. Many thanks in advance,
 
Mirela 


      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping



More information about the R-help mailing list