[R] xerror and xstd are missing from cptable of the Rpart package

Adams, Jean jvadams at usgs.gov
Tue Feb 3 14:23:34 CET 2015


Kim,

The "x" in "xerror" and "xstd" stands for cross validation.  But you have
specified no cross validations, xval=0.

Try:

model <- rpart(Product ~ ., data=trainData, control=rpart.control(minsplit=50,
cp=0.002))
model$cptable

Jean


On Tue, Feb 3, 2015 at 7:09 AM, Kim C. <minorthreatx at hotmail.com> wrote:

> Hello all,
> I'm making a decision tree with the rpart package. I want to prune the
> tree and in many tutorials it says to use cptable. Like so: opt <-
> which.min(model_rpart$cptable[, "xerror"])
> The problem is that when I look up model_rpart$cptable it only show the
> columns CP, nsplit, rel error. So xerror and xstd are missing. How can this
> be?
> Model looks like this: model <- rpart(Product~. , data=trainData,
> control=rpart.control(minsplit=50, cp=0.002, xval=0))
>
> Thank you.
> Kim
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list