plot function

Plot an SurvCART or LongCART Object

Plot an SurvCART or LongCART Object

Plots an SurvCART or LongCART object on the current graphics device.

## S3 method for class 'SurvCART' plot(x, uniform = FALSE, branch = 1, compress = FALSE, nspace = branch, margin = 0, minbranch = 0.3, ...) ## S3 method for class 'LongCART' plot(x, uniform = FALSE, branch = 1, compress = FALSE, nspace = branch, margin = 0, minbranch = 0.3, ...)

Arguments

  • x: a fitted object of class "SurvCART", containing a survival tree or "LongCART", containing a longitudinal tree.

  • uniform: similar to plot.rpart; if TRUE, uniform vertical spacing of the nodes is used; this may be less cluttered when fitting a large plot onto a page. The default is to use a non-uniform spacing proportional to the error in the fit.

  • branch: similar to plot.rpart; controls the shape of the branches from parent to child node. Any number from 0 to 1 is allowed. A value of 1 gives square shouldered branches, a value of 0 give V shaped branches, with other values being intermediate.

  • compress: similar to plot.rpart; if FALSE, the leaf nodes will be at the horizontal plot coordinates of 1:nleaves. If TRUE, the routine attempts a more compact arrangement of the tree.

  • nspace: similar to plot.rpart; the amount of extra space between a node with children and a leaf, as compared to the minimal space between leaves. Applies to compressed trees only. The default is the value of branch.

  • margin: similar to plot.rpart; an extra fraction of white space to leave around the borders of the tree. (Long labels sometimes get cut off by the default computation).

  • minbranch: similar to plot.rpart; set the minimum length for a branch to minbranch

    times the average branch length. This parameter is ignored if uniform=TRUE. Sometimes a split will give very little improvement, or even (in the classification case) no improvement at all. A tree with branch lengths strictly proportional to improvement leaves no room to squeeze in node labels.

  • ...: arguments to be passed to or from other methods.

Details

This function is a method for the generic function plot, for objects of class SurvCART. The y-coordinate of the top node of the tree will always be 1.

Returns

The coordinates of the nodes are returned as a list, with components x

and y.

Author(s)

Madan Gopal Kundu madan_g.kundu@yahoo.com

References

Kundu, M. G., and Harezlak, J. (2019). Regression trees for longitudinal data with baseline covariates. Biostatistics & Epidemiology, 3(1):1-22.

Kundu, M. G., and Ghosh, S. (2021). Survival trees based on heterogeneity in time-to-event and censoring distributions using parameter instability test. Statistical Analysis and Data Mining: The ASA Data Science Journal, 14(5), 466-483.

See Also

text, SurvCART, LongCART

Examples

#--- Get the data data(GBSG2) #numeric coding of character variables GBSG2$horTh1<- as.numeric(GBSG2$horTh) GBSG2$tgrade1<- as.numeric(GBSG2$tgrade) GBSG2$menostat1<- as.numeric(GBSG2$menostat) #Add subject id GBSG2$subjid<- 1:nrow(GBSG2) #--- Run SurvCART() out<- SurvCART(data=GBSG2, patid="subjid", censorvar="cens", timevar="time", event.ind=1, gvars=c('horTh1', 'age', 'menostat1', 'tsize', 'tgrade1', 'pnodes', 'progrec', 'estrec'), tgvars=c(0,1,0,1,0,1, 1,1), alpha=0.05, minsplit=80, minbucket=40, print=TRUE) #--- Plot tree par(xpd = TRUE) plot(out, compress = TRUE) text(out, use.n = TRUE)
  • Maintainer: Madan G Kundu
  • License: GPL (>= 2)
  • Last published: 2022-05-17