Skip to content

Commit ada343e

Browse files
authored
Merge branch 'main' into tom_july
2 parents 72d345a + c25fe88 commit ada343e

20 files changed

+318
-224
lines changed

environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ channels:
44
- conda-forge
55
dependencies:
66
- python=3.11
7-
- anaconda=2024.02
7+
- anaconda=2024.06
88
- pip
99
- pip:
1010
- jupyter-book==0.15.1

lectures/ar1_processes.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ where $a, b, c$ are scalar-valued parameters
6060

6161
(Equation {eq}`can_ar1` is sometimes called a **stochastic difference equation**.)
6262

63+
```{prf:example}
64+
:label: ar1_ex_ar
65+
6366
For example, $X_t$ might be
6467
6568
* the log of labor income for a given household, or
@@ -70,6 +73,7 @@ of the previous value and an IID shock $W_{t+1}$.
7073
7174
(We use $t+1$ for the subscript of $W_{t+1}$ because this random variable is not
7275
observed at time $t$.)
76+
```
7377

7478
The specification {eq}`can_ar1` generates a time series $\{ X_t\}$ as soon as we
7579
specify an initial condition $X_0$.
@@ -330,7 +334,10 @@ Notes:
330334
* In {eq}`ar1_ergo`, convergence holds with probability one.
331335
* The textbook by {cite}`MeynTweedie2009` is a classic reference on ergodicity.
332336

333-
For example, if we consider the identity function $h(x) = x$, we get
337+
```{prf:example}
338+
:label: ar1_ex_id
339+
340+
If we consider the identity function $h(x) = x$, we get
334341
335342
$$
336343
\frac{1}{m} \sum_{t = 1}^m X_t \to
@@ -339,7 +346,7 @@ $$
339346
$$
340347
341348
In other words, the time series sample mean converges to the mean of the stationary distribution.
342-
349+
```
343350

344351
Ergodicity is important for a range of reasons.
345352

lectures/cagan_ree.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ kernelspec:
1818

1919
We'll use linear algebra first to explain and then do some experiments with a "monetarist theory of price levels".
2020

21-
Economists call it a "monetary" or "monetarist" theory of price levels because effects on price levels occur via a central banks's decisions to print money supply.
21+
Economists call it a "monetary" or "monetarist" theory of price levels because effects on price levels occur via a central bank's decisions to print money supply.
2222

2323
* a goverment's fiscal policies determine whether its _expenditures_ exceed its _tax collections_
2424
* if its expenditures exceed its tax collections, the government can instruct the central bank to cover the difference by _printing money_
@@ -27,7 +27,7 @@ Economists call it a "monetary" or "monetarist" theory of price levels because e
2727
Such a theory of price levels was described by Thomas Sargent and Neil Wallace in chapter 5 of
2828
{cite}`sargent2013rational`, which reprints a 1981 Federal Reserve Bank of Minneapolis article entitled "Unpleasant Monetarist Arithmetic".
2929

30-
Sometimes this theory is also called a "fiscal theory of price levels" to emphasize the importance of fisal deficits in shaping changes in the money supply.
30+
Sometimes this theory is also called a "fiscal theory of price levels" to emphasize the importance of fiscal deficits in shaping changes in the money supply.
3131

3232
The theory has been extended, criticized, and applied by John Cochrane {cite}`cochrane2023fiscal`.
3333

@@ -41,7 +41,7 @@ persistent inflation.
4141

4242
The "monetarist" or "fiscal theory of price levels" asserts that
4343

44-
* to _start_ a persistent inflation the government beings persistently to run a money-financed government deficit
44+
* to _start_ a persistent inflation the government begins persistently to run a money-financed government deficit
4545

4646
* to _stop_ a persistent inflation the government stops persistently running a money-financed government deficit
4747

lectures/complex_and_trig.md

+4
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,16 @@ from sympy import (Symbol, symbols, Eq, nsolve, sqrt, cos, sin, simplify,
103103

104104
### An Example
105105

106+
```{prf:example}
107+
:label: ct_ex_com
108+
106109
Consider the complex number $z = 1 + \sqrt{3} i$.
107110
108111
For $z = 1 + \sqrt{3} i$, $x = 1$, $y = \sqrt{3}$.
109112
110113
It follows that $r = 2$ and
111114
$\theta = \tan^{-1}(\sqrt{3}) = \frac{\pi}{3} = 60^o$.
115+
```
112116

113117
Let's use Python to plot the trigonometric form of the complex number
114118
$z = 1 + \sqrt{3} i$.

lectures/cons_smooth.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ In this lecture, we'll study a famous model of the "consumption function" that M
2121

2222
In this lecture, we'll study what is often called the "consumption-smoothing model" using matrix multiplication and matrix inversion, the same tools that we used in this QuantEcon lecture {doc}`present values <pv>`.
2323

24-
Formulas presented in {doc}`present value formulas<pv>` are at the core of the consumption smoothing model because we shall use them to define a consumer's "human wealth".
24+
Formulas presented in {doc}`present value formulas<pv>` are at the core of the consumption-smoothing model because we shall use them to define a consumer's "human wealth".
2525

2626
The key idea that inspired Milton Friedman was that a person's non-financial income, i.e., his or
2727
her wages from working, could be viewed as a dividend stream from that person's ''human capital''
@@ -39,7 +39,7 @@ It will take a while for a "present value" or asset price explicilty to appear i
3939

4040
## Analysis
4141

42-
As usual, we'll start with by importing some Python modules.
42+
As usual, we'll start by importing some Python modules.
4343

4444
```{code-cell} ipython3
4545
import numpy as np
@@ -128,7 +128,7 @@ Indeed, we shall see that when $\beta R = 1$ (a condition assumed by Milton Frie
128128
129129
By **smoother** we mean as close as possible to being constant over time.
130130
131-
The preference for smooth consumption paths that is built into the model gives it the name "consumption smoothing model".
131+
The preference for smooth consumption paths that is built into the model gives it the name "consumption-smoothing model".
132132
133133
Let's dive in and do some calculations that will help us understand how the model works.
134134
@@ -176,7 +176,7 @@ $$
176176
\sum_{t=0}^T R^{-t} c_t = a_0 + h_0.
177177
$$ (eq:budget_intertemp)
178178
179-
Equation {eq}`eq:budget_intertemp` says that the present value of the consumption stream equals the sum of finanical and non-financial (or human) wealth.
179+
Equation {eq}`eq:budget_intertemp` says that the present value of the consumption stream equals the sum of financial and non-financial (or human) wealth.
180180
181181
Robert Hall {cite}`Hall1978` showed that when $\beta R = 1$, a condition Milton Friedman had also assumed, it is "optimal" for a consumer to smooth consumption by setting
182182
@@ -196,7 +196,7 @@ $$ (eq:conssmoothing)
196196
Equation {eq}`eq:conssmoothing` is the consumption-smoothing model in a nutshell.
197197
198198
199-
## Mechanics of Consumption smoothing model
199+
## Mechanics of consumption-smoothing model
200200
201201
As promised, we'll provide step-by-step instructions on how to use linear algebra, readily implemented in Python, to compute all objects in play in the consumption-smoothing model.
202202
@@ -338,14 +338,14 @@ print('Welfare:', welfare(cs_model, c_seq))
338338
339339
### Experiments
340340
341-
In this section we decribe how a consumption sequence would optimally respond to different sequences sequences of non-financial income.
341+
In this section we describe how a consumption sequence would optimally respond to different sequences sequences of non-financial income.
342342
343-
First we create a function `plot_cs` that generate graphs for different instances of the consumption smoothing model `cs_model`.
343+
First we create a function `plot_cs` that generates graphs for different instances of the consumption-smoothing model `cs_model`.
344344
345345
This will help us avoid rewriting code to plot outcomes for different non-financial income sequences.
346346
347347
```{code-cell} ipython3
348-
def plot_cs(model, # consumption smoothing model
348+
def plot_cs(model, # consumption-smoothing model
349349
a0, # initial financial wealth
350350
y_seq # non-financial income process
351351
):
@@ -368,7 +368,7 @@ def plot_cs(model, # consumption smoothing model
368368
plt.show()
369369
```
370370
371-
In the experiments below, please study how consumption and financial asset sequences vary accross different sequences for non-financial income.
371+
In the experiments below, please study how consumption and financial asset sequences vary across different sequences for non-financial income.
372372
373373
#### Experiment 1: one-time gain/loss
374374
@@ -602,7 +602,7 @@ First, we define the welfare with respect to $\xi_1$ and $\phi$
602602
def welfare_rel(ξ1, ϕ):
603603
"""
604604
Compute welfare of variation sequence
605-
for given ϕ, ξ1 with a consumption smoothing model
605+
for given ϕ, ξ1 with a consumption-smoothing model
606606
"""
607607
608608
cvar_seq = compute_variation(cs_model, ξ1=ξ1,
@@ -661,13 +661,13 @@ QuantEcon lecture {doc}`geometric series <geom_series>`.
661661
In particular, it **lowers** the government expenditure multiplier relative to one implied by
662662
the original Keynesian consumption function presented in {doc}`geometric series <geom_series>`.
663663
664-
Friedman's work opened the door to an enlighening literature on the aggregate consumption function and associated government expenditure multipliers that
664+
Friedman's work opened the door to an enlightening literature on the aggregate consumption function and associated government expenditure multipliers that
665665
remains active today.
666666
667667
668668
## Appendix: solving difference equations with linear algebra
669669
670-
In the preceding sections we have used linear algebra to solve a consumption smoothing model.
670+
In the preceding sections we have used linear algebra to solve a consumption-smoothing model.
671671
672672
The same tools from linear algebra -- matrix multiplication and matrix inversion -- can be used to study many other dynamic models.
673673
@@ -749,7 +749,7 @@ is the inverse of $A$ and check that $A A^{-1} = I$
749749
750750
```
751751
752-
### Second order difference equation
752+
### Second-order difference equation
753753
754754
A second-order linear difference equation for $\{y_t\}_{t=0}^T$ is
755755
@@ -783,6 +783,6 @@ Multiplying both sides by inverse of the matrix on the left again provides the
783783
```{exercise}
784784
:label: consmooth_ex2
785785
786-
As an exercise, we ask you to represent and solve a **third order linear difference equation**.
786+
As an exercise, we ask you to represent and solve a **third-order linear difference equation**.
787787
How many initial conditions must you specify?
788788
```

lectures/eigen_I.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ itself.
8888
This means $A$ is an $n \times n$ matrix that maps (or "transforms") a vector
8989
$x$ in $\mathbb{R}^n$ to a new vector $y=Ax$ also in $\mathbb{R}^n$.
9090

91-
Here's one example:
91+
```{prf:example}
92+
:label: eigen1_ex_sq
9293
9394
$$
9495
\begin{bmatrix}
@@ -116,6 +117,7 @@ $$
116117
117118
transforms the vector $x = \begin{bmatrix} 1 \\ 3 \end{bmatrix}$ to the vector
118119
$y = \begin{bmatrix} 5 \\ 2 \end{bmatrix}$.
120+
```
119121

120122
Let's visualize this using Python:
121123

lectures/eigen_II.md

+19-11
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ In addition to what's in Anaconda, this lecture will need the following librarie
2626

2727
In this lecture we will begin with the foundational concepts in spectral theory.
2828

29-
Then we will explore the Perron-Frobenius Theorem and connect it to applications in Markov chains and networks.
29+
Then we will explore the Perron-Frobenius theorem and connect it to applications in Markov chains and networks.
3030

3131
We will use the following imports:
3232

@@ -64,6 +64,9 @@ An $n \times n$ nonnegative matrix $A$ is called irreducible if $A + A^2 + A^3 +
6464

6565
In other words, for each $i,j$ with $1 \leq i, j \leq n$, there exists a $k \geq 0$ such that $a^{k}_{ij} > 0$.
6666

67+
```{prf:example}
68+
:label: eigen2_ex_irr
69+
6770
Here are some examples to illustrate this further:
6871
6972
$$
@@ -94,6 +97,7 @@ $$
9497
9598
$C$ is not irreducible since $C^k = C$ for all $k \geq 0$ and thus
9699
$c^{k}_{12},c^{k}_{21} = 0$ for all $k \geq 0$.
100+
```
97101

98102
### Left eigenvectors
99103

@@ -159,7 +163,7 @@ This is a more common expression and where the name left eigenvectors originates
159163
For a square nonnegative matrix $A$, the behavior of $A^k$ as $k \to \infty$ is controlled by the eigenvalue with the largest
160164
absolute value, often called the **dominant eigenvalue**.
161165

162-
For any such matrix $A$, the Perron-Frobenius Theorem characterizes certain
166+
For any such matrix $A$, the Perron-Frobenius theorem characterizes certain
163167
properties of the dominant eigenvalue and its corresponding eigenvector.
164168

165169
```{prf:Theorem} Perron-Frobenius Theorem
@@ -188,7 +192,7 @@ Let's build our intuition for the theorem using a simple example we have seen [b
188192

189193
Now let's consider examples for each case.
190194

191-
#### Example: Irreducible matrix
195+
#### Example: irreducible matrix
192196

193197
Consider the following irreducible matrix $A$:
194198

@@ -204,7 +208,7 @@ We can compute the dominant eigenvalue and the corresponding eigenvector
204208
eig(A)
205209
```
206210

207-
Now we can see the claims of the Perron-Frobenius Theorem holds for the irreducible matrix $A$:
211+
Now we can see the claims of the Perron-Frobenius theorem holds for the irreducible matrix $A$:
208212

209213
1. The dominant eigenvalue is real-valued and non-negative.
210214
2. All other eigenvalues have absolute values less than or equal to the dominant eigenvalue.
@@ -223,6 +227,9 @@ Let $A$ be a square nonnegative matrix and let $A^k$ be the $k^{th}$ power of $A
223227

224228
A matrix is called **primitive** if there exists a $k \in \mathbb{N}$ such that $A^k$ is everywhere positive.
225229

230+
```{prf:example}
231+
:label: eigen2_ex_prim
232+
226233
Recall the examples given in irreducible matrices:
227234
228235
$$
@@ -244,10 +251,11 @@ B^2 = \begin{bmatrix} 1 & 0 \\
244251
$$
245252
246253
$B$ is irreducible but not primitive since there are always zeros in either principal diagonal or secondary diagonal.
254+
```
247255

248256
We can see that if a matrix is primitive, then it implies the matrix is irreducible but not vice versa.
249257

250-
Now let's step back to the primitive matrices part of the Perron-Frobenius Theorem
258+
Now let's step back to the primitive matrices part of the Perron-Frobenius theorem
251259

252260
```{prf:Theorem} Continous of Perron-Frobenius Theorem
253261
:label: con-perron-frobenius
@@ -259,7 +267,7 @@ If $A$ is primitive then,
259267
$ r(A)^{-m} A^m$ converges to $v w^{\top}$ when $m \rightarrow \infty$. The matrix $v w^{\top}$ is called the **Perron projection** of $A$.
260268
```
261269

262-
#### Example 1: Primitive matrix
270+
#### Example 1: primitive matrix
263271

264272
Consider the following primitive matrix $B$:
265273

@@ -277,7 +285,7 @@ We compute the dominant eigenvalue and the corresponding eigenvector
277285
eig(B)
278286
```
279287

280-
Now let's give some examples to see if the claims of the Perron-Frobenius Theorem hold for the primitive matrix $B$:
288+
Now let's give some examples to see if the claims of the Perron-Frobenius theorem hold for the primitive matrix $B$:
281289

282290
1. The dominant eigenvalue is real-valued and non-negative.
283291
2. All other eigenvalues have absolute values strictly less than the dominant eigenvalue.
@@ -373,18 +381,18 @@ check_convergence(B)
373381

374382
The result shows that the matrix is not primitive as it is not everywhere positive.
375383

376-
These examples show how the Perron-Frobenius Theorem relates to the eigenvalues and eigenvectors of positive matrices and the convergence of the power of matrices.
384+
These examples show how the Perron-Frobenius theorem relates to the eigenvalues and eigenvectors of positive matrices and the convergence of the power of matrices.
377385

378386
In fact we have already seen the theorem in action before in {ref}`the Markov chain lecture <mc1_ex_1>`.
379387

380388
(spec_markov)=
381-
#### Example 2: Connection to Markov chains
389+
#### Example 2: connection to Markov chains
382390

383391
We are now prepared to bridge the languages spoken in the two lectures.
384392

385393
A primitive matrix is both irreducible and aperiodic.
386394

387-
So Perron-Frobenius Theorem explains why both {ref}`Imam and Temple matrix <mc_eg3>` and [Hamilton matrix](https://en.wikipedia.org/wiki/Hamiltonian_matrix) converge to a stationary distribution, which is the Perron projection of the two matrices
395+
So Perron-Frobenius theorem explains why both {ref}`Imam and Temple matrix <mc_eg3>` and [Hamilton matrix](https://en.wikipedia.org/wiki/Hamiltonian_matrix) converge to a stationary distribution, which is the Perron projection of the two matrices
388396

389397
```{code-cell} ipython3
390398
P = np.array([[0.68, 0.12, 0.20],
@@ -449,7 +457,7 @@ As we have seen, the largest eigenvalue for a primitive stochastic matrix is one
449457
This can be proven using [Gershgorin Circle Theorem](https://en.wikipedia.org/wiki/Gershgorin_circle_theorem),
450458
but it is out of the scope of this lecture.
451459

452-
So by the statement (6) of Perron-Frobenius Theorem, $\lambda_i<1$ for all $i<n$, and $\lambda_n=1$ when $P$ is primitive.
460+
So by the statement (6) of Perron-Frobenius theorem, $\lambda_i<1$ for all $i<n$, and $\lambda_n=1$ when $P$ is primitive.
453461

454462
Hence, after taking the Euclidean norm deviation, we obtain
455463

0 commit comments

Comments
 (0)