Flash Sale | 50% off

Last chance! 50% off unlimited learning

Sale ends in


goldilocks (version 0.4.0)

pwe_impute: Impute piecewise exponential time-to-event outcomes

Description

Imputation of time-to-event outcomes using the piecewise constant hazard exponential function conditional on observed exposure.

Usage

pwe_impute(time, hazard, cutpoints = 0, maxtime = NULL)

Value

A data frame with simulated follow-up times (time) and respective event indicator (event, 1 = event occurred, 0 = censoring).

Arguments

time

vector. The observed time for patient that have had no event or passed maxtime.

hazard

vector. The constant hazard rates for exponential failures.

cutpoints

vector. The change-point vector indicating time when the hazard rates change. Note the first element of cutpoints should always be 0.

maxtime

scalar. Maximum time before end of study.

Details

If a subject is event-free at time s<t, then the conditional probability FTs|(ts)=P[TT>s]=(F(t)F(s))/(1F(s)), where F() is the cumulative distribution function of the piecewise exponential (PWE) distribution. Equivalently, F(t)=1S(t), where S(t) is the survival function. If UUnif(0,1), then we can generate an event time (conditional on being event free up until s) as F1(U(1F(s))+F(s)). Note: if s=0, then this is the equivalent of a direct (unconditional) sample from the PWE distribution.

Examples

Run this code
pwe_impute(time = c(3, 4, 5), hazard = c(0.002, 0.01), cutpoints = c(0, 12))
pwe_impute(time = c(3, 4, 5), hazard = c(0.002, 0.01), cutpoints = c(0, 12),
           maxtime = 36)
pwe_impute(time = 19.621870008, hazard = c(2.585924e-02, 3.685254e-09),
           cutpoints = c(0, 12), maxtime = 36)

Run the code above in your browser using DataLab