dtree: Main function for creating different types of decision trees

Description Usage Arguments Examples

View source: R/dtree.R

Description

Main function for creating different types of decision trees

Usage

1
2
3
dtree(formula, data, methods = c("lm", "rpart", "tree", "ctree"),
  samp.method = "repeatedcv", tuneLength = 3, bump.rep = 50,
  subset = FALSE, perc.sub = 0.75, weights = NULL, verbose = TRUE)

Arguments

formula

a formula, with a response to left of ~.

data

Data frame to run models on

methods

Which tree methods to use. Defaults: lm, rpart, ctree, evtree. Also can use "rf" for random forests (cforest from party). Also a FDR pruning method for ctree termed "ctreePrune". Finally bumping is implemented as methods="bump".

samp.method

Sampling method. Refer to caret package trainControl() documentation. Default is repeated cross-validation. Other options include "cv" and "boot".

tuneLength

Number of tuning parameters to try. Applies to train(). Can also be specified as a vector, with order corresponding to the order specified in the methods argument.

bump.rep

Number of repetitions for bumping

subset

Whether to split dataset into training and test sets

perc.sub

What fraction of data to put into train dataset. 1-frac.sub is allocated to test dataset. Defaults to 0.75

weights

Optional weights for each case.

verbose

Whether to print what method on

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# continuous outcome
#library(MASS) # for boston data
#data(Boston)
#out <- dtree(medv ~., data=Boston,methods=c("lm","rpart","ctree"))
#summary(out)
# plot(out$rpart.out)

# categorical outcome
#library(ISLR)
#data(Default)

#out <- dtree(default ~ ., data=Default,methods=c("lm","rpart"))
#summary(out)

Rjacobucci/dtree documentation built on July 12, 2019, 8:56 p.m.