Learn R Programming

JM (version 0.5-0)

plot.survfitJM: Plot Method for survfitJM Objects

Description

Produces plots of conditional probabilities of survival.

Usage

## S3 method for class 'survfitJM':
plot(x, estimator = c("both", "mean", "median"), 
    which = NULL, fun = NULL, conf.int = FALSE, add.last.time.axis.tick = FALSE, 
    include.y = FALSE, main = NULL, xlab = NULL, ylab = NULL, lty = NULL, 
    col = NULL, lwd = NULL, pch = NULL, ask = NULL, legend = FALSE, ...)

Arguments

x
an object inheriting from class survfitJM.
estimator
character string specifying, whether to include in the plot the mean of the conditional probabilities of survival, the median or both. The mean and median are taken as estimates of these conditional probabilities over the M replications of the M
which
a numeric or character vector specifying for which subjects to produce the plot. If a character vector, then is should contain a subset of the values of the idVar variable of the newdata argument of
fun
a vectorized function defining a transformation of the survival curve. For example with fun=log the log-survival curve is drawn.
conf.int
logical; if TRUE, then a pointwise confidence interval is included in the plot.
add.last.time.axis.tick
logical; if TRUE, a tick is added in the x-axis for the last available time point for which a longitudinal measurement was available.
include.y
logical; if TRUE, two plots are produced per subject, i.e., the plot of conditional probabilities of survival and a scatterplot of his longitudinal measurements.
main
a character string specifying the title in the plot.
xlab
a character string specifying the x-axis label in the plot.
ylab
a character string specifying the y-axis label in the plot.
lty
what types of lines to use.
col
which colors to use.
lwd
the thickness of the lines.
pch
the type of points to use.
ask
logical; if TRUE, the user is asked before each plot, see par().
legend
logical; if TRUE, a legend is included in the plot.
...
extra graphical parameters passed to plot().

See Also

survfitJM

Examples

Run this code
# linear mixed model fit
fitLME <- lme(sqrt(CD4) ~ obstime + obstime:drug, 
    random = ~ 1 | patient, data = aids)
# cox model fit
fitCOX <- coxph(Surv(Time, death) ~ drug, data = aids.id, x = TRUE)

# joint model fit
fitJOINT <- jointModel(fitLME, fitCOX, 
    timeVar = "obstime", method = "weibull-PH-GH")

# sample of the patients who are still alive
ND <- aids[aids$patient == "141", ]
ss <- survfitJM(fitJOINT, newdata = ND, idVar = "patient", M = 50)
plot(ss)
plot(ss, include.y = TRUE, add.last.time.axis.tick = TRUE, legend = TRUE)

Run the code above in your browser using DataLab