tlo.analysis.life_expectancy module
Read in the output files generated by analysis_scenarios generate life tables to estimate life expectancy for each run/draw produce summary statistics
- calculate_probability_of_dying(interval_width, fraction_of_last_age_survived, sex, _person_years_at_risk, _number_of_deaths_in_interval) DataFrame
Returns the probability of dying in each interval
- get_life_expectancy_estimates(results_folder: Path, target_period: Tuple[date, date], summary: bool = True) DataFrame
produces sets of life expectancy estimates for each draw/run calls: *1 _num_deaths_by_age_group *2 _aggregate_person_years_by_age
Args: - results_folder (PosixPath): The path to the results folder containing log, tlo.methods.demography - target period (tuple of dates): declare the date range (inclusively) in which life expectancy is to be estimated - summary (bool): declare whether to return a summarized value (mean with 95% uncertainty intervals)
or return the estimate for each draw/run
Returns: - pd.DataFrame: The DataFrame with the life expectancy estimates (in years)
for every draw/run in the results folder; or, with option summary=True summarized (central, lower, upper estimates) for each draw.
example use: test = produce_life_expectancy_estimates(results_folder, median=True,
target_period=(Date(2019, 1, 1), Date(2020, 1, 1)))
- get_probability_of_premature_death(results_folder: Path, target_period: Tuple[date, date], summary: bool = True, age_before_which_death_is_defined_as_premature: int = 70) DataFrame
Produces sets of probability of premature death for each draw/run.
Args: - results_folder (PosixPath): The path to the results folder containing log, tlo.methods.demography - target period (tuple of dates): Declare the date range (inclusively) in which the probability is to be estimated. - summary (bool): Declare whether to return a summarized value (mean with 95% uncertainty intervals)
or return the estimate for each draw/run.
age_before_which_death_is_defined_as_premature (int): proposed in defined in Norheim et al.(2015) to be 70 years
Returns: - pd.DataFrame: The DataFrame with the probability estimates for every draw/run in the results folder;
or, with option summary=True, summarized (central, lower, upper estimates) for each draw.