plot {LongCART} | R Documentation |
Plot an SurvCART or LongCART Object
Description
Plots an SurvCART or LongCART object on the current graphics device.
Usage
## 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 |
uniform |
similar to |
branch |
similar to |
compress |
similar to |
nspace |
similar to |
margin |
similar to |
minbranch |
similar to |
... |
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.
Value
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
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)