Other-cause mortality (OC)

Other cause death package.

class miscore.processes.OC(age=None, life_table=None, life_table_male=None, life_table_female=None, start_age=0.0, end_age=None, end_year=None, name='oc')[source]

This process models the death from other causes. If separate life tables are given for males and females, a ‘sex’ property should be defined. This property can for example be defined using the built-in Sex process.

Parameters:
  • age (SupportsFloat | None) – If this parameter is given, every individual dies from other causes at this age.

  • life_table (Sequence[Tuple[SupportsFloat, SupportsFloat]] | Series | None) – The life table to draw random death ages from.

  • life_table_male (Sequence[Tuple[SupportsFloat, SupportsFloat]] | Series | None) – The life table to draw random death ages from for male individuals in the population.

  • life_table_female (Sequence[Tuple[SupportsFloat, SupportsFloat]] | Series | None) – The life table to draw random death ages from for female individuals in the population.

  • start_age (float) – The age at which the life table(s) should start (i.e. the first age at which an individual can possibly die from other causes). The bottom part of each life table will be removed and the probabilities will be adjusted as described in https://en.wikipedia.org/wiki/Truncated_distribution. Defaults to 0.

  • end_age (float | None) – The age at which the life table(s) should end (i.e. the last age at which an individual can possibly die from other causes). The top part of each life table will be removed, without adjusting any probabilities. Defaults to miscore.core.MAX_AGE.

  • end_year (float | None) – The year at which all remaining people alive will die from other causes. Very similar to end_age except now, it is determined by year rather than age.

  • name (str) – The name of the process. Defaults to ‘oc’.

Raises:

ValueError – An error is raised when not enough parameters are fulfilled. The process should be initialized with an ‘age’, a ‘life_table’, or a ‘life_table_male’ and a ‘life_table_female’.

miscore.processes.oc.rate_to_life_table(rate_tables, return_rates=False)[source]

Take a sequence of mortality rates and convert them to a cumulative life table, as used in the miscore.processes.OC process. Optionally, a dictionary of specific mortality rates can also be given to be subtracted from the all-cause mortality rates.

Parameters:
  • rate_tables (List[Sequence[Tuple[SupportsFloat, SupportsFloat]] | Series]) – A list of all-cause mortality rates (first entry), and optionally, specific cause mortalities that need to be subtracted from the all-cause mortality. If no other argument is given, this is converted to a list of tuples denoting the cumulative number of persons who have died from any cause. If any years 0-100 are missing from ‘rate_tables’ we assume that the rate from year x also applies to year x + 1 until a new datapoint is given. If no entry is given for year 0, the rate is assumed to be 0.

  • return_rates (bool) – Boolean specifying the option to only subtract the specific rates from the all_cause rates, skipping the calculation of cumulative survival. Defaults to False.

Return type:

Sequence[Tuple[SupportsFloat, SupportsFloat]] | Series

Returns:

Returns the cumulative life table.

Raises:

ValueError – Raised if rate_tables contains non-integer years.

miscore.processes.oc.data.get_cohort_table(country, interval=1, cohorts=None, sex=None, cohort_table=False, rate=False, specific_rate_tables=None)[source]

Read the cohort life tables included in the MISCore package, and returns dictionaries of sex- and cohort-specific life tables. Cohort life tables are available for the US and the Netherlands, and for 1-, 5- and 10-year birth cohorts.

Parameters:
  • country (str) – Country for which to return birth cohort life tables, either “US” or “NL”.

  • interval (int) – Interval of birth cohorts, either 1, 5 or 10 years.

  • cohorts (List[int] | None) – List of desired birth cohorts e.g. [1960, 1970, 1980]. If no input is given, all available cohorts are returned.

  • sex (str | None) – Sex of desired birth cohort life tables, either ‘male’, ‘female’ or ‘total’, if no input is given a dictionary with all three outputs is returned.

  • cohort_table (bool) – Whether to return the cohort life table (True) or, the period life table (False) for the requested cohorts. Defaults to False.

  • rate (bool) – Whether to output mortality rate rather than cumulative mortality. Defaults to False.

  • specific_rate_tables (Dict[str, Dict[int, List[Sequence[Tuple[SupportsFloat, SupportsFloat]] | Series]]] | Dict[str, Dict[int, Sequence[Tuple[SupportsFloat, SupportsFloat]] | Series]] | List[Sequence[Tuple[SupportsFloat, SupportsFloat]] | Series] | Sequence[Tuple[SupportsFloat, SupportsFloat]] | Series | None) – Either a dictionary of sex- cohort- and cause-specific mortality rates to adjust the all-cause mortality rates, or a dictionary with generic mortality rates by cause to be used equally for each sex and cohort.

Return type:

Dict[str, Dict[str, Sequence[Tuple[SupportsFloat, SupportsFloat]] | Series]]

Returns:

A nested dictionary giving life tables that can be used as input for an OC process, specific to ‘sex’ (if not supplied) and ‘cohort’.

Raises:

ValueError – Raised when an invalid country, interval or sex is entered.