plotLongCART {LongCART}R Documentation

Plot an LongCART Object

Description

Plots an LongCART object on the current graphics device.

Usage

plotLongCART(x, uniform = FALSE, branch = 1, nspace,
     margin = 0, minbranch = 0.3, ...)

Arguments

x

a fitted object of class "LongCART", containing a linear mixed effects 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.

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 LongCART. 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.

See Also

textLongCART, LongCART, StabCat, StabCont

Examples

#--- Get the data
data(ACTG175)
                
#--- Run LongCART()
gvars=c("age", "gender", "wtkg", "hemo", "homo", "drugs", 
        "karnof", "oprior", "z30", "zprior", "race",
        "str2", "symptom", "treat", "offtrt")
tgvars=c(1, 0, 1, 0, 0, 0,
         1, 0, 0, 0, 0,
         0, 0, 0, 0)


out<- LongCART(data=ACTG175, patid="pidnum", fixed=cd4~time, 
               gvars=gvars, tgvars=tgvars, alpha=0.05, 
               minsplit=100, minbucket=50, coef.digits=2)
               
#--- Plot tree

par(xpd = T)
plot(out, compress = T)
text(out, use.n = T)

[Package LongCART version 1.0 Index]