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.

Precautionary Savings

A two-regime consumption-savings model with income shocks (alive + dead). Supports IID shocks (Normal Gauss-Hermite) and persistent AR(1) shocks (Rouwenhorst, Tauchen). Configurable interest rate and wealth grid type.

With FGP-calibrated parameters, this replicates the simplified benchmark of Fella et al. (2019).

View source on GitHub

Usage

import jax.numpy as jnp
from lcm_examples.precautionary_savings import get_model, get_params

model = get_model(n_periods=7, shock_type="rouwenhorst")
params = get_params(shock_type="rouwenhorst", sigma=0.1, rho=0.95)

result = model.solve_and_simulate(
    params=params,
    initial_conditions={
        "age": jnp.full(100, model.ages.values[0]),
        "wealth": jnp.linspace(1, 10, 100),
        "income": jnp.zeros(100),
        "regime_id": jnp.full(100, model.regime_names_to_ids["alive"]),
    },
)

df = result.to_dataframe(additional_targets="all")
References
  1. Fella, G., Gallipoli, G., & Pan, J. (2019). Markov-Chain Approximations for Life-Cycle Models. Review of Economic Dynamics, 34, 183–201. 10.1016/j.red.2019.03.013