Learn R Programming

MachineLearning (version 0.1.4)

CART: Fit and graph a cart model

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

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

Run this code
# NOT RUN {
## Load a Dataset
 
# }
# NOT RUN {
data(EGATUR)
CART(GastoTotalD~pais+aloja+motivo,data=EGATUR)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab