cchaid: Chi-squared Automated Interaction Detection for continuous...

Description Usage Arguments Details Value References See Also Examples

View source: R/cchaid.R

Description

Fits a classification tree by the CHAID algorithm for continuous response variable

Usage

1
2
cchaid(formula, data, weights = NULL, minbucket = 100, minsplit = 200,
  alpha_split = 0.05, alpha_merge = 0.05, max_depth = 10)

Arguments

formula

an object of class formula (or one that can be coerced to that class): a symbolic description of the model to be fitted. Response variable should be continuous and all predictors should be categorical (either ordered or not).

weights

an optional vector of weights to be used in the fitting process. Should be NULL or a numeric vector.

minbucket

Minimum number of observations in terminal nodes.

minsplit

Number of observations in split response at which no further split is desired.

alpha_split

Level of significance used for splitting of a node in the most significant predictor

alpha_merge

Level of significance used for merging of predictor categories

max_depth

Maximum depths for the tree

Details

The CHAID algorithm is originally proposed by Kass (1980) which allow multiple splits of a node. The current implementation only accepts continuous response variable and categorical predictors (nominal or ordinal). If response variable is categorical, refer to chaid. CHAID consist of three steps: merging, splitting and stopping. A tree is grown by repeatedly using the three steps below on each node starting from the root node.

Value

An object of class constparty, see package party.

References

Kass, G. V. (1980). An exploratory technique for investigating large quantities of categorical data. Applied statistics, 119-127.
Hothorn T, Zeileis A (2015). partykit: A Modular Toolkit for Recursive Partytioning in R. Journal of Machine Learning Research, 16, 3905–3909.

See Also

chaid ctree glmtree

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library("cchaid")
require("partykit")

set.seed(100)
WorkDurationS <- WorkDuration[sample(1:nrow(WorkDuration), 1000),]
formula <- (Dur ~ Urb + Comp + Child + Day + pAge + SEC + Ncar + Gend +
            Driver + wstat + Pwstat + Xdag + Xn.dag + Xarb + Xpop + Ddag +
            Dn.dag + Darb + Dpop)
mytree <- cchaid(formula,data = WorkDurationS, weights = NULL, minbucket = 57,
                 minsplit = 114, alpha_split=0.05, alpha_merge=0.05,
                 max_depth = 8)
mytree
plot(mytree)

tpgjs66/cchaidR documentation built on Oct. 28, 2021, 7:31 p.m.