censor.time {survcomp}R Documentation

Function to artificially censor survival data

Description

The function censors the survival data at a specific point in time. This is is useful if you used datasets having different follow-up periods.

Usage

censor.time(surv.time, surv.event, time.cens = 0)

Arguments

surv.time vector of times to event occurrence
surv.event vector of indicators for event occurrence
time.cens point in time at which the survival data must be censored

Value

surv.time.cens vector of censored times to event occurrence
surv.event.cens vector of censored indicators for event occurrence

Author(s)

Benjamin Haibe-Kains

Examples

set.seed(12345)
stime <- rexp(30)
cens <- runif(30,0.5,2)
sevent <- as.numeric(stime <= cens)
stime <- pmin(stime, cens)
censor.time(surv.time=stime, surv.event=sevent, time.cens=1)

[Package survcomp version 1.0 Index]