Kaplan-Meier plots of (repeated) time-to-event data. Includes VPCs.
Usage
kaplan.plot(
x = "TIME",
y = "DV",
id = "ID",
data = NULL,
evid = "EVID",
by = NULL,
xlab = "Time",
ylab = "Default",
object = NULL,
events.to.plot = "All",
sim.data = NULL,
sim.zip.file = NULL,
VPC = FALSE,
nsim.lab = "simNumber",
sim.evct.lab = "counter",
probs = c(0.025, 0.975),
add.baseline = T,
add.last.area = T,
subset = NULL,
main = "Default",
main.sub = "Default",
main.sub.cex = 0.8,
nbins = NULL,
real.type = "l",
real.lty = 1,
real.lwd = 1,
real.col = "blue",
real.se = if (!is.null(sim.data)) F else T,
real.se.type = "l",
real.se.lty = 2,
real.se.lwd = 0.5,
real.se.col = "red",
cens.type = "l",
cens.lty = 1,
cens.col = "black",
cens.lwd = 1,
cens.rll = 0.02,
inclZeroWRES = TRUE,
onlyfirst = FALSE,
samp = NULL,
poly.alpha = 1,
poly.fill = "lightgreen",
poly.line.col = "darkgreen",
poly.lty = 2,
censor.lines = TRUE,
ylim = c(-5, 105),
cov = NULL,
cov.fun = "mean",
...
)Arguments
- x
The independent variable.
- y
The dependent variable. event (>0) or no event (0).
- id
The ID variable in the dataset.
- data
A dataset can be used instead of the data in an Xpose object. Must have the same form as an xpose data object
xpdb@Data.- evid
The EVID data item. If not present then all rows are considered events (can be censored or an event). Otherwise, EVID!=0 are dropped from the data set.
- by
A vector of conditioning variables.
- xlab
X-axis label
- ylab
Y-axis label
- object
An Xpose object. Needed if no
datais supplied.- events.to.plot
Vector of events to be plotted. "All" means that all events are plotted.
- sim.data
The simulated data file. Should be a table file with one header row and have, at least, columns with headers corresponding to
x,y,id,by(if used),nsim.labandsim.evct.lab.- sim.zip.file
The
sim.datacan be in \.zip format and xpose will unzip the file before reading in the data. Must have the same structure as described above insim.data.- VPC
TRUEorFALSE. IfTRUEthen Xpose will search for a zipped file with namepaste("simtab",object@Runno,".zip",sep=""), for example "simtab42.zip".- nsim.lab
The column header for
sim.datathat contains the simulation number for that row in the data.- sim.evct.lab
The column header for
sim.datathat contains the individual event counter information. For each individual the event counter should increase by one for each event (or censored event) that occurs.- probs
The probabilities (non-parametric percentiles) to use in computation of the prediction intervals for the simulated data.
- add.baseline
Should a (x=0,y=1) baseline measurement be added to each individual in the dataset. Otherwise each plot will begin at the first event in the dataset.
- add.last.area
Should an area be added to the VPC extending the last PI?
- subset
The subset of the data and sim.data to use.
- main
The title of the plot. Can also be
NULLor"Default".- main.sub
The title of the subplots. Must be a list, the same length as the number of subplots (actual graphs), or
NULLor"Default".- main.sub.cex
The size of the title of the subplots.
- nbins
The number of bins to use in the VPC. If
NULL, the the number of uniquexvalues insim.datais used.- real.type
Type for the real data.
- real.lty
Line type (lty) for the curve of the original (or real) data.
- real.lwd
Line width (lwd) for the real data.
- real.col
Color for the curve of the original (or real) data.
- real.se
Should the standard errors of the real (non simulated) data be plotted? Calculated using
survfit.- real.se.type
Type for the standard errors.
- real.se.lty
Line type (lty) for the standard error lines.
- real.se.lwd
Line width (lwd) for the standard error lines.
- real.se.col
Color for the standard error lines.
- cens.type
Type for the censored lines.
- cens.lty
Line type (lty) for the censored lines.
- cens.col
Color for the censored lines.
- cens.lwd
Line width for the censored lines.
- cens.rll
The relative line length of the censored line compared to the limits of the y-axis.
- inclZeroWRES
Include WRES=0 rows from the real data set in the plots?
- onlyfirst
Include only the first measurement for the real data in the plots?
- samp
Simulated data in the xpose data object can be used as the "real" data.
sampis a number selecting which simulated data set to use.- poly.alpha
The transparency of the VPC shaded region.
- poly.fill
The fill color of the VPC shaded region.
- poly.line.col
The line colors for the VPC region.
- poly.lty
The line type for the VPC region.
- censor.lines
Should censored observations be marked on the plot?
- ylim
Limits for the y-axes
- cov
The covariate in the dataset to plot instead of the survival curve.
- cov.fun
The summary function for the covariate in the dataset to plot instead of the survival curve.
- ...
Additional arguments passed to the function.
See also
survfit, Surv,
xpose.multiple.plot.
Other specific functions:
absval.cwres.vs.cov.bw(),
absval.cwres.vs.pred(),
absval.cwres.vs.pred.by.cov(),
absval.iwres.cwres.vs.ipred.pred(),
absval.iwres.vs.cov.bw(),
absval.iwres.vs.idv(),
absval.iwres.vs.ipred(),
absval.iwres.vs.ipred.by.cov(),
absval.iwres.vs.pred(),
absval.wres.vs.cov.bw(),
absval.wres.vs.idv(),
absval.wres.vs.pred(),
absval.wres.vs.pred.by.cov(),
absval_delta_vs_cov_model_comp,
addit.gof(),
autocorr.cwres(),
autocorr.iwres(),
autocorr.wres(),
basic.gof(),
basic.model.comp(),
cat.dv.vs.idv.sb(),
cat.pc(),
cov.splom(),
cwres.dist.hist(),
cwres.dist.qq(),
cwres.vs.cov(),
cwres.vs.idv(),
cwres.vs.idv.bw(),
cwres.vs.pred(),
cwres.vs.pred.bw(),
cwres.wres.vs.idv(),
cwres.wres.vs.pred(),
dOFV.vs.cov(),
dOFV.vs.id(),
dOFV1.vs.dOFV2(),
data.checkout(),
dv.preds.vs.idv(),
dv.vs.idv(),
dv.vs.ipred(),
dv.vs.ipred.by.cov(),
dv.vs.ipred.by.idv(),
dv.vs.pred(),
dv.vs.pred.by.cov(),
dv.vs.pred.by.idv(),
dv.vs.pred.ipred(),
gof(),
ind.plots(),
ind.plots.cwres.hist(),
ind.plots.cwres.qq(),
ipred.vs.idv(),
iwres.dist.hist(),
iwres.dist.qq(),
iwres.vs.idv(),
par_cov_hist,
par_cov_qq,
parm.vs.cov(),
parm.vs.parm(),
pred.vs.idv(),
ranpar.vs.cov(),
runsum(),
wres.dist.hist(),
wres.dist.qq(),
wres.vs.idv(),
wres.vs.idv.bw(),
wres.vs.pred(),
wres.vs.pred.bw(),
xpose.VPC(),
xpose.VPC.both(),
xpose.VPC.categorical(),
xpose4-package
Examples
if (FALSE) { # \dontrun{
library(xpose4)
## Read in the data
runno <- "57"
xpdb <- xpose.data(runno)
####################################
# here are the real data plots
####################################
kaplan.plot(x="TIME",y="DV",object=xpdb)
kaplan.plot(x="TIME",y="DV",object=xpdb,
events.to.plot=c(1,2),
by=c("DOSE==0","DOSE!=0"))
kaplan.plot(x="TIME",y="DV",object=xpdb,
events.to.plot=c(1,2),
by=c("DOSE==0","DOSE==10",
"DOSE==50","DOSE==200"))
## make a PDF of the plots
pdf(file=paste("run",runno,"_kaplan.pdf",sep=""))
kaplan.plot(x="TIME",y="DV",object=xpdb,
by=c("DOSE==0","DOSE==10",
"DOSE==50","DOSE==200"))
dev.off()
####################################
## VPC plots
####################################
kaplan.plot(x="TIME",y="DV",object=xpdb,VPC=T,events.to.plot=c(1))
kaplan.plot(x="TIME",y="DV",object=xpdb,VPC=T,
events.to.plot=c(1,2,3),
by=c("DOSE==0","DOSE!=0"))
kaplan.plot(x="TIME",y="DV",object=xpdb,VPC=T,
events.to.plot=c(1),
by=c("DOSE==0","DOSE==10","DOSE==50","DOSE==200"))
## make a PDF of all plots
pdf(file=paste("run",runno,"_kaplan.pdf",sep=""))
kaplan.plot(x="TIME",y="DV",object=xpdb,VPC=T,
by=c("DOSE==0","DOSE==10","DOSE==50","DOSE==200"))
dev.off()
} # }