extract_hazard: Extract (inverse) cumulative baseline hazard from Cox PH...

View source: R/extract_hazard.R

extract_hazardR Documentation

Extract (inverse) cumulative baseline hazard from Cox PH model

Description

Extracts a function which returns the (inverse) cumulative baseline hazard from a coxph() call.

Usage

extract_hazard(coxphmod)

Arguments

coxphmod

A call to coxph().

Details

The baseline hazard is extracted from the coxph() call using the basehaz() function. The baseline hazard function is then smoothed using approxfun() to obtain the linear interpolant. If required, the inverse baseline hazard is determined using root linear interpolation. For this, a function written by Zheyuan Li (see references) is used.

Value

A list containing:

  • cbaseh: A function which returns the cumulative baseline hazard at specified time;

  • inv_cbaseh: A function which returns the inverse cumulative baseline hazard at specified time.

  • max_time: maximal time at which cbaseh is known;

  • max_haz: value of maximal hazard (at maximum time).

Author(s)

Daniel Gomon

References

Zheyuan Li: How to estimate x value from y value input after approxfun in R? (accessed: 09/10/2023)

See Also

coxph

Examples

require(survival)
exprfit <- as.formula("Surv(survtime, censorid) ~ age + sex + BMI")
tcoxmod <- coxph(exprfit, data= surgerydat)
tcox_hazard_fcts <- extract_hazard(tcoxmod)



success documentation built on June 22, 2024, 10:19 a.m.