Learn R Programming

LongCART (version 3.1)

ProfilePlot.LongCART: Population level longitudinal profile plot for sub-groups

Description

Generates population level longitudinal profile plot for each of sub-groups (i.e., terminal nodes) associated with longitudinal tree generated by LongCART()

Usage

ProfilePlot.LongCART(x, timevar, timevar.power=NULL, covariate.val=NULL,
                xlab=NULL, ylab=NULL, sg.title=3, ...)

Arguments

x

a fitted object of class "LongCART", containing a longitudinal tree.

timevar

Speciy the variable name contining time informaiton in the dataset that was used to fit LongCART object

timevar.power

Mandatory when the fixed part of the fitted model contains term as time with power not equal to 1. For example, if fixed part of the model is t + sqrtt + cov1, then specify c(1, 0.5, NA. If fixed part of the model is t + t^2 + cov1, then specify c(1, 2, NA).

covariate.val

Specify the covariate values for generation of longitudinal profile plot. Iin the longitudinal profile plot, only time can vary and therefore, and therefore the value for the other covariates are fixed at constant value. This is not needed if the longitudinal model does not contain additional covariate(s). By default, the covariates values are specified at median value over all the datapoint (not at the subject level). For example, if the fixed part of the model is t + cov1, then c(NA, 100) sets the value of cov1 at 100. Similarly, If fixed part of the model is t + t^2 + cov1, then c(NA, NA, 100) would be acceptable.

xlab

Optional label for X-axis

ylab

Optional label for Y-axis

sg.title

1 for sub-groups' title as Sub-group=x, 2 for sub-groups' title as Node=x, and 3 for sub-groups' title as Sub-group=x (Node=x).

...

Graphical parameters other than x, y, type, xlab, ylab.

References

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

See Also

text.LongCART, plot.LongCART, LongCART

Examples

Run this code
# NOT RUN {
#--- Get the data
data(ACTG175)

#-----------------------------------------------#
#   model: cd4~ time + subject(random)          #
#-----------------------------------------------#

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


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

#--- Plot longitudinal profiles of subgroups
par(mfrow=c(3,3))
ProfilePlot.LongCART(x=out1, timevar="time")

#-----------------------------------------------#
#   model: cd4~ time+ time^2 + subject(random)  #
#-----------------------------------------------#

ACTG175$time2<- ACTG175$time^2

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

par(mfrow=c(3,3))
ProfilePlot.LongCART(x=out2, timevar="time", timevar.power=c(1,2))


#--------------------------------------------------------#
#   model: cd4~ time+ time^2 + subject(random) + karnof  #
#--------------------------------------------------------#

out3<- LongCART(data=ACTG175, patid="pidnum", fixed=cd4~time + time2 + karnof,
                gvars=gvars, tgvars=tgvars, alpha=0.05,
                minsplit=100, minbucket=50, coef.digits=2)

#the value of the covariate karnof is set at median by default
par(mfrow=c(3,3))
ProfilePlot.LongCART(x=out3, timevar="time", timevar.power=c(1,2, NA))

#the value of the covariate karnof is set at 120
par(mfrow=c(3,3))
ProfilePlot.LongCART(x=out3, timevar="time", timevar.power=c(1,2, NA), 
                    covariate.val=c(NA, NA, 120))

# }

Run the code above in your browser using DataLab