[R] Is there an equivalence of lm's "anova" for an rpart object ?

Liaw, Andy andy_liaw at merck.com
Mon Mar 8 15:52:44 CET 2010


One way to do it (no p-values) is explained in the original CART book.
You basically add up all the "improvement" (in fit$split[, "improve"])
due to each splitting variable.

Andy 

From: Tal Galili
> 
> Simple example:
> 
> # Classification Tree with rpart
> 
> library(rpart)
> 
> # grow tree
> 
> fit <- rpart(Kyphosis ~ Age + Number + Start,
> 
>      method="class", data=kyphosis)
> 
> Now I would like to know how can I measure the "importance" 
> of each of my
> three explanatory variables (Age, Number, Start) in the model?
> 
> If this was a regression model, I could have looked at p 
> values from the
> "anova" F test (between lm models with and without the 
> variable). But what
> is the equivalence of using "anova" on lm to an rpart object ?
> 
> Any pointers, insights and references to this question will 
> be helpful.
> 
> Thanks,
> 
> Tal
> 
> 
> 
> ----------------Contact
> Details:-------------------------------------------------------
> Contact me: Tal.Galili at gmail.com |  972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il 
> (Hebrew) |
> www.r-statistics.com (English)
> --------------------------------------------------------------
> --------------------------------
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.
> 
Notice:  This e-mail message, together with any attachme...{{dropped:10}}



More information about the R-help mailing list