censor.time: Function to artificially censor survival data

Description Usage Arguments Value Author(s) Examples

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

1
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

1
2
3
4
5
6
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)

bhklab/survcomp documentation built on Dec. 26, 2021, 6:41 a.m.