Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Bayesian Panel Data Model: Analysis of HALE and Life Expectancy Gender Gaps (Extended Through 2021 with COVID-19)

Purpose

This report presents results from a Bayesian hierarchical panel model that analyzes gender gaps in Healthy Life Expectancy (HALE) and Life Expectancy using both temporal variation (2000-2021, including COVID-19 pandemic years) and cross-country variation simultaneously. Unlike the cross-sectional Elastic Net models, this panel approach leverages data from all country-year combinations, providing more statistical power and allowing us to assess whether predictors that matter cross-sectionally also matter within countries over time.

This extended analysis includes COVID-19 as a predictor, allowing us to examine how the pandemic affected gender gaps in life expectancy. The analysis extends through 2021 (the most recent year for which HALE and Life Expectancy data are available from WHO), including the first two years of the COVID-19 pandemic.

Key Questions Addressed:

Model Design

Data Structure

The panel dataset transforms from country-level (one row per country) to panel structure (one row per country-year):

Standardization Strategy

Predictors (Standardized - Full Z-Scores):

Targets (Centered Only, Do Not Scale):

Model Specification

Model Structure: Bayesian hierarchical model with country-level random intercepts and shared slopes.

Notation:

Model:

y*_{it} ~ N(α_i + X*_{it}β, σ)
α_i ~ N(0, σ_α)

Priors:

Why This Model?

  1. Answers the primary scientific question: Does alcohol matter because countries differ from each other, or because countries that reduce alcohol mortality see their gaps narrow? This model can answer both.

  2. Seamlessly extends the cross-sectional Elastic Net model: Provides posterior distributions for β instead of penalized point estimates, with natural interpretation as global “effect size” averaged over space and time, and shrinkage through hierarchical priors (like Bayesian ridge regression).

  3. Preserves counterfactual framework: Produces posterior predictive distributions for country-level counterfactuals, changes through time, and uncertainty bands for temporal counterfactuals.

  4. Computationally feasible: With ≈ 814 observations and 12 predictors, a hierarchical linear model runs efficiently in PyMC using the nutpie sampler.

  5. Uses both within-country and between-country variation: Unlike fixed-effects models that eliminate all between-country variation, this approach leverages both sources of information.

  6. Controls for time-invariant country-level factors: Random intercepts account for country-specific characteristics (culture, baseline health systems, risk environments) that don’t change over time.

  7. Includes COVID-19: By extending through 2021 and including COVID-19 as a predictor, we can assess how the pandemic affected gender gaps and whether the relationships between other predictors and gaps held during this period.

Model Implementation

Software and Methods

Data Preparation

The panel dataset includes:

Note on COVID-19 Predictor: COVID-19 death rates are included as a predictor to assess how the pandemic affected gender gaps. COVID-19 data is available for 2020-2021, with zeros for all years before 2020 (since COVID-19 did not exist). The gender gap in COVID-19 mortality (Gap_COVID = Male COVID-19 death rate - Female COVID-19 death rate) is standardized across all country-years (2000-2021), which means the pre-2020 zeros are included in the standardization. This is appropriate because we want to assess the effect of COVID-19 gender gaps relative to the full temporal range.

Results: HALE Gap Model

Model Specification:

Model Diagnostics

Convergence and Sampling Quality: The model converged successfully with R-hat = 1.0 for all parameters and adequate effective sample sizes (ESS > 2000 for all parameters).

Predictor Coefficients (Beta)

The following table shows the posterior distributions of predictor coefficients. Since predictors are standardized (z-scores), coefficients represent the effect of a 1-standard-deviation change in the predictor on the gender gap in HALE (in years).

Predictormeansdhdi_3%hdi_97%mcse_meanmcse_sdess_bulkess_tailr_hat
Gap_Alcohol0.1450.0340.0810.2110.0010.0013.9e+032.74e+031
Gap_Suicide0.4240.0410.3440.50.0010.0013.55e+032.55e+031
Gap_Homicide0.3840.0220.3410.423005.07e+032.83e+031
Gap_RoadTraffic0.4760.0250.4260.519003.68e+033.1e+031
Gap_Cardiovascular-0.2520.026-0.301-0.204003.08e+032.91e+031
Gap_Diabetes-0.1290.023-0.171-0.084004.28e+033.28e+031
Gap_Neoplasms0.3490.0540.2510.4540.0010.0012.56e+032.76e+031
Gap_ChronicRespiratory0.3010.0370.2280.3670.0010.0014.04e+033.02e+031
Gap_LiverDisease0.2090.030.1530.266003.94e+032.85e+031
Gap_UnintentionalInjury0.1520.0430.0690.2310.0010.0013.45e+032.64e+031
Gap_DrugDisorder0.0810.020.0430.117004.15e+032.66e+031
Gap_COVID0.0540.0090.0370.072004.49e+033.2e+031

Key Findings:

Strongest Positive Effects (larger gender gaps in predictor → larger HALE gap, i.e., women live longer):

  1. Gap_RoadTraffic (β = 0.476, 94% HDI: [0.426, 0.519]): The strongest predictor. Countries with larger male-female gaps in road traffic mortality have larger gender gaps in HALE. This is likely due to men driving more total miles (greater exposure) rather than risk-taking behavior, though both factors may contribute.

  2. Gap_Suicide (β = 0.424, 94% HDI: [0.344, 0.5]): The second strongest predictor. Gender gaps in suicide mortality are strongly associated with gender gaps in HALE, reflecting the substantial contribution of suicide to male mortality.

  3. Gap_Homicide (β = 0.384, 94% HDI: [0.341, 0.423]): Gender gaps in homicide mortality are strongly associated with HALE gaps, consistent with higher male homicide rates.

  4. Gap_Neoplasms (β = 0.349, 94% HDI: [0.251, 0.454]): Gender gaps in cancer mortality contribute to HALE gaps, though with more uncertainty than the top three predictors.

  5. Gap_ChronicRespiratory (β = 0.301, 94% HDI: [0.228, 0.367]): Gender gaps in chronic respiratory disease mortality are associated with HALE gaps.

Moderate Positive Effects:

Negative Effects (larger gender gaps in predictor → smaller HALE gap):

Interpretation:

Predictor Importance on the Original Scale

Standardized coefficients allow direct comparison of effect sizes, but they do not account for how much each predictor typically varies across countries and years. To capture both effect size and real-world variation, we compute an importance measure:

Importance = |β_standardized| × SD_original

This quantity is not a causal effect or a prediction. Instead, it reflects how much a predictor can contribute to explaining variation in gender gaps given the amount of variation that predictor exhibits in the data.

PredictorSD_originalBeta_standardizedImportance
Gap_Neoplasms38.30.349 [0.251, 0.454]13.35 [9.367, 17.177]
Gap_Cardiovascular36.4-0.252 [-0.301, -0.204]9.193 [7.426, 10.957]
Gap_Homicide13.70.384 [0.341, 0.423]5.249 [4.694, 5.816]
Gap_Suicide9.80.424 [0.344, 0.5]4.158 [3.397, 4.925]
Gap_ChronicRespiratory10.70.301 [0.228, 0.367]3.21 [2.449, 3.946]
Gap_RoadTraffic5.910.476 [0.426, 0.519]2.81 [2.538, 3.09]
Gap_UnintentionalInjury15.50.152 [0.069, 0.231]2.36 [1.086, 3.609]
Gap_LiverDisease9.80.209 [0.153, 0.266]2.043 [1.488, 2.6]
Gap_Alcohol6.190.145 [0.081, 0.211]0.895 [0.484, 1.296]
Gap_COVID10.80.054 [0.037, 0.072]0.587 [0.399, 0.778]
Gap_Diabetes3.45-0.129 [-0.171, -0.084]0.445 [0.298, 0.601]
Gap_DrugDisorder2.560.081 [0.043, 0.117]0.207 [0.111, 0.301]

Key Findings:

Interpretation:

Results: Life Expectancy Gap Model

Model Specification:

Model Diagnostics

Convergence and Sampling Quality: The model converged successfully with R-hat = 1.0 for all parameters and adequate effective sample sizes (ESS > 2000 for all parameters).

Predictor Coefficients (Beta)

Predictormeansdhdi_3%hdi_97%mcse_meanmcse_sdess_bulkess_tailr_hat
Gap_Alcohol0.1720.0380.1020.2430.0010.0013.8e+033.16e+031
Gap_Suicide0.4790.0490.3920.5720.0010.0013.51e+032.86e+031
Gap_Homicide0.4450.0260.3970.495004.31e+032.62e+031
Gap_RoadTraffic0.4370.0280.390.496003.7e+032.69e+031
Gap_Cardiovascular-0.1970.029-0.248-0.1370.00103.05e+032.98e+031
Gap_Diabetes-0.1310.027-0.18-0.081003.68e+033.22e+031
Gap_Neoplasms0.3620.0610.2540.480.0010.0012.41e+032.3e+031
Gap_ChronicRespiratory0.3660.0430.2870.4470.0010.0013.21e+032.48e+031
Gap_LiverDisease0.2450.0350.1830.3130.0010.0013.63e+032.65e+031
Gap_UnintentionalInjury0.1220.050.0330.2180.0010.0013.01e+032.59e+031
Gap_DrugDisorder0.0790.0230.0370.123004.74e+033.3e+031
Gap_COVID0.1050.0110.0850.125004.78e+032.98e+031

Key Findings: The pattern of coefficients for Life Expectancy is similar to HALE, with COVID-19 showing a small positive effect. The relative ordering of predictors is largely consistent between HALE and Life Expectancy models.

R² and Residual Analysis

To provide interpretable goodness-of-fit measures and enable direct comparison with the cross-sectional Elastic Net models, we compute R² (explained variance) and perform comprehensive residual analysis for both HALE and Life Expectancy gap models.

R² Summary

The Bayesian panel models achieve excellent fit, explaining nearly all variance in the gender gaps:

ModelR² (mean)R² (94% HDI lower)R² (94% HDI upper)MAE (years)Residual Std (years)
HALE Gap0.9830.9820.9830.1690.235
Life Expectancy Gap0.9780.9770.9790.1890.275

Key Findings:

Comparison with 2019 Model:

Interpretation:

Residual Analysis

Residual analysis provides diagnostic information about model fit and identifies potential issues:

Residual Statistics:

StatisticValue (years)
Mean-0.0002
Std0.235
Min-2.74
25%-0.132
Median-0.0069
75%0.134
Max0.835
MAE0.169

HALE Gap Model Residuals:

Key Finding: Large Residual in 2021

The residual analysis reveals a very large negative residual of -2.74 years for one observation. This is substantially larger than the typical residual range (most residuals are within ±0.7 years). Investigation of the influential observations table reveals that Israel (ISR) in 2021 has an extremely large negative residual and a very high Pareto k value (1.66, well above the 0.7 threshold), indicating that this observation is highly influential and problematic for the model.

Why Israel 2021 May Be an Outlier:

  1. COVID-19 impact: Israel experienced a significant COVID-19 wave in 2021, and the model may not fully capture the complex interactions between COVID-19 and other causes of death during this period.

  2. Data quality: The 2021 data for Israel may have measurement issues, reporting delays, or systematic biases related to the pandemic.

  3. Unique pandemic response: Israel’s specific pandemic response (e.g., early vaccination campaign, unique policy measures) may have created patterns in gender gaps that differ from other countries in ways not captured by the predictors.

  4. Model limitations: The model assumes stable relationships across all years, but the pandemic may have fundamentally altered some relationships in ways that the model cannot capture.

Recommendation for Further Investigation:

The large residual for Israel 2021 warrants further investigation:

Other Influential Observations:

The influential observations table shows several 2021 observations among the top 10 most influential:

The concentration of 2021 observations among the most influential suggests that the pandemic period introduced additional variation that is not fully captured by the model.

Residual Diagnostics:

Residuals vs. predicted values for HALE gap model (2000-2021). The large negative residual for Israel 2021 is visible as an outlier.

Figure 1:Residuals vs. predicted values for HALE gap model (2000-2021). The large negative residual for Israel 2021 is visible as an outlier.

Residuals vs. year for HALE gap model (2000-2021). The 2021 residuals show increased variance, with Israel 2021 as a clear outlier.

Figure 2:Residuals vs. year for HALE gap model (2000-2021). The 2021 residuals show increased variance, with Israel 2021 as a clear outlier.

Key Observations:

Comparison with 2019 Model

Coefficient Stability

Comparing the 2021 model (with COVID-19) to the 2019 model (pre-COVID) reveals that most coefficients are remarkably stable:

Predictor2019 Model (β)2021 Model (β)Change
Gap_RoadTraffic0.4640.476+0.012
Gap_Suicide0.4220.424+0.002
Gap_Homicide0.3740.384+0.010
Gap_Neoplasms0.3720.349-0.023
Gap_ChronicRespiratory0.3360.301-0.035
Gap_LiverDisease0.2330.209-0.024
Gap_Alcohol0.1580.145-0.013
Gap_UnintentionalInjury0.1490.152+0.003
Gap_Cardiovascular-0.247-0.252-0.005
Gap_Diabetes-0.108-0.129-0.021
Gap_DrugDisorder0.0810.0810.000

Key Findings:

Model Performance Comparison

Metric2019 Model2021 ModelChange
HALE R²0.9870.983-0.004
HALE MAE0.1580.169+0.011
HALE Residual SD0.2040.235+0.031
LE R²0.9850.978-0.007
LE MAE0.1750.189+0.014
LE Residual SD0.2280.275+0.047

Key Findings:

Counterfactual Analysis: United States

This section presents counterfactual analysis for the United States using 2021 as the reference year (the latest available year in the dataset). For each gap predictor, we compute what would happen to the predicted gap if we adjusted that predictor to zero (complete gender equality) while keeping all other predictors constant.

Counterfactual Effects for All Indicators

The following tables show counterfactual effects for all indicators for the United States in 2021:

HALE Gap Counterfactuals:

Life Expectancy Gap Counterfactuals:

Counterfactual Visualizations

The following figures show counterfactual effects visualized in different ways:

HALE Gap:

Life Expectancy Gap:

Positive-Contributing Factors Over Time

The following analysis shows how positive-contributing factors (gap-closing indicators) contribute to reducing the gender gap over time for the United States. Each factor’s contribution is computed as the reduction in the gap that would occur if that factor were set to zero (complete gender equality), with all other factors held constant.

Key Features:

HALE Gap - Positive Contributions Over Time:

Life Expectancy Gap - Positive Contributions Over Time:

The stacked area charts show that multiple factors contribute to reducing the gender gap, with contributions varying over time. The predicted and actual totals demonstrate how well the model captures the overall gap and how the sum of individual factor contributions relates to the total gap.

The percentage plots show what proportion of the actual gap is accounted for by the positive-contributing (gap-closing) factors. If the percentage is less than 100%, the remaining gap is due to gap-widening factors, the country-specific intercept, the global mean, and any residual variation. This helps quantify how much of the observed gap could potentially be addressed by eliminating gender differences in the positive-contributing factors.

Conclusions

Key Findings

  1. COVID-19 has a small but positive effect on gender gaps: The coefficient for Gap_COVID (β = 0.054) indicates that countries with larger male-female gaps in COVID-19 mortality tend to have larger gender gaps in HALE and Life Expectancy. This is consistent with the observation that men experienced higher COVID-19 mortality than women in most countries.

  2. Relationships remain stable during pandemic: The coefficients for other predictors are largely unchanged when including pandemic years, suggesting that the relationships between predictors and gender gaps held during the pandemic period.

  3. Model fit remains excellent: Despite the additional variation introduced by the pandemic, the model still explains >97% of variance in gender gaps.

  4. 2021 shows increased residual variance: The pandemic period introduced additional unexplained variation, with Israel 2021 showing an extremely large residual that warrants further investigation.

Limitations and Future Work

  1. Israel 2021 outlier: The large residual for Israel 2021 suggests that either:

    • The data for Israel in 2021 has quality issues

    • Israel’s pandemic experience was unique in ways not captured by the model

    • The model needs modification to better capture pandemic effects

  2. Limited COVID-19 data: COVID-19 only has 2 years of data (2020-2021), limiting our ability to assess its long-term effects on gender gaps.

  3. Pandemic interactions: The model does not explicitly model interactions between COVID-19 and other causes of death, which may be important during the pandemic period.

  4. Temporal stability assumption: The model assumes stable relationships across all years, but the pandemic may have fundamentally altered some relationships.

Recommendations

  1. Investigate Israel 2021: The large residual for Israel 2021 should be investigated to determine whether it reflects data quality issues, unique country characteristics, or model limitations.

  2. Consider excluding problematic observations: If Israel 2021 is found to have data quality issues, consider excluding it from the analysis or using robust methods that downweight influential observations.

  3. Monitor future data: As more post-pandemic data becomes available, reassess the model to see if relationships return to pre-pandemic patterns or if the pandemic created lasting changes.

  4. Consider pandemic-specific models: Future work could develop models that explicitly account for pandemic effects, such as interactions between COVID-19 and other causes or time-varying coefficients during the pandemic period.


Source: Institute for Health Metrics and Evaluation. Used with permission. All rights reserved.