Models you can open and change¶
Twenty-two notebooks that build consumption and saving models one assumption at a time, from a two-period problem to a life cycle with uninsurable risk.
Start here¶
These four make a reading path for anyone new. The theory comes first, then a two-period problem solved by hand, then that same model in code, then income risk.
Keynes, Friedman, Modigliani
Three consumption theories the rest of the library descends from, before any code.
The Fisher two-period problem
Consumption over two periods, solved by hand, so you can see what the solver later does for you.
Perfect foresight in HARK
Your first model in code, still deterministic. An agent, a solver, a consumption function.
Buffer stock saving
Income risk enters and the consumption function stops being a straight line.
Life cycle and the data¶
Income and spending over a working life, set beside what households are measured doing.
Shocks, credit and constraints¶
Income a household cannot insure, and limits on what it can borrow against.
MPC out of credit against income
Loosening a credit limit and handing over cash are not the same stimulus.
Tightening a liquidity constraint
What happens to the consumption function when borrowing gets harder.
The persistent shock model
What a household expects its income to be, when shocks do not wash out.
The tractable buffer stock model
Labor income risk in a model simple enough to move by hand, parameters exposed.
Nondurables in the Great Recession
Whether the model accounts for the spending drop of 2008.
China’s saving rate
Whether precautionary motives explain saving through a period of fast growth.
Aggregates, prices and data¶
Many households added up, prices coming back out, and the aggregate series beside them.
Calibration and estimation¶
Which parameter values the evidence pins down.
Impatient households, micro and macro
What one cstwMPC parameter does to a household, and to the wealth distribution.
Alternative parameters in cstwMPC
The same model under combinations of parameter values that each fit the data.
Structural estimates from empirical MPCs
Turning a reduced-form MPC estimate into structural parameters.
Method and speed¶
For readers who came for the algorithms.
The DCEGM upper envelope
Solving a discrete choice by endogenous gridpoints, with the kinks that leaves.
Harmenberg aggregation
A change of measure that needs a hundredth as many agents for the same precision.
Approximating CRRA
How close the approximate consumption function gets before it parts from the exact one.
Running them¶
A Launch kernel control sits on the right above the first cell of each notebook. It connects the page to a session on Binder, and from then on you can run and edit the cells in place. Binder builds that session on request, which takes a few minutes the first time. The rocket icon in the row of links above the title opens the notebook somewhere else instead, in an external interface away from this site.
To work offline, or to keep your changes, clone the repository and run JupyterLab locally. The README has the steps for uv, conda and Docker, and the environment each notebook runs in.