Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f370ed3
use ifp as a test case'
mmcky Dec 14, 2020
34a93d3
update lecture files to new syntax for executable code from file
mmcky Jan 6, 2021
b276d58
install myst_nb from the branch
mmcky Jan 6, 2021
d6dd3b5
remove debug cell at the top of lecture
mmcky Jan 6, 2021
4393f14
Merge branch 'main' into fix-codefromfile
mmcky Jan 6, 2021
78d7c46
install mysb_nb from branch for testing
mmcky Jan 6, 2021
e65ab10
add mathjax cdn address
mmcky Jan 7, 2021
02f9731
Merge branch 'main' into fix-codefromfile
mmcky Jan 8, 2021
7ff060a
Merge branch 'main' into fix-codefromfile
mmcky Jan 13, 2021
f2d6399
update sources lecture-python (9ae923d) using tomyst (b06cacb)
mmcky Feb 8, 2021
afcdca6
fix for newline bug in wald_friedman
mmcky Feb 8, 2021
7aa9274
Merge branch 'main' into fix-codefromfile
mmcky Feb 9, 2021
59dfc2a
update config for latest sphinxcontrib-bibtex (#84)
mmcky Feb 9, 2021
29242f6
Merge branch 'main' into fix-codefromfile
mmcky Feb 9, 2021
b17fc8a
update environment for testing from branch mystnb:code-from-file
mmcky Feb 9, 2021
c1f924d
upload build folder as an artifact
mmcky Feb 10, 2021
3f529c8
fix path
mmcky Feb 10, 2021
9a791ca
update timeout for exection to 10min
mmcky Feb 10, 2021
77cb915
Merge branch 'main' into fix-codefromfile
mmcky Feb 11, 2021
8a8665f
Merge branch 'main' into fix-codefromfile
mmcky Feb 15, 2021
bbb5d46
Merge branch 'main' into fix-codefromfile
mmcky Feb 15, 2021
c837383
migrate from :file: to :load: (myst-nb)
mmcky Feb 18, 2021
60023d9
remove install of myst_nb from branch and include latest jupyter-book…
mmcky Feb 24, 2021
7583a9b
Merge branch 'main' into fix-codefromfile
mmcky Feb 24, 2021
b634bc3
Merge branch 'main' into fix-codefromfile
mmcky Mar 2, 2021
986a726
Merge branch 'main' into fix-codefromfile
mmcky Mar 4, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
shell: bash -l {0}
run: |
jb build lectures --path-output ./
- name: Save Build as Artifact
uses: actions/upload-artifact@v1
with:
name: _build
path: _build
- name: Preview Deploy to Netlify
uses: nwtgck/actions-netlify@v1.1
with:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
lectures/_build
_build/
lectures/_build/
6 changes: 5 additions & 1 deletion lectures/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ description: This website presents a set of lectures on quantitative economic mo

execute:
execute_notebooks: "cache"
timeout: 60
timeout: 600

bibtex_bibfiles:
- _static/quant-econ.bib

bibtex_bibfiles:
- _static/quant-econ.bib
Expand Down Expand Up @@ -50,6 +53,7 @@ sphinx:
og_logo_url: https://assets.quantecon.org/img/qe-og-logo.png
description: This website presents a set of lectures on quantitative economic modeling, designed and written by Thomas J. Sargent and John Stachurski.
keywords: Python, QuantEcon, Quantitative Economics, Economics, Sloan, Alfred P. Sloan Foundation, Tom J. Sargent, John Stachurski
mathjax_path: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
rediraffe_redirects:
index_toc.md: intro.md
tojupyter_static_file_path: ["source/_static", "_static"]
Expand Down
3 changes: 2 additions & 1 deletion lectures/cake_eating_numerical.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ where $u$ is the CRRA utility function.
The analytical solutions for the value function and optimal policy were found
to be as follows.

```{literalinclude} _static/lecture_specific/cake_eating_numerical/analytical.py
```{code-cell} python3
:load: _static/lecture_specific/cake_eating_numerical/analytical.py
```

Our first aim is to obtain these analytical solutions numerically.
Expand Down
12 changes: 8 additions & 4 deletions lectures/coleman_policy_iter.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ As in our {doc}`previous study <optgrowth_fast>`, we continue to assume that

This will allow us to compare our results to the analytical solutions

```{literalinclude} _static/lecture_specific/optgrowth/cd_analytical.py
```{code-cell} python3
:load: _static/lecture_specific/optgrowth/cd_analytical.py
```

As discussed above, our plan is to solve the model using time iteration, which
Expand All @@ -278,7 +279,8 @@ For this we need access to the functions $u'$ and $f, f'$.
These are available in a class called `OptimalGrowthModel` that we
constructed in an {doc}`earlier lecture <optgrowth_fast>`.

```{literalinclude} _static/lecture_specific/optgrowth_fast/ogm.py
```{code-cell} python3
:load: _static/lecture_specific/optgrowth_fast/ogm.py
```

Now we implement a method called `euler_diff`, which returns
Expand Down Expand Up @@ -374,7 +376,8 @@ Here is a function called `solve_model_time_iter` that takes an instance of
`OptimalGrowthModel` and returns an approximation to the optimal policy,
using time iteration.

```{literalinclude} _static/lecture_specific/coleman_policy_iter/solve_time_iter.py
```{code-cell} python3
:load: _static/lecture_specific/coleman_policy_iter/solve_time_iter.py
```

Let's call it:
Expand Down Expand Up @@ -439,7 +442,8 @@ Compute and plot the optimal policy.

We use the class `OptimalGrowthModel_CRRA` from our {doc}`VFI lecture <optgrowth_fast>`.

```{literalinclude} _static/lecture_specific/optgrowth_fast/ogm_crra.py
```{code-cell} python3
:load: _static/lecture_specific/optgrowth_fast/ogm_crra.py
```

Let's create an instance:
Expand Down
9 changes: 6 additions & 3 deletions lectures/egm_policy_iter.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,14 @@ where

This will allow us to make comparisons with the analytical solutions

```{literalinclude} _static/lecture_specific/optgrowth/cd_analytical.py
```{code-cell} python3
:load: _static/lecture_specific/optgrowth/cd_analytical.py
```

We reuse the `OptimalGrowthModel` class

```{literalinclude} _static/lecture_specific/optgrowth_fast/ogm.py
```{code-cell} python3
:load: _static/lecture_specific/optgrowth_fast/ogm.py
```

### The Operator
Expand Down Expand Up @@ -216,7 +218,8 @@ grid = og.grid

Here's our solver routine:

```{literalinclude} _static/lecture_specific/coleman_policy_iter/solve_time_iter.py
```{code-cell} python3
:load: _static/lecture_specific/coleman_policy_iter/solve_time_iter.py
```

Let's call it:
Expand Down
6 changes: 4 additions & 2 deletions lectures/ifp.md
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,8 @@ start to iterate.
The following function iterates to convergence and returns the approximate
optimal policy.

```{literalinclude} _static/lecture_specific/coleman_policy_iter/solve_time_iter.py
```{code-cell} python3
:load: _static/lecture_specific/coleman_policy_iter/solve_time_iter.py
```

Let's carry this out using the default parameters of the `IFP` class:
Expand Down Expand Up @@ -518,7 +519,8 @@ In this case, our income fluctuation problem is just a cake eating problem.
We know that, in this case, the value function and optimal consumption policy
are given by

```{literalinclude} _static/lecture_specific/cake_eating_numerical/analytical.py
```{code-cell} python3
:load: _static/lecture_specific/cake_eating_numerical/analytical.py
```

Let's see if we match up:
Expand Down
3 changes: 2 additions & 1 deletion lectures/markov_perf.md
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,8 @@ Consider the previously presented duopoly model with parameter values of:

From these, we compute the infinite horizon MPE using the preceding code

```{literalinclude} _static/lecture_specific/markov_perf/duopoly_mpe.py
```{code-cell} python3
:load: _static/lecture_specific/markov_perf/duopoly_mpe.py
```

Running the code produces the following output.
Expand Down
6 changes: 4 additions & 2 deletions lectures/optgrowth.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,8 @@ whether our code works for this particular case.

In Python, the functions above can be expressed as:

```{literalinclude} _static/lecture_specific/optgrowth/cd_analytical.py
```{code-cell} python3
:load: _static/lecture_specific/optgrowth/cd_analytical.py
```

Next let's create an instance of the model with the above primitives and assign it to the variable `og`.
Expand Down Expand Up @@ -700,7 +701,8 @@ We are clearly getting closer.
We can write a function that iterates until the difference is below a particular
tolerance level.

```{literalinclude} _static/lecture_specific/optgrowth/solve_model.py
```{code-cell} python3
:load: _static/lecture_specific/optgrowth/solve_model.py
```

Let's use this function to compute an approximate solution at the defaults.
Expand Down
12 changes: 8 additions & 4 deletions lectures/optgrowth_fast.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ In particular, the algorithm is unchanged, and the only difference is in the imp

As before, we will be able to compare with the true solutions

```{literalinclude} _static/lecture_specific/optgrowth/cd_analytical.py
```{code-cell} python3
:load: _static/lecture_specific/optgrowth/cd_analytical.py
```

## Computation
Expand All @@ -125,7 +126,8 @@ class.

This is where we sacrifice flexibility in order to gain more speed.

```{literalinclude} _static/lecture_specific/optgrowth_fast/ogm.py
```{code-cell} python3
:load: _static/lecture_specific/optgrowth_fast/ogm.py
```

The class includes some methods such as `u_prime` that we do not need now
Expand Down Expand Up @@ -186,7 +188,8 @@ def T(v, og):

We use the `solve_model` function to perform iteration until convergence.

```{literalinclude} _static/lecture_specific/optgrowth/solve_model.py
```{code-cell} python3
:load: _static/lecture_specific/optgrowth/solve_model.py
```

Let's compute the approximate solution at the default parameters.
Expand Down Expand Up @@ -317,7 +320,8 @@ value function iteration, the JIT-compiled code is usually an order of magnitude

Here's our CRRA version of `OptimalGrowthModel`:

```{literalinclude} _static/lecture_specific/optgrowth_fast/ogm_crra.py
```{code-cell} python3
:load: _static/lecture_specific/optgrowth_fast/ogm_crra.py
```

Let's create an instance:
Expand Down