dtree: Main function for creating different types of decision trees

Description Usage Arguments Examples

Description

Main function for creating different types of decision trees

Usage

1
2
3
dtree(formula, data, methods = c("lm", "rpart", "tree", "ctree", "evtree"),
  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. 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)

Example output

sh: 1: cannot create /dev/null: Permission denied
Loading required package: rpart
Loading required package: party
Loading required package: grid
Loading required package: mvtnorm
Loading required package: modeltools
Loading required package: stats4
Loading required package: strucchange
Loading required package: zoo

Attaching package:zooThe following objects are masked frompackage:base:

    as.Date, as.Date.numeric

Loading required package: sandwich
Loading required package: evtree
Loading required package: partykit
Loading required package: libcoin

Attaching package:partykitThe following objects are masked frompackage:party:

    cforest, ctree, ctree_control, edge_simple, mob, mob_control,
    node_barplot, node_bivplot, node_boxplot, node_inner, node_surv,
    node_terminal, varimp

Loading required package: caret
Loading required package: lattice
Loading required package: ggplot2
sh: 1: cannot create /dev/null: Permission denied

dtree documentation built on May 1, 2019, 9:19 p.m.

Related to dtree in dtree...