Skip to content

Commit 11e5850

Browse files
jstacclaude
andcommitted
Fix cross-references to renamed cake eating lectures
Updated all doc references throughout the lecture series to reflect the renamed files from PR #679: - cake_eating_problem → cake_eating - optgrowth → cake_eating_stochastic - coleman_policy_iter → cake_eating_time_iter - egm_policy_iter → cake_eating_egm Also: - Removed references to the deleted optgrowth_fast lecture - Inlined solve_model_time_iter function in ifp.md - Updated terminology from "stochastic optimal growth model" to "cake eating model" in ifp.md This fixes the Jupyter Book build warnings about unknown documents. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent d43e20a commit 11e5850

File tree

6 files changed

+36
-17
lines changed

6 files changed

+36
-17
lines changed

lectures/cake_eating_numerical.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ kernelspec:
1717

1818
## Overview
1919

20-
In this lecture we continue the study of {doc}`the cake eating problem <cake_eating_problem>`.
20+
In this lecture we continue the study of {doc}`the cake eating problem <cake_eating>`.
2121

2222
The aim of this lecture is to solve the problem using numerical
2323
methods.
@@ -44,7 +44,7 @@ from scipy.optimize import minimize_scalar, bisect
4444

4545
## Reviewing the Model
4646

47-
You might like to {doc}`review the details <cake_eating_problem>` before we start.
47+
You might like to {doc}`review the details <cake_eating>` before we start.
4848

4949
Recall in particular that the Bellman equation is
5050

@@ -349,7 +349,7 @@ steep near the lower boundary, and hence hard to approximate.
349349

350350
Let's see how this plays out in terms of computing the optimal policy.
351351

352-
In the {doc}`first lecture on cake eating <cake_eating_problem>`, the optimal
352+
In the {doc}`first lecture on cake eating <cake_eating>`, the optimal
353353
consumption policy was shown to be
354354

355355
$$

lectures/cake_eating_stochastic.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ kernelspec:
2727
## Overview
2828

2929
In this lecture, we continue our study of the cake eating problem, building on
30-
{doc}`Cake Eating I <cake_eating_problem>` and {doc}`Cake Eating II <cake_eating_numerical>`.
30+
{doc}`Cake Eating I <cake_eating>` and {doc}`Cake Eating II <cake_eating_numerical>`.
3131

3232
The key difference from the previous lectures is that the cake size now evolves
3333
stochastically.
@@ -440,10 +440,6 @@ flexibility.
440440
Both of these things are helpful, but they do cost us some speed --- as you
441441
will see when you run the code.
442442

443-
{doc}`Later <optgrowth_fast>` we will sacrifice some of this clarity and
444-
flexibility in order to accelerate our code with just-in-time (JIT)
445-
compilation.
446-
447443
The algorithm we will use is fitted value function iteration, which was
448444
described in earlier lectures {doc}`the McCall model <mccall_fitted_vfi>` and
449445
{doc}`cake eating <cake_eating_numerical>`.
@@ -823,7 +819,7 @@ utility specification.
823819
824820
Setting $\gamma = 1.5$, compute and plot an estimate of the optimal policy.
825821
826-
Time how long this function takes to run, so you can compare it to faster code developed in the {doc}`next lecture <optgrowth_fast>`.
822+
Time how long this function takes to run.
827823
```
828824

829825
```{solution-start} og_ex1
@@ -871,7 +867,6 @@ Time how long it takes to iterate with the Bellman operator
871867
872868
Use the model specification in the previous exercise.
873869
874-
(As before, we will compare this number with that for the faster code developed in the {doc}`next lecture <optgrowth_fast>`.)
875870
```
876871

877872
```{solution-start} og_ex2

lectures/ifp.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ This is an essential sub-problem for many representative macroeconomic models
4242
* {cite}`Huggett1993`
4343
* etc.
4444

45-
It is related to the decision problem in the {doc}`stochastic optimal growth model <optgrowth>` and yet differs in important ways.
45+
It is related to the decision problem in the {doc}`cake eating model <cake_eating_stochastic>` and yet differs in important ways.
4646

4747
For example, the choice problem for the agent includes an additive income term that leads to an occasionally binding constraint.
4848

4949
Moreover, in this and the following lectures, we will inject more realistic
5050
features such as correlated shocks.
5151

5252
To solve the model we will use Euler equation based time iteration, which proved
53-
to be {doc}`fast and accurate <coleman_policy_iter>` in our investigation of
54-
the {doc}`stochastic optimal growth model <optgrowth>`.
53+
to be {doc}`fast and accurate <cake_eating_time_iter>` in our investigation of
54+
the {doc}`cake eating model <cake_eating_stochastic>`.
5555

5656
Time iteration is globally convergent under mild assumptions, even when utility is unbounded (both above and below).
5757

@@ -472,7 +472,31 @@ The following function iterates to convergence and returns the approximate
472472
optimal policy.
473473

474474
```{code-cell} python3
475-
:load: _static/lecture_specific/coleman_policy_iter/solve_time_iter.py
475+
def solve_model_time_iter(model, # Class with model information
476+
σ, # Initial condition
477+
tol=1e-4,
478+
max_iter=1000,
479+
verbose=True,
480+
print_skip=25):
481+
482+
# Set up loop
483+
i = 0
484+
error = tol + 1
485+
486+
while i < max_iter and error > tol:
487+
σ_new = K(σ, model)
488+
error = np.max(np.abs(σ - σ_new))
489+
i += 1
490+
if verbose and i % print_skip == 0:
491+
print(f"Error at iteration {i} is {error}.")
492+
σ = σ_new
493+
494+
if error > tol:
495+
print("Failed to converge!")
496+
elif verbose:
497+
print(f"\nConverged in {i} iterations.")
498+
499+
return σ_new
476500
```
477501

478502
Let's carry this out using the default parameters of the `IFP` class:

lectures/ifp_advanced.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ convergence (as measured by the distance $\rho$).
251251
### Using an Endogenous Grid
252252

253253
In the study of that model we found that it was possible to further
254-
accelerate time iteration via the {doc}`endogenous grid method <egm_policy_iter>`.
254+
accelerate time iteration via the {doc}`endogenous grid method <cake_eating_egm>`.
255255

256256
We will use the same method here.
257257

lectures/lqcontrol.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ In reading what follows, it will be useful to have some familiarity with
5757

5858
* matrix manipulations
5959
* vectors of random variables
60-
* dynamic programming and the Bellman equation (see for example {doc}`this lecture <intro:short_path>` and {doc}`this lecture <optgrowth>`)
60+
* dynamic programming and the Bellman equation (see for example {doc}`this lecture <intro:short_path>` and {doc}`this lecture <cake_eating_stochastic>`)
6161

6262
For additional reading on LQ control, see, for example,
6363

lectures/wald_friedman_2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ class WaldFriedman:
451451
return π_new
452452
```
453453

454-
As in the {doc}`optimal growth lecture <optgrowth>`, to approximate a continuous value function
454+
As in {doc}`cake_eating_stochastic`, to approximate a continuous value function
455455

456456
* We iterate at a finite grid of possible values of $\pi$.
457457
* When we evaluate $\mathbb E[J(\pi')]$ between grid points, we use linear interpolation.

0 commit comments

Comments
 (0)