A two-regime consumption-savings model with health and exercise. The agent chooses whether to work, how much to consume, and how much to exercise. Two continuous states (wealth, health) evolve over time. At retirement age the agent enters a terminal regime where utility depends only on remaining wealth and health.
This model demonstrates multiple continuous states, multiple continuous actions, auxiliary functions (wage, labor income), constraints, and regime transitions.
Usage¶
import jax.numpy as jnp
from lcm_examples.precautionary_savings_health import get_model, get_params
model = get_model()
params = get_params()
result = model.solve_and_simulate(
params=params,
initial_conditions={
"age": jnp.full(1_000, model.ages.values[0]),
"wealth": jnp.full(1_000, 1.0),
"health": jnp.full(1_000, 1.0),
"regime_id": jnp.full(1_000, model.regime_names_to_ids["working_life"]),
},
)
df = result.to_dataframe(additional_targets="all")See Also¶
A Tiny Example — simpler three-period model
Writing Economics — function DAGs and regime design
Grids — grid types and transitions
Parameters — constructing the params dict