Learn R Programming

radiant.model (version 0.8.0)

crtree: Classification and regression trees

Description

Classification and regression trees

Usage

crtree(dataset, rvar, evar, type = "", lev = "", wts = "None",
  cp = 0.001, nodes = NA, K = 10, seed = 1234, split = "gini",
  prior = NA, cost = NA, margin = NA, check = "", data_filter = "")

Arguments

dataset

Dataset name (string). This can be a dataframe in the global environment or an element in an r_data list from Radiant

rvar

The response variable in the model

evar

Explanatory variables in the model

type

Model type (i.e., "classification" or "regression")

lev

The level in the response variable defined as _success_

wts

Weights to use in estimation

cp

Minimum proportion of root node deviance required for split (default = 0.00001)

nodes

Maxiumum size of tree in number of nodes to return. If equal to NA no pruning is done

K

Number of folds use in cross-validation

seed

Random seed used for cross-validation

split

Splitting criterium to use (i.e., "gini" or "information")

prior

Adjust the initial probabily for the selected level (e.g., set to .5 in unbalanced samples)

cost

Cost for each connection (e.g., email or mailing)

margin

Margin on each customer purchase

check

Optional estimation parameters ("standardize" is the default)

data_filter

Expression entered in, e.g., Data > View to filter the dataset in Radiant. The expression should be a string (e.g., "price > 10000")

Value

A list with all variables defined in crtree as an object of class tree

Details

See https://radiant-rstats.github.io/docs/model/crtree.html for an example in Radiant

See Also

summary.crtree to summarize results

plot.crtree to plot results

predict.crtree for prediction

Examples

Run this code
# NOT RUN {
result <- crtree("titanic", "survived", c("pclass","sex"), lev = "Yes")
result <- crtree("titanic", "survived", c("pclass","sex"))
result <- crtree("diamonds", "price", c("carat","clarity"), type = "regression")

# }

Run the code above in your browser using DataLab