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

From: Mark Difford <mark_difford_at_yahoo.co.uk>
Date: Fri, 29 Feb 2008 23:21:21 -0800 (PST)

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.

______________________________________________
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.
Received on Sat 01 Mar 2008 - 07:25:35 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 01 Mar 2008 - 07:30:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive