prune: Prunes an rcDT model

Description Usage Arguments Value

View source: R/prune.R

Description

The 'prune' function allows the user to specify a value of the penalty for a given tree. This function uses the "weakest link" criteria in order to evaluate the order in which branches are pruned and gives the penalized value along with the unpenalized value. If testing data are provided for validation, then the penalized and unpenalized values from the testing data run down the tree structure are also provided.

Usage

1
2
prune(tre, a, test = NULL, AIPWE = FALSE, n0 = 5, ctgs = NULL,
  risk.control = FALSE, risk.threshold = NA, lambda = lambda)

Arguments

tre

sets the tree to be pruned

a

sets the value of the splitting penalty

test

the testing data to be used. Defaults to NULL.

AIPWE

indicator for AIPWE estimation.

n0

minimum number of observations allowed in a treatment group. Defaults to 5.

ctgs

columns of categorical variables.

train

the training data used to create the tree

Value

summary of pruned branches and the associated value of the tree after pruning.

result

contains columns: 'node.rm' which is the weakest link at each iteration of the pruning algorithm; 'size.tree' and 'n.tmnl' give number of total nodes and terminal nodes in each subtree; 'alpha' is the weakest link scoring criteria; 'V' and 'V.test' are the overall value of the tree for the training and tesing samples; 'V.a' and 'Va.test' give the penalized value for the training and testing samples.

subtrees

list of optimally pruned subtrees of 'tre'


kdoub5ha/mvITR documentation built on April 7, 2020, 3:59 a.m.