calc_avg_mort: Average background mortality

View source: R/background_mortality.R

calc_avg_mortR Documentation

Average background mortality

Description

calc_avg_mort calculates the average background mortality for a cohort with initial age n_age_init in a trial with duration of trial_time years for either empirical hazard (e.g.. from life tables) or some continuous-time hazard functional forms.

Usage

calc_avg_mort(n_age_init = 50, trial_time = 5, mu0 = NULL,
  alpha = NULL, hazard = c("empirical", "exponential", "linear",
  "geometric"), mortality = NULL)

Arguments

n_age_init

initial age of the cohort in the trial

trial_time

length of the trial

mu0

age-independent mortality rate coefficient

alpha

age-dependent mortality rate coefficient

hazard

The hazard function to be used for background mortality. Either empirical (e.g., from life tables) or a continuous-time functional form.

mortality

A data.frame with two columns. The first column should have age in yearly increments and the second column should have the mortality rate corresponding to the age. If NULL, the function will use all_cause_mortality.

Value

The average background mortality

Examples

n_age_init <- 50   # Initial age of cohort in trial
trial_time <- 5    # Length of clinial trial in years
## Not run: 
   dshr_emp <- calc_avg_mort(n_age_init = n_age_init, 
   trial_time = trial_time, 
   hazard = "empirical")
   dshr_emp

## End(Not run)

feralaes/dshr documentation built on Aug. 28, 2023, 2:17 p.m.