r - find out data set for terminal nodes in regression tree -



r - find out data set for terminal nodes in regression tree -

i generated regression tree, , need stepwise regression in each terminal node. when seek run next code every time next error message. can please help me how find info set each terminal node?

library(xlconnect) data1=loadworkbook("trb88.xlsx", create = false) dat = readworksheet(data1, sheet="sheet1") fit=lm(totalseverity~sl+lw+ntl+aadtln+s+med+osp+cbd+segl+fc+ow,data =dat) library(rpart) rp1 = rpart(factor(totalseverity)~sl+lw+ntl+aadtln+s+med+osp+cbd+segl+fc+ow,dat=dat,method="anova") cv.rpart(rp1) printcp(rp1) tn1_1=rownames(table(as.matrix(rp1$where))) #index tn df_1=as.data.frame(rp1[["frame"]]) #find tn tn2_1=rownames(df_1[as.numeric(tn1_1),]) #find tn d1=list() #data d1[[i]]=dat[cases.tree(rp1,tn2_1),c(1:11,12)]

error message

"error in [.data.frame(dat, cases.tree(rp1, tn2_1), c(1:11, 12)) : not find function "cases.tree""

my info set contains 11 predictor variables , 1 response variable.

r

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -