convert_hazards_to_ex {gompertztrunc} | R Documentation |
Convert hazard ratios to life expectancy
Description
Convert hazard ratios to differences in remaining life expectancy at a given age (defaults to age 65)
Usage
convert_hazards_to_ex(
df,
age = 65,
upper_age = 120,
M = 80,
b = 0.075,
use_model_estimates = FALSE
)
Arguments
df |
Dataframe of results given by gompertz_mle() function |
age |
Age at which to calculate remaining life expectancy |
upper_age |
Maximal age to use in life table calculation |
M |
Gompertz parameter modal age at death |
b |
Gompertz mortality slope parameter |
use_model_estimates |
Use estimates of the Gompertz Parameters from the model, rather than defaults |
Value
A dataframe of hazards ratios and corresponding e(x) estimates and confidence intervals
Examples
#model hazards as function of birthplace using bunmd_demo data
demo_dataset <- dplyr::filter(bunmd_demo, bpl_string %in% c("Poland", "England")) %>%
dplyr::sample_frac(0.1)
#run gompertz_mle()
bpl <- gompertz_mle(formula = death_age ~ bpl_string, left_trunc = 1988,
right_trunc = 2005, data = demo_dataset)
#convert to difference in life expectancy
convert_hazards_to_ex(df = bpl$results, use_model_estimates = FALSE)
[Package gompertztrunc version 0.1.2 Index]