plot.surv.delay: Plot method for 'surv.delay' objects

View source: R/plotsurvdelay.R

plot.surv.delayR Documentation

Plot method for surv.delay objects

Description

A plot of either the estimated survival functions or hazard functions is produced. If the "surv" type is selected, the survival functions for each treatment arm is produced. If the "hazard" type is selected, the hazard functions for each treatment arm is produced.

Usage

plot.surv.delay(x, ..., type="surv")

Arguments

x

An object of class surv.fit, usually returned by either the DelayedSurvFit or DelayedHazFit functions

type

The type of plot desired. Should be "surv" if the survival functions are desired and should be "hazard" if the hazard functions are desired.

...

other arguments that will be passed forward to the default plot method such as ylim or xlab

Value

A data.frame with the following variables

x

the values of the x coordinates used in the plot

y

the values of the y coordinates used in the plot

trt

an indicator of which treatment arm the (x,y) coordinate comes from

Author(s)

Nicholas Henderson

Examples

## Not run: 
n <- 400
cens.time <- 8
X1 <- rweibull(n, shape=2.3, scale=7)
X2 <- rweibull(n, shape=.8, scale=10)
Y1 <- pmin(X1, cens.time)
Y2 <- pmin(X2, cens.time)
e1 <- as.numeric(X1 < cens.time)
e2 <- as.numeric(X2 < cens.time)

times <- c(Y1, Y2)  ## follow-up times
events <- c(e1, e2) ## event indicators
trt <- rep(c(0,1), each=n)  ## treatment arm assignment

dfs.obj <- DelayedSurvFit(times, events, trt, max.times=50) 

## Plot fitted survival functions
plot(dfs.obj, xlab="Survival Prob.", ylab="Time", las=1)

## Plot fitted hazard functions
plot(dfs.obj, type="hazard", xlab="Hazard", ylab="Time", las=1)

## End(Not run)

nchenderson/DelayedSurvFit documentation built on Aug. 18, 2024, 11:49 a.m.