gen_surv_times: Generate survival times

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/gen_surv_times.R

Description

Generate survival times according to hazard rate h(t) \exp(μ) with h(t) the hazard rate associated with the specified inverse cumulative hazard rate invchaz and μ the specified true hazard ratio mu. See Bender et al. (2005).

Usage

1
gen_surv_times(invchaz, mu = log(1), data, coxphmod = NULL)

Arguments

invchaz

the inverse cumulative (baseline) hazard rate to be used for generating survival times. Must take vector inputs!

mu

the true hazard ratio used to generate survival times.

data

an integer number of survival times to generate or (in combination with coxphmod): a data.frame containing subject covariates in named columns.

coxphmod

(optional) a cox proportional hazards regression model as produced by the function coxph(). Standard practice:
coxph(Surv(survtime, censorid) ~ covariates, data = data).
Alternatively, a list with:

  • $formula (~ covariates)

  • $coefficients (named vector specifying risk adjustment coefficients for covariates - names must be the same as in $formula and colnames of data).

Details

Sometimes it is desirable to generate survival times from an increased hazard rate

h(t, μ) = h_0(t) exp(μ)

with h_0 the baseline hazard rate. We call exp(μ) the true hazard ratio.

Value

A vector of survival times from subject entry time.

Author(s)

Daniel Gomon

References

Bender, R., Augustin, T., & Blettner, M. (2005). Generating survival times to simulate Cox proportional hazards models. Statistics in medicine, 24(11), 1713-1723. doi: 10.1002/sim.2059

See Also

Other utils: calc_risk(), exp_hazards, gen_arriv_times(), runlength()

Examples

1
gen_surv_times(invchaz = function(t) inv_chaz_exp(t, lambda = 0.01), data = 5)

cgrcusum documentation built on Nov. 22, 2021, 9:09 a.m.