nodesum: Summarize contrast tree

View source: R/contrast.R

nodesumR Documentation

Summarize contrast tree

Description

Summarize contrast tree

Show graphical terminal node summaries

Usage

nodesum(tree, x, y, z, w = rep(1, nrow(x)), doplot = FALSE)

nodeplots(
  tree,
  x,
  y,
  z,
  w = rep(1, nrow(x)),
  nodes = NULL,
  xlim = NULL,
  ylim = NULL,
  pts = "FALSE",
  span = 0.15
)

Arguments

tree

model object output from contrast() or prune()

x

training input predictor data matrix or data frame in same format as in contrast()

y

vector, or matrix containing training data input outcome values or censoring intervals for each observation in same format as in contrast()

z

vector containing values of a second contrasting quantity for each observation in same observation format as in contrast()

w

observation weights

doplot

a flag to display/not display plots of output quantities

nodes

selected tree terminal node identifiers. Default is all terminal nodes

xlim

x-axis limit

ylim

y-axis limit

pts

logical flag indicating whether to show y-values as circles/points (type = 'pp' only)

span

running median smoother span (type = 'diff' only)

Details

The graphical representations of terminal node contrasts depend on the tree type graphical representations of terminal node contrasts depending on tree type -type = 'dist' implies CDFs of y and z in each terminal node. (Only top nine nodes are shown). Note that y can be censored (see above) -type = 'diff' implies plot y versus z in each terminal node. (Only top nine nodes are shown). -type = 'class' implies barplot of misclassification risk (upper) amd total weight (lower) in each terminal node -type = 'prob' implies upper barplot contrasting empirical (blue) and predicted (red) p(y=1) in each terminal node. Lower barplot showing total weight in each terminal node.

  • type = 'quant' => upper barplot of fraction of y-values greater than or equal to corresponding z-values (quantile prediction) in each terminal node. Horizontal line reflects specified target quantile. Lower barplot showing total weight in each terminal node.

  • type = 'diffmean' or type = 'maxmean' implies upper barplot contrasting y-mean (blue) and z-mean (red) in each terminal node. Lower barplot showing total weight in each terminal node.

Value

a named list of four items:

  • nodes the tree terminal node identifiers

  • cri the terminal node criterion values (depends on contrast type see above)

  • wt sum of weights in each terminal node

  • avecri weighted criterion average over all terminal nodes

See Also

contrast()


conTree documentation built on Nov. 22, 2023, 5:08 p.m.