Tal Galili
2010-Mar-07 18:46 UTC
[R] Is there an equivalence of lm's “anova” for an rpart object ?
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@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]]
Liaw, Andy
2010-Mar-08 14:52 UTC
[R] Is there an equivalence of lm's "anova" for an rpart object ?
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}}
Reasonably Related Threads
- Extracting the terms from an rpart object
- enableJIT(2) causes major slow-up in rpart
- How to measure/rank “variable importance” when using rpart?
- rpart - how to estimate the “meaningful” predictors for an outcome (in classification trees)
- Inconsistencies in the rpart.object help file?