Displaying 1 result from an estimated 1 matches for "cp50".
Did you mean:
c50
2012 Dec 07
0
loop for calculating 1-se in rpart
...ake the minimum xerror
each time, followed by the histogram. However to calculate the appropriate
tree size which satisfies the 1-se rule I need to select "minimum xerror" <
xerror < "(minimum xerror + xstd error)" and which also has the smallest
"nsplit".
> cp50 <- replicate(50,{ fit1 <-
rpart(chbiomsq~HC+BC+POC+RUG+Depth+Exp+DFP+FI+LAT, data=ch,method="anova",
control=rpart.control(minsplit=10,cp=0.01,xval=10));x=printcp(fit1);x[which.min(x[,"xerror"]),"nsplit"]})
> hist(cp50,main="optimal splits for tree"...