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.

Examples

Examples are organized around models, not isolated API calls. Each walkthrough states the economic question, the pylcm representation, the solver, and the scale of the computation. Model definitions live in lcm_examples so the documented code is importable and testable.

Choose by feature

ExampleEconomic featurepylcm featureSolver
Tiny consumption-savingWork, consume, retireBasic regimes and deterministic transitionsGrid search
MortalityDeath risk and borrowingStochastic regime transitionGrid search / DCEGM variants
Epstein–Zin lifecycleHealth and mortality riskNonlinear certainty equivalentGrid search
Iskhakov et al. (2017)Retirement and discrete laborDiscrete-continuous upper envelopeDCEGM
Precautionary savingsIncome riskIID and AR(1) processesGrid search
Precautionary savings with healthJoint wealth, health, and exerciseMultiple states/actions and constraintsGrid search
Mahler and Yum (2024)Quantitative lifecycle health modelLarge state space and empirical inputsSpecialized EGM family; GPU recommended
Collective regimesShared choice, participation, dissolutionStakeholder values, projected same-period values, value-dependent transitionsGrid search

The tiny example is a pedagogical baseline, not the starting declaration for every model. If your production model needs an EGM-family solver, use the specialized regime and margin declarations from the beginning. See Choose your starting declaration.

Beyond the curated examples

The LCM Zoo contains additional model implementations. The LCM solver benchmarks track evolving performance and accuracy evidence. These are external destinations: pylcm’s book links to them instead of copying models or benchmark tables that would quickly become stale.

Reusing an example

Models export builders or regime declarations that can be imported and modified. Prefer a builder argument or Regime.replace(...) over copying a complete source file. After changing economic structure, revisit Choosing a solver; a change in the budget or continuous-choice topology may require a different declaration rather than only different parameter values.