Skip to content

EXAMPLES: Add multidimensional optimal growth model demo notebook from Santos (1999) Section 7.3#63

Open
mnshkw wants to merge 34 commits intoQuantEcon:mainfrom
mnshkw:examples/santos1999-s73-notebook
Open

EXAMPLES: Add multidimensional optimal growth model demo notebook from Santos (1999) Section 7.3#63
mnshkw wants to merge 34 commits intoQuantEcon:mainfrom
mnshkw:examples/santos1999-s73-notebook

Conversation

@mnshkw
Copy link
Collaborator

@mnshkw mnshkw commented Feb 16, 2026

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:

  • parameters and state domains
  • analytical benchmark for the delta = 1 case
  • (43, 3) baseline discretization for the main example
  • benchmark check summary across multiple combinations of methods and interpolations

The 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:

  • 2 dimensional state (capital k, productivity log z)
  • 1 dimensional continuous control (leisure l)
  • analytical solution for the special case (delta=1)

This PR intends to provide a useful example for ContinuousDPs.jl.

References

  • Santos, M. S. (1999). "Numerical solution of dynamic economic models." In Handbook of Macroeconomics, Volume 1, Chapter 5, pp. 311-386. Elsevier.
    • Specific reference: Section 7.3 (stochastic growth with leisure)
  • All codes and documentation are written with assistance by LLMs

Notes for Reviewers

  • I will check if the README link works after submitting this PR.

mnshkw added 23 commits February 6, 2026 19:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ipynb implementing 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

@mnshkw mnshkw changed the title EXAMPLES: Add Santos (1999) Section 7.3 stochastic growth example notebook with analytical benchmark solution EXAMPLES: Add multidimensional optimal growth model demo notebook from Santos (1999) Section 7.3 Mar 27, 2026
@oyamad oyamad requested a review from Copilot March 27, 2026 02:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.

Comment on lines +62 to +76
"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;"
]
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Comment on lines +8948 to +9020
"\" 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
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants