Full replication of the lifecycle model from Mahler & Yum (2024).
Two regimes (alive/dead), 8 states including health, education, productivity type, and health type. Three actions: labor supply, saving, and health effort. Features stochastic health and regime transitions, AR(1) productivity shocks, and discount-factor heterogeneity. Ships with calibrated data files for survival probabilities and initial distributions.
Usage¶
import jax.numpy as jnp
from lcm_examples.mahler_yum_2024 import (
MAHLER_YUM_MODEL,
START_PARAMS,
create_inputs,
)
# Build inputs (params, initial states, discount factor types)
start_params_without_beta = {k: v for k, v in START_PARAMS.items() if k != "beta"}
common_params, initial_states, discount_factor_types = create_inputs(
seed=7235,
n_simulation_subjects=1_000,
**start_params_without_beta,
)
beta_mean = START_PARAMS["beta"]["mean"]
beta_std = START_PARAMS["beta"]["std"]
# Select initial states with high discount factor type
selected_ids_high = jnp.flatnonzero(discount_factor_types)
initial_states_high = {
state: values[selected_ids_high] for state, values
in initial_states.items()
}
# Solve and simulate for high discount factor type
result = MAHLER_YUM_MODEL.solve_and_simulate(
params={
"alive": {
"discount_factor": beta_mean + beta_std,
**common_params,
},
},
initial_conditions={
**initial_states_high,
"regime_id": jnp.full(
selected_ids_high.shape[0],
MAHLER_YUM_MODEL.regime_names_to_ids["alive"],
),
},
seed=8295,
)- Mahler, L., & Yum, M. (2024). Lifestyle Behaviors and Wealth-Health Gaps in Germany. Econometrica, 92(5), 1307–1343. 10.3982/ECTA20603