【发布时间】:2011-01-24 17:41:28
【问题描述】:
当使用 R 的 rpart 函数时,我可以轻松地用它拟合模型。例如:
# Classification Tree with rpart
library(rpart)
# grow tree
fit <- rpart(Kyphosis ~ Age + Number + Start,
method="class", data=kyphosis)
printcp(fit) # display the results
plotcp(fit)
summary(fit) # detailed summary of splits
# plot tree
plot(fit, uniform=TRUE,
main="Classification Tree for Kyphosis")
text(fit, use.n=TRUE, all=TRUE, cex=.8)
我的问题是—— 如何衡量我的三个解释变量(年龄、数字、开始)中的每一个对模型的“重要性”?
如果这是一个回归模型,我可以查看来自“anova”F 检验的 p 值(在有和没有变量的 lm 模型之间)。但是在lm 上使用“anova”与rpart 对象有什么等价性?
(我希望我能把我的问题说清楚)
谢谢。
【问题讨论】:
标签: r tree regression rpart cart-analysis