Learn R Programming

STAND (version 2.0)

icplot: Plots Survival Functions

Description

This function takes a vector of survival values and a vector of time values and either plots a survival function or adds the survival lines to an existing plot.

Usage

icplot(surv, time = as.numeric(names(surv)), xrange = NA, lines.only = FALSE, XLAB = "Time", YLAB = "Probability", LTY = 1, ...)

Arguments

surv
a vector of survival values.
time
a vector of times. These are related to the vector of survival by $Prob(X > time[i]) = surv[i]$. If this vector is not given then the default is to use as.numeric(names(surv)).
xrange
the range of the x values. The default is c(0,max(time[time. This value may need to be supplied when plotting more than one survival curve on a single plot (see lines.only).
lines.only
a logical value; default = FALSE. If lines.only = FALSE the function draws a new set of axes. If lines.only = TRUE the function adds lines to an existing plot. To print 2 lines on one plot, call the function twice, the first time with lines.only = FALSE and xrange = range(c(t1,t2)) where t1 and t2 are the (finite) times for the two survival curves, the second time with lines.only = TRUE.
XLAB
a character string denoting the x label. Default = "Time".
YLAB
a character string denoting the y label. Default = "Probability".
LTY
an integer denoting the line type (lty value).
...
additional plotting parameters (except xlab and ylab).

Value

Returns a plot or adds a line to an existing plot.

Details

See icplot details. This may not be the most accurate way to present the data. See Betensky, Lindsey, Ryan, and Wand (1999, p. 238) for an alternative method.

References

Betensky, R. A., Lindsey, J. C., Ryan, L. M., and Wand, M. P. (1999), "Local EM Estimation of the Hazard Function for Interval-Censored Data," Biometrics, 55: 238-245.

See Also

icfit, ictest

Examples

Run this code
# Plot two Survival curves on one plot.
#  need data set for this example
#   s1<- icfit(left[treatment==1],right[treatment==1])
#   s2<- icfit(left[treatment==2],right[treatment==2])
#   icplot(s1$surv,s1$time,xrange=range(c(s1$time,s2$time)))
#   icplot(s2$surv,s2$time,lines.only=TRUE,LTY=2)

Run the code above in your browser using DataLab