Skip to contents

Given a population file ('opop') generated by rsocsim, the function estimates (yearly) age-specific mortality rates.

Usage

estimate_mortality_rates(
  opop,
  final_sim_year,
  year_min,
  year_max,
  year_group,
  age_max_mort,
  age_group
)

Arguments

opop

An R object from SOCSIM microsimulation output (population file).

final_sim_year

numeric. Final simulated year in 'real world' time ( used to convert 'SOCSIM time' to 'real world' time.)

year_min

numeric. Lower-bound year for which rate should be estimated.

year_max

numeric. Upper-bound year for which rate should be estimated.

year_group

numeric. Size of year groups to estimate rate (year_group=1 will produce single-year estimates)

age_max_mort

numeric. Maximum age for estimating mortality.

age_group

numeric. Size of age groups to estimate rate (age_group=1 will produce single-age estimates)

Value

A data frame with columns year, sex, age, and socsim. year is a factor describing the grouped calendar-year interval, sex is "male" or "female", age is a factor describing the age interval, and socsim is the estimated mortality rate for that cell.

Details

The final_sim_year can be obtained from the .sup file and must refer to to a real-world year.

Grouped year and age ranges (i.e., if year_group > 1 or age_group > 1) are created as [year;year+year_group). For age_group > 1, mortality rates are split into an infant group [0,1) and then grouped ages [1, age_group), [age_group, age_group + age_group), and so on.

Examples

if (FALSE) { # \dontrun{
# Read opop file into global environment
opop <- read_opop(fn = "my_path")
# Retrieve age-specific mortality rates
asmr <- estimate_mortality_rates(opop = opop,
                     final_sim_year = 2021,
                     year_min = 1750,
                     year_max = 2020,
                     year_group = 5,
                     age_max_mort = 110,
                     age_group = 5)
} # }