Created by:
Richard Wilson
Birmingham and Solihull ICB
Authored the production code
David Ellis
Population Health Management
Birmingham City Council
Authored the LE and HLE functions
Life expectancy is a statistical measure of the average time someone is expected to live, based on the year of their birth, current age and other demographic factors including their sex. It is used to assess and set a number of important policies that impact on everyday life, for example, setting the State Pension age and targeting health policy initiatives. () Methodology The code is based on the ONS methodology and translated their Life expectancy estimates template into r. https://www.ons.gov.uk/peoplepopulationandcommunity/healthandsocialcare/healthandlifeexpectancies/datasets/lifeexpectancyestimatestemplate
and for Healthy Life Expectancy
This code is designed to create Life and Healthy Life Expectancies at ICB, LA, Locality and ward level, where data permits for:
- Sex
- IMD quintiles
- Ethnic groups
- Sex by ethnic group
- IMD quintile by ethnic group
- Sex by IMD quintile and ethnic group
The calculation requires populations structure by these age bands
- <1
- 01 to 04
- 05 to 09
- ...
- 85 to 89
- 90+
The code uses two downloads from https://www.ons.gov.uk/datasets/create to build out the populations at ward level. The higher geographies are built from aggregating ward populations. There is no data set available that provides the ethnic populations for under 1s and therefore an approximation of a fifth of the 0-4 age group is used. It is not recommended to use local births data fro this age group as our work has shown quite a mismatch between the counts.
The 90+ age group is calculated by differencing the 85+ population from this age grouping
and the 90+ from this age grouping
Off course the code can be adopted to work for any geography and any population grouping to fit your needs.
Just now the code reuses the Census population across every year as there are not ethnic populations by ward in the mid year estimates.
Be careful the ONS Census assigns 1 to Female and 2 to Male, which is the reverse of the NHS Data Dictionary where 1 is Male and 2 is Female. In our methodology, the ONS populations are changed to the NHS Data Dictionary codes
ONS death records do not have an ethnicity field. In our calculation we use a local master patient index based on the NHS Spine and Commissioning Data sets to derive a patient's ethnicity. This approach uses the modal ethnicity as the patient's ethnicity. The accuracy of this ethnicity will depend on the completeness of the ethnicity field in older data sets.
It is possible to use the code to do LSOA life expectancies and use the IMD at LSOA level. For wards, as used in our methodology, the IMD package is used as it calculates population weighted (using 2021 Census) IMD scores and national quintiles.
For the Healthy Life Expectancy calculation you need data on the health of the population. Here the
The production of Life Expectancies is in 4 parts, controlled by a vector [group_by_list]. This vector specifies the dimensions the life expectancy calculation is for.
There are a series of function calls that create the population for a specified geography, be it ICB, LA, locality or ward, called denom_BSol, denom_brum, denom_locality or denom_ward
There are a series of function calls that create the count of deaths for a specified geography, be it ICB, LA, locality or ward, called indicator_BSol, indicator_brum, indicator_locality or indicator_ward
The function create_input_date brings the numerators (count of deaths) and denominators together into one data frame, input_data. This sets up the data frame in the structure required for the life expectancy calculation. It fixes any remain in valid content.
The input_data data frame is passed to the function le_calculation. The le_calculation creates a loop_control data frame that sets the parameters for the looping through the calculations for the relevant dimensions and geography. The function also passes the results of the life expectancy calculations to the Healthy Life Expectancy calculation.
This is the longest part of the calculation and can take a considerable time to run through if you are calculating multiple dimensions and geographies.
The output from each section is bound together. A HLE output is produced by filtering the output to just those aged over 65. A plain english DemographicLabel is added. Then the output is written to a series of