Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

stopTime

Stop the time of an event history object


Description

All event times are stopped at a given time point and corresponding events are censored

Usage

stopTime(object, stop.time)

Arguments

object

Event history object as obtained with Hist

stop.time

Time point at which to stop the event history object

Value

Stopped event history object where all times are censored at stop.time. All observations with times greater than stop.time are set to stop.time and the event status is set to attr(object,"cens.code"). A new column "stop.time" is equal to 1 for stopped observations and equal to 0 for the other observations.

Author(s)

Thomas A. Gerds <tag@biostat.ku.dk>

See Also

Hist

Examples

set.seed(29)
d <- SimSurv(10)
h <- with(d,Hist(time,status))
h
stopTime(h,8)
stopTime(h,5)

## works also with Surv objects
library(survival)
s <- with(d,Surv(time,status))
stopTime(s,5)

## competing risks
set.seed(29)
dr <- SimCompRisk(10)
hr <- with(dr,Hist(time,event))
hr
stopTime(hr,8)
stopTime(hr,5)

prodlim

Product-Limit Estimation for Censored Event History Analysis

v2019.11.13
GPL (>= 2)
Authors
Thomas A. Gerds
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.