[R] model R^2 and partial R^2 values

Mark Difford mark_difford at yahoo.co.uk
Sat Mar 1 08:21:21 CET 2008


Hi Mirela,

>> Are the relative R^2 values the CP values?

No.  CP is your complexity parameter.

>> 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?

Yes.  See ?rsq.rpart, and run the example, which I've copied below.

##
par(ask=T)
z.auto <- rpart(Mileage ~ Weight, car.test.frame)
rsq.rpart(z.auto)
par(ask=F)

The values plotted in graph-1 come from 1-rel.error and 1-xerror.

HTH, Mark.


Mirela Tulbure wrote:
> 
> 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 la
> ols.search.yahoo.com/newsearch/category.php?category=shopping
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: http://www.nabble.com/model-R%5E2-and-partial-R%5E2-values-tp15772594p15773072.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list