EXAMPLES: Add multidimensional optimal growth model demo notebook from Santos (1999) Section 7.3#63
EXAMPLES: Add multidimensional optimal growth model demo notebook from Santos (1999) Section 7.3#63mnshkw wants to merge 34 commits intoQuantEcon:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new example notebook implementing the multidimensional-state stochastic growth model with leisure from Santos (1999, Handbook of Macroeconomics), Section 7.3. The notebook demonstrates the use of ContinuousDPs.jl with an analytical benchmark solution for validation and includes comprehensive accuracy checks.
Changes:
- Adds
examples/cdp_ex_santos1999_s73_jl.ipynbimplementing Santos (1999) Section 7.3 stochastic growth model with leisure - Updates README.md to include link to the new notebook in the "Demo Notebooks" list
- Implements both VFI and PFI algorithms with multiple basis types (Chebyshev, Spline, Linear)
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| examples/cdp_ex_santos1999_s73_jl.ipynb | New example notebook with 2D state space model, analytical benchmark (delta=1 case), shock discretization via Gauss-Hermite quadrature, and comparisons using multiple interpolation methods |
| README.md | Adds link to new Santos (1999) Section 7.3 example notebook |
…tions with the cdp multidim test
…with style guides
…notebook file name
| "cell_type": "code", | ||
| "execution_count": 127, | ||
| "id": "05ba8b70", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "# Import libraries\n", | ||
| "using BasisMatrices\n", | ||
| "using ContinuousDPs\n", | ||
| "using PythonPlot\n", | ||
| "using QuantEcon\n", | ||
| "using Random\n", | ||
| "\n", | ||
| "const plt = PythonPlot.pyplot;" | ||
| ] |
There was a problem hiding this comment.
This notebook’s code cells have execution counts starting at 127, which suggests it was saved from a non-fresh kernel. For readability and cleaner future diffs, re-run from a fresh kernel so execution counts start at 1 (or clear all execution counts consistently across the notebook).
| "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n", | ||
| " </g>\n", | ||
| " <g id=\"patch_18\">\n", | ||
| " <path d=\"M 718.394583 72.384 \n", | ||
| "L 1015.58125 72.384 \n", | ||
| "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n", | ||
| " </g>\n", | ||
| " <g id=\"text_44\">\n", | ||
| " <!-- log z = 0.32 -->\n", | ||
| " <g transform=\"translate(830.583854 66.384) scale(0.12 -0.12)\">\n", | ||
| " <use xlink:href=\"#DejaVuSans-6c\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(27.783203 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-67\" transform=\"translate(88.964844 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-20\" transform=\"translate(152.441406 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-7a\" transform=\"translate(184.228516 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-20\" transform=\"translate(236.71875 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-3d\" transform=\"translate(268.505859 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-20\" transform=\"translate(352.294922 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(384.082031 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(447.705078 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-33\" transform=\"translate(479.492188 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(543.115234 0)\"/>\n", | ||
| " </g>\n", | ||
| " </g>\n", | ||
| " <g id=\"legend_3\">\n", | ||
| " <g id=\"patch_19\">\n", | ||
| " <path d=\"M 812.414063 109.74025 \n", | ||
| "L 1008.58125 109.74025 \n", | ||
| "Q 1010.58125 109.74025 1010.58125 107.74025 \n", | ||
| "L 1010.58125 79.384 \n", | ||
| "Q 1010.58125 77.384 1008.58125 77.384 \n", | ||
| "L 812.414063 77.384 \n", | ||
| "Q 810.414063 77.384 810.414063 79.384 \n", | ||
| "L 810.414063 107.74025 \n", | ||
| "Q 810.414063 109.74025 812.414063 109.74025 \n", | ||
| "z\n", | ||
| "\" style=\"fill: #ffffff; opacity: 0.8; stroke: #cccccc; stroke-linejoin: miter\"/>\n", | ||
| " </g>\n", | ||
| " <g id=\"line2d_77\">\n", | ||
| " <path d=\"M 814.414063 85.482438 \n", | ||
| "L 824.414063 85.482438 \n", | ||
| "L 834.414063 85.482438 \n", | ||
| "\" style=\"fill: none; stroke: #1f77b4; stroke-width: 2; stroke-linecap: square\"/>\n", | ||
| " </g>\n", | ||
| " <g id=\"text_45\">\n", | ||
| " <!-- numerical solution (Linear × PFI) -->\n", | ||
| " <g transform=\"translate(842.414063 88.982438) scale(0.1 -0.1)\">\n", | ||
| " <use xlink:href=\"#DejaVuSans-6e\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-75\" transform=\"translate(63.378906 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-6d\" transform=\"translate(126.757812 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(224.169922 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-72\" transform=\"translate(285.693359 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-69\" transform=\"translate(326.806641 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-63\" transform=\"translate(354.589844 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(409.570312 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(470.849609 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-20\" transform=\"translate(498.632812 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-73\" transform=\"translate(530.419922 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(582.519531 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(643.701172 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-75\" transform=\"translate(671.484375 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-74\" transform=\"translate(734.863281 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-69\" transform=\"translate(774.072266 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(801.855469 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-6e\" transform=\"translate(863.037109 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-20\" transform=\"translate(926.416016 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-28\" transform=\"translate(958.203125 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-4c\" transform=\"translate(997.216797 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-69\" transform=\"translate(1052.929688 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-6e\" transform=\"translate(1080.712891 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(1144.091797 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(1205.615234 0)\"/>\n", | ||
| " <use xlink:href=\"#DejaVuSa |
There was a problem hiding this comment.
The benchmark/comparison summary cell (it ends with summary_rows) is unexecuted (execution_count is null) and has no captured output, so the notebook currently won’t display the summary results described in the PR. Please execute this cell (and any dependent cells) and save outputs, or alternatively clear outputs throughout and adjust the text to not claim a displayed summary.
Summary
This PR adds a new example notebook implementing the multidimensional-state stochastic growth model with leisure from Santos (1999, Handbook of Macroeconomics), Section 7.3, solved using
ContinuousDPs.jl.The notebook is aligned with
test/test_cdp_multidim.jl:delta = 1case(43, 3)baseline discretization for the main exampleThe README “Demo Notebooks” list is updated to include a link to the new notebook as well.
Motivation
Santos (1999) Sec. 7.3 provides a benchmark for continuous-state DP with:
This PR intends to provide a useful example for
ContinuousDPs.jl.References
Notes for Reviewers