Skip to content

Commit 7e78afa

Browse files
authored
Update lecture-python sources with latest updates (#32)
* update sources from lecture-python (dbd838d) using sphinx-tomyst (b06cacb) * fix end of file space issue
1 parent 867e2fd commit 7e78afa

27 files changed

+270
-67
lines changed

lectures/ar1_processes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ series $\{ X_t\}$.
109109

110110
To see this, we first note that $X_t$ is normally distributed for each $t$.
111111

112-
This is immediate form {eq}`ar1_ma`, since linear combinations of independent
112+
This is immediate from {eq}`ar1_ma`, since linear combinations of independent
113113
normal random variables are normal.
114114

115115
Given that $X_t$ is normally distributed, we will know the full distribution
@@ -212,7 +212,7 @@ In fact it's easy to show that such convergence will occur, regardless of the in
212212
To see this, we just have to look at the dynamics of the first two moments, as
213213
given in {eq}`dyn_tm`.
214214

215-
When $|a| < 1$, these sequence converge to the respective limits
215+
When $|a| < 1$, these sequences converge to the respective limits
216216

217217
```{math}
218218
:label: mu_sig_star

lectures/cake_eating_numerical.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Let's write this a bit more mathematically.
100100
### The Bellman Operator
101101

102102
We introduce the **Bellman operator** $T$ that takes a function v as an
103-
argument and returns a new function $Tv$ defined by.
103+
argument and returns a new function $Tv$ defined by
104104

105105
$$
106106
Tv(x) = \max_{0 \leq c \leq x} \{u(c) + \beta v(x - c)\}
@@ -118,7 +118,7 @@ v$ converges to the solution to the Bellman equation.
118118

119119
### Fitted Value Function Iteration
120120

121-
Both consumption $c$ and the state variable $x$ are continous.
121+
Both consumption $c$ and the state variable $x$ are continuous.
122122

123123
This causes complications when it comes to numerical work.
124124

@@ -419,7 +419,7 @@ ax.legend()
419419
plt.show()
420420
```
421421

422-
The fit is reasoable but not perfect.
422+
The fit is reasonable but not perfect.
423423

424424
We can improve it by increasing the grid size or reducing the
425425
error tolerance in the value function iteration routine.
@@ -509,7 +509,7 @@ modification in the exercise above).
509509

510510
### Exercise 1
511511

512-
We need to create a class to hold our primitives and return the right hand side of the bellman equation.
512+
We need to create a class to hold our primitives and return the right hand side of the Bellman equation.
513513

514514
We will use [inheritance](https://en.wikipedia.org/wiki/Inheritance_%28object-oriented_programming%29) to maximize code reuse.
515515

lectures/cass_koopmans_1.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ kernelspec:
2626

2727
## Overview
2828

29-
This lecture and in {doc}`Cass-Koopmans Competitive Equilibrium <cass_koopmans_2>` describe a model that Tjalling Koopmans {cite}`Koopmans`
29+
This lecture and lecture {doc}`Cass-Koopmans Competitive Equilibrium <cass_koopmans_2>` describe a model that Tjalling Koopmans {cite}`Koopmans`
3030
and David Cass {cite}`Cass` used to analyze optimal growth.
3131

3232
The model can be viewed as an extension of the model of Robert Solow
3333
described in [an earlier lecture](https://lectures.quantecon.org/py/python_oop.html)
3434
but adapted to make the saving rate the outcome of an optimal choice.
3535

36-
(Solow assumed a constant saving rate determined outside the model).
36+
(Solow assumed a constant saving rate determined outside the model.)
3737

3838
We describe two versions of the model, one in this lecture and the other in {doc}`Cass-Koopmans Competitive Equilibrium <cass_koopmans_2>`.
3939

@@ -696,7 +696,7 @@ its steady state value most of the time.
696696
plot_paths(pp, 0.3, k_ss/3, [250, 150, 50, 25], k_ss=k_ss);
697697
```
698698

699-
Different colors in the above graphs are associated
699+
Different colors in the above graphs are associated with
700700
different horizons $T$.
701701

702702
Notice that as the horizon increases, the planner puts $K_t$

lectures/cass_koopmans_2.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ verify** approach.
397397
In this lecture {doc}`Cass-Koopmans Planning Model <cass_koopmans_1>`, we computed an allocation $\{\vec{C}, \vec{K}, \vec{N}\}$
398398
that solves the planning problem.
399399

400-
(This allocation will constitute the **Big** $K$ to be in the presence instance of the *Big** $K$ **, little** $k$ trick
400+
(This allocation will constitute the **Big** $K$ to be in the present instance of the *Big** $K$ **, little** $k$ trick
401401
that we'll apply to a competitive equilibrium in the spirit of [this lecture](https://lectures.quantecon.org/py/rational_expectations.html#)
402402
and [this lecture](https://lectures.quantecon.org/py/dyn_stack.html#).)
403403

@@ -597,7 +597,7 @@ representative household living in a competitive equilibrium.
597597
We now turn to the problem faced by a firm in a competitive
598598
equilibrium:
599599

600-
If we plug in {eq}`eq-pl` into {eq}`Zero-profits` for all t, we
600+
If we plug {eq}`eq-pl` into {eq}`Zero-profits` for all t, we
601601
get
602602

603603
$$

lectures/finite_markov.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ We'll come back to this a bit later.
603603

604604
### Aperiodicity
605605

606-
Loosely speaking, a Markov chain is called periodic if it cycles in a predictible way, and aperiodic otherwise.
606+
Loosely speaking, a Markov chain is called periodic if it cycles in a predictable way, and aperiodic otherwise.
607607

608608
Here's a trivial example with three states
609609

@@ -771,7 +771,7 @@ with the unit eigenvalue $\lambda = 1$.
771771

772772
A more stable and sophisticated algorithm is implemented in [QuantEcon.py](http://quantecon.org/quantecon-py).
773773

774-
This is the one we recommend you use:
774+
This is the one we recommend you to use:
775775

776776
```{code-cell} python3
777777
P = [[0.4, 0.6],
@@ -1023,7 +1023,7 @@ A topic of interest for economics and many other disciplines is *ranking*.
10231023
Let's now consider one of the most practical and important ranking problems
10241024
--- the rank assigned to web pages by search engines.
10251025

1026-
(Although the problem is motivated from outside of economics, there is in fact a deep connection between search ranking systems and prices in certain competitive equilibria --- see {cite}`DLP2013`)
1026+
(Although the problem is motivated from outside of economics, there is in fact a deep connection between search ranking systems and prices in certain competitive equilibria --- see {cite}`DLP2013`.)
10271027

10281028
To understand the issue, consider the set of results returned by a query to a web search engine.
10291029

lectures/heavy_tails.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ where $\mu := \mathbb E X_i = \int x F(x)$ is the common mean of the sample.
186186
The condition $\mathbb E | X_i | = \int |x| F(x) < \infty$ holds
187187
in most cases but can fail if the distribution $F$ is very heavy tailed.
188188

189-
For example, it fails for the Cauchy distribution
189+
For example, it fails for the Cauchy distribution.
190190

191191
Let's have a look at the behavior of the sample mean in this case, and see
192192
whether or not the LLN is still valid.
@@ -590,7 +590,7 @@ $$
590590
2^{1/\alpha} = \exp(\mu)
591591
$$
592592

593-
which we solve for $\mu$ and $\sigma$ given $\alpha = 1.05$
593+
which we solve for $\mu$ and $\sigma$ given $\alpha = 1.05$.
594594

595595
Here is code that generates the two samples, produces the violin plot and
596596
prints the mean and standard deviation of the two samples.

lectures/ifp.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ model <optgrowth>` and yet differs in important ways.
4848

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

51-
Moreover, in this and the following lectures, we will inject more realisitic
51+
Moreover, in this and the following lectures, we will inject more realistic
5252
features such as correlated shocks.
5353

5454
To solve the model we will use Euler equation based time iteration, which proved
@@ -194,7 +194,7 @@ strict inequality $u' (c_t) > \beta R \, \mathbb{E}_t u'(c_{t+1})$
194194
can occur because $c_t$ cannot increase sufficiently to attain equality.
195195

196196
(The lower boundary case $c_t = 0$ never arises at the optimum because
197-
$u'(0) = \infty$)
197+
$u'(0) = \infty$.)
198198

199199
With some thought, one can show that {eq}`ee00` and {eq}`ee01` are
200200
equivalent to
@@ -409,8 +409,7 @@ Next we provide a function to compute the difference
409409
```{math}
410410
:label: euler_diff_eq
411411
412-
u'(c)
413-
- \max \left\{
412+
u'(c) - \max \left\{
414413
\beta R \, \mathbb E_z (u' \circ \sigma) \,
415414
[R (a - c) + \hat Y, \, \hat Z]
416415
\, , \;
@@ -629,7 +628,7 @@ shocks.
629628
Your task is to investigate how this measure of aggregate capital varies with
630629
the interest rate.
631630

632-
Following tradition, put the price (i.e., interest rate) is on the vertical axis.
631+
Following tradition, put the price (i.e., interest rate) on the vertical axis.
633632

634633
On the horizontal axis put aggregate capital, computed as the mean of the
635634
stationary distribution given the interest rate.

lectures/ifp_advanced.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ It can be shown that
250250

251251
We now have a clear path to successfully approximating the optimal policy:
252252
choose some $\sigma \in \mathscr C$ and then iterate with $K$ until
253-
convergence (as measured by the distance $\rho$)
253+
convergence (as measured by the distance $\rho$).
254254

255255
### Using an Endogenous Grid
256256

@@ -325,7 +325,7 @@ $$
325325
L(z, \hat z) := P(z, \hat z) \int R(\hat z, x) \phi(x) dx
326326
$$
327327

328-
This indentity is proved in {cite}`ma2020income`, where $\phi$ is the
328+
This identity is proved in {cite}`ma2020income`, where $\phi$ is the
329329
density of the innovation $\zeta_t$ to returns on assets.
330330

331331
(Remember that $\mathsf Z$ is a finite set, so this expression defines a matrix.)
@@ -618,7 +618,7 @@ For example, we will pass in the solutions `a_star, σ_star` along with
618618
`ifp`, even though it would be more natural to just pass in `ifp` and then
619619
solve inside the function.
620620

621-
The reason we do this is because `solve_model_time_iter` is not
621+
The reason we do this is that `solve_model_time_iter` is not
622622
JIT-compiled.
623623

624624
```{code-cell} python3

lectures/inventory_dynamics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ follow so-called s-S inventory dynamics.
3434
Such firms
3535

3636
1. wait until inventory falls below some level $s$ and then
37-
1. order sufficent quantities to bring their inventory back up to capacity $S$.
37+
1. order sufficient quantities to bring their inventory back up to capacity $S$.
3838

3939
These kinds of policies are common in practice and also optimal in certain circumstances.
4040

@@ -176,7 +176,7 @@ fixed $T$.
176176
We will do this by generating many draws of $X_T$ given initial
177177
condition $X_0$.
178178

179-
With these draws of $X_T$ we can build up a picture of its distribution $\psi_T$
179+
With these draws of $X_T$ we can build up a picture of its distribution $\psi_T$.
180180

181181
Here's one visualization, with $T=50$.
182182

lectures/jv.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class JVWorker:
223223
```
224224

225225
The function `operator_factory` takes an instance of this class and returns a
226-
jitted version of the Bellman operator `T`, ie.
226+
jitted version of the Bellman operator `T`, i.e.
227227

228228
$$
229229
Tv(x)

lectures/kalman.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ Conditions under which a fixed point exists and the sequence $\{\Sigma_t\}$ conv
499499

500500
A sufficient (but not necessary) condition is that all the eigenvalues $\lambda_i$ of $A$ satisfy $|\lambda_i| < 1$ (cf. e.g., {cite}`AndersonMoore2005`, p. 77).
501501

502-
(This strong condition assures that the unconditional distribution of $x_t$ converges as $t \rightarrow + \infty$)
502+
(This strong condition assures that the unconditional distribution of $x_t$ converges as $t \rightarrow + \infty$.)
503503

504504
In this case, for any initial choice of $\Sigma_0$ that is both non-negative and symmetric, the sequence $\{\Sigma_t\}$ in {eq}`kalman_sdy` converges to a non-negative symmetric matrix $\Sigma$ that solves {eq}`kalman_dare`.
505505

lectures/kesten_processes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ s_{t+1} = e_{t+1} \mathbb{1}\{s_t < \bar s\} +
496496

497497
Here
498498

499-
* the state variable $s_t$ is represents productivity (which is a proxy
499+
* the state variable $s_t$ represents productivity (which is a proxy
500500
for output and hence firm size),
501501
* the IID sequence $\{ e_t \}$ is thought of as a productivity draw for a new
502502
entrant and

lectures/likelihood_ratio_process.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ But it would be too challenging for us to that here simply by applying a standa
254254

255255
The reason is that the distribution of $L\left(w^{t}\right)$ is extremely skewed for large values of $t$.
256256

257-
Because the probabilty density in the right tail is close to $0$, it just takes too much computer time to sample enough points from the right tail.
257+
Because the probability density in the right tail is close to $0$, it just takes too much computer time to sample enough points from the right tail.
258258

259259
Instead, the following code just illustrates that the unconditional means of $l(w_t)$ are $1$.
260260

@@ -498,7 +498,7 @@ Notice that as $t$ increases, we are assured a larger probability
498498
of detection and a smaller probability of false alarm associated with
499499
a given discrimination threshold $c$.
500500

501-
As $t \rightarrow + \infty$, we approach the the perfect detection
501+
As $t \rightarrow + \infty$, we approach the perfect detection
502502
curve that is indicated by a right angle hinging on the green dot.
503503

504504
For a given sample size $t$, a value discrimination threshold $c$ determines a point on the receiver operating

lectures/linear_algebra.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ $$
12901290
(Q + B'PB)u + B'PAx = 0
12911291
$$
12921292

1293-
which is the first-order condition for maximizing L w.r.t. u.
1293+
which is the first-order condition for maximizing $L$ w.r.t. $u$.
12941294

12951295
Thus, the optimal choice of u must satisfy
12961296

lectures/lln_clt.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ To this end, we now perform the following simulation
385385
Here's some code that does exactly this for the exponential distribution
386386
$F(x) = 1 - e^{- \lambda x}$.
387387

388-
(Please experiment with other choices of $F$, but remember that, to conform with the conditions of the CLT, the distribution must have a finite second moment)
388+
(Please experiment with other choices of $F$, but remember that, to conform with the conditions of the CLT, the distribution must have a finite second moment.)
389389

390390
(sim_one)=
391391
```{code-cell} python3
@@ -437,7 +437,7 @@ random variable, the distribution of $Y_n$ will smooth out into a bell-shaped cu
437437
The next figure shows this process for $X_i \sim f$, where $f$ was
438438
specified as the convex combination of three different beta densities.
439439

440-
(Taking a convex combination is an easy way to produce an irregular shape for $f$)
440+
(Taking a convex combination is an easy way to produce an irregular shape for $f$.)
441441

442442
In the figure, the closest density is that of $Y_1$, while the furthest is that of
443443
$Y_5$
@@ -650,7 +650,7 @@ n \to \infty
650650

651651
This theorem is used frequently in statistics to obtain the asymptotic distribution of estimators --- many of which can be expressed as functions of sample means.
652652

653-
(These kinds of results are often said to use the "delta method")
653+
(These kinds of results are often said to use the "delta method".)
654654

655655
The proof is based on a Taylor expansion of $g$ around the point $\mu$.
656656

@@ -741,7 +741,7 @@ n \| \mathbf Q ( \bar{\mathbf X}_n - \boldsymbol \mu ) \|^2
741741
where $\chi^2(k)$ is the chi-squared distribution with $k$ degrees
742742
of freedom.
743743

744-
(Recall that $k$ is the dimension of $\mathbf X_i$, the underlying random vectors)
744+
(Recall that $k$ is the dimension of $\mathbf X_i$, the underlying random vectors.)
745745

746746
Your second exercise is to illustrate the convergence in {eq}`lln_ctc` with a simulation.
747747

lectures/mccall_fitted_vfi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ The exercises ask you to explore the solution and how it changes with parameters
320320
Use the code above to explore what happens to the reservation wage when the wage parameter $\mu$
321321
changes.
322322

323-
Use the default parameters and $\mu$ in `mu_vals = np.linspace(0.0, 2.0, 15)`
323+
Use the default parameters and $\mu$ in `mu_vals = np.linspace(0.0, 2.0, 15)`.
324324

325325
Is the impact on the reservation wage as you expected?
326326

@@ -338,7 +338,7 @@ support.
338338

339339
Use `s_vals = np.linspace(1.0, 2.0, 15)` and `m = 2.0`.
340340

341-
State how you expect the reservation wage vary with $s$.
341+
State how you expect the reservation wage to vary with $s$.
342342

343343
Now compute it. Is this as you expected?
344344

lectures/mccall_model.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ Step 4: if the deviation is larger than some fixed tolerance, set $v = v'$ and g
296296

297297
Step 5: return $v$.
298298

299-
Let $\{ v_k \}$ denote the sequence genererated by this algorithm.
299+
Let $\{ v_k \}$ denote the sequence generated by this algorithm.
300300

301301
This sequence converges to the solution
302302
to {eq}`odu_pv2` as $k \to \infty$, which is the value function $v^*$.
@@ -321,7 +321,7 @@ itself via
321321
```
322322

323323
(A new vector $Tv$ is obtained from given vector $v$ by evaluating
324-
the r.h.s. at each $i$)
324+
the r.h.s. at each $i$.)
325325

326326
The element $v_k$ in the sequence $\{v_k\}$ of successive
327327
approximations corresponds to $T^k v$.

lectures/mccall_model_with_separation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ If he rejects, then he receives unemployment compensation $c$.
124124

125125
The process then repeats.
126126

127-
(Note: we do not allow for job search while employed---this topic is taken up in a {doc}`later lecture <jv>`)
127+
(Note: we do not allow for job search while employed---this topic is taken up in a {doc}`later lecture <jv>`.)
128128

129129
## Solving the Model
130130

lectures/multi_hyper.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ $$
7777
To evaluate whether the selection procedure is **color blind** the administrator wants to study whether the particular realization of $X$ drawn can plausibly
7878
be said to be a random draw from the probability distribution that is implied by the **color blind** hypothesis.
7979

80-
The appropriate probability distribution is the one described [here](https://en.wikipedia.org/wiki/Hypergeometric_distribution)
80+
The appropriate probability distribution is the one described [here](https://en.wikipedia.org/wiki/Hypergeometric_distribution).
8181

8282
Let's now instantiate the administrator's problem, while continuing to use the colored balls metaphor.
8383

0 commit comments

Comments
 (0)