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

get_life_expectancy_estimates(results_folder: Path, target_period: Tuple[date, date], summary: bool = True) DataFrame[source]

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)))