CART: Fit and graph a cart model

Description Usage Arguments Value Examples

View source: R/CART.R

Description

Classification And Regression Tree is a simple technique to fit a relationship between numerical variables partitioning the target variable by a range of values of the explanatory variables. This function fits and graphs a cart model with a previous separation of training a testing datasets.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
CART(
  formula,
  data,
  p = 0.7,
  nodes_min = 2,
  nodes_max = 18,
  includedata = FALSE,
  seed = NULL,
  ...
)

Arguments

formula

a formula of the form y ~ x1 + x2 + ...

data

the data frame that contains the variables specified in formula.

p

the percentage of the training dataset to be obtained randomly.

nodes_min

Number of minimum nodes.

nodes_max

Number of maximum nodes.

includedata

logicals. If TRUE the training and testing datasets are returned.

seed

a single value, interpreted as an integer, or NULL. The default value is NULL, but for future checks of the model or models generated it is advisable to set a random seed to be able to reproduce it.

...

further arguments passed to or from other methods.

Value

A MLA object of subclass CART

Examples

1
2
3
4
5
6
## Load a Dataset
 ## Not run: 
data(EGATUR)
CART(GastoTotalD~pais+aloja+motivo,data=EGATUR)

## End(Not run)

MachineLearning documentation built on March 13, 2020, 2:54 a.m.