[R] #library("CHAID") - Cross validation for chaid

Rodica Coderie rodikgeorgiana at yahoo.com
Wed Jan 7 12:32:16 CET 2015

Thanks Max!

You are right! I used the train function below and no model was built.
Do you know what can I use instead?

mod <- train(x = USvoteS[,-1], y = USvoteS$vote3, 
method = modelInfo, 
trControl = trainControl(method = "cv"))


From: Max Kuhn <mxkuhn at gmail.com>

Cc: "r-help at r-project.org" <r-help at r-project.org> 
Sent: Monday, January 5, 2015 6:56 PM
Subject: Re: [R] #library("CHAID") - Cross validation for chaid

You can create your own:


I put a prototype together. Source this file:


then try this:


### fit tree to subsample
USvoteS <- USvote[sample(1:nrow(USvote), 1000),]

## You probably don't want to use `train.formula` as
## it will convert the factors to dummy variables
mod <- train(x = USvoteS[,-1], y = USvoteS$vote3,
             method = modelInfo,
             trControl = trainControl(method = "cv"))


On Mon, Jan 5, 2015 at 7:11 AM, Rodica Coderie via R-help
<r-help at r-project.org> wrote:
> Hello,
> Is there an option of cross validation for CHAID decision tree? An example of CHAID is below:
> library("CHAID")
> example("chaid", package = "CHAID")
> How can I use a 10 fold cross-validation for CHAID?
> I've read that caret package is to cross-validate on many times of models, but model CHAID is not in caret's built-in library.
> library(caret)
> model <- train(vote3 ~., data = USvoteS, method='CHAID', tuneLength=10,trControl=trainControl(method='cv', number=10, classProbs=TRUE, summaryFunction=twoClassSummary))
> Thanks,
> Rodica
> ______________________________________________
> 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.

More information about the R-help mailing list