plot.SurvCART: Plot an SurvCART or LongCART Object

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/SurvCART_30May2021.R

Description

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

Usage

1
2
3
4
5
6
## 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.

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.(2020). Survival trees based on score based parameter instability test.

See Also

text, SurvCART, LongCART

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#--- 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)

LongCART documentation built on May 31, 2021, 9:09 a.m.