Skip to content

Commit ead1bca

Browse files
mmckyHumphreyYangshlff
authored
LECT: Markov Chain Lecture (#51)
* LECT: Markov Chain Lecture * update exercise * Enable sphinx-proof * typos * update bib and tags * add graphviz * remove solved TODOs * remove plus --------- Co-authored-by: Humphrey Yang <humphrey.yang@anu.edu.au> Co-authored-by: Shu <shu.hu@anu.edu.au>
1 parent 6997e41 commit ead1bca

File tree

4 files changed

+52
-69
lines changed

4 files changed

+52
-69
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
python-version: 3.9
1616
environment-file: environment.yml
1717
activate-environment: quantecon
18+
- name: Graphics Support
19+
run: |
20+
sudo apt-get -qq update && sudo apt-get install -y graphviz
1821
# - name: Install latex dependencies
1922
# run: |
2023
# sudo apt-get -qq update

lectures/_static/quant-econ.bib

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2496,3 +2496,38 @@ @article{stachurski2019impossibility
24962496
year = {2019},
24972497
publisher = {Elsevier}
24982498
}
2499+
2500+
2501+
@book{zhao_power_2012,
2502+
address = {Boston, MA},
2503+
series = {{SpringerBriefs} in {Computer} {Science}},
2504+
title = {Power {Distribution} and {Performance} {Analysis} for {Wireless} {Communication} {Networks}},
2505+
isbn = {978-1-4614-3283-8 978-1-4614-3284-5},
2506+
url = {https://link.springer.com/10.1007/978-1-4614-3284-5},
2507+
language = {en},
2508+
urldate = {2023-02-03},
2509+
publisher = {Springer US},
2510+
author = {Zhao, Dongmei},
2511+
year = {2012},
2512+
doi = {10.1007/978-1-4614-3284-5},
2513+
keywords = {Performance Analysis, Power Distribution, Radio Resource Management, Wireless Networks},
2514+
}
2515+
2516+
@article{benhabib_wealth_2019,
2517+
title = {Wealth {Distribution} and {Social} {Mobility} in the {US}: {A} {Quantitative} {Approach}},
2518+
volume = {109},
2519+
issn = {0002-8282},
2520+
shorttitle = {Wealth {Distribution} and {Social} {Mobility} in the {US}},
2521+
url = {https://www.aeaweb.org/articles?id=10.1257/aer.20151684},
2522+
doi = {10.1257/aer.20151684},
2523+
abstract = {We quantitatively identify the factors that drive wealth dynamics in the United States and are consistent with its skewed cross-sectional distribution and with social mobility. We concentrate on three critical factors: (i) skewed earnings, (ii) differential saving rates across wealth levels, and (iii) stochastic idiosyncratic returns to wealth. All of these are fundamental for matching both distribution and mobility. The stochastic process for returns which best fits the cross-sectional distribution of wealth and social mobility in the United States shares several statistical properties with those of the returns to wealth uncovered by Fagereng et al. (2017) from tax records in Norway.},
2524+
language = {en},
2525+
number = {5},
2526+
urldate = {2023-02-03},
2527+
journal = {American Economic Review},
2528+
author = {Benhabib, Jess and Bisin, Alberto and Luo, Mi},
2529+
month = may,
2530+
year = {2019},
2531+
keywords = {Personal Income, Wealth, and Their Distributions, General Aggregative Models: Neoclassical, Macroeconomics: Consumption, Saving, Wealth, Aggregate Factor Income Distribution},
2532+
pages = {1623--1647},
2533+
}

lectures/_toc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ parts:
1111
- file: geom_series
1212
- file: short_path
1313
- file: scalar_dynam
14+
- file: markov_chains
1415
- file: linear_equations
1516
- file: lln_clt
1617
- caption: Introductory Economics

in-work/markov_chains.md renamed to lectures/markov_chains.md

Lines changed: 13 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ import numpy as np
5454

5555
In this section we provide the basic definitions and some elementary examples.
5656

57-
+++
58-
5957
(finite_dp_stoch_mat)=
6058
### Stochastic Matrices
6159

@@ -764,7 +762,7 @@ From this equality, we immediately get $\psi^* = \psi^* P^t$ for all $t$.
764762
This tells us an important fact: If the distribution of $X_0$ is a stationary distribution, then $X_t$ will have this same distribution for all $t$.
765763

766764
```{prf:theorem}
767-
:label: stationary
765+
:label: unique_stat
768766
769767
Every stochastic matrix $P$ has at least one stationary distribution.
770768
```
@@ -835,14 +833,11 @@ mc.stationary_distributions # Show all stationary distributions
835833

836834
Under irreducibility, yet another important result obtains:
837835

838-
839-
TODO -- convert to environment
840-
841836
````{prf:theorem}
842837
:label: stationary
843838
844839
If $P$ is irreducible and $\psi^*$ is the unique stationary
845-
distribition, then, for all $x \in S$,
840+
distribution, then, for all $x \in S$,
846841
847842
```{math}
848843
:label: llnfmc0
@@ -854,14 +849,12 @@ distribition, then, for all $x \in S$,
854849
Here
855850
856851
* $\{X_t\}$ is a Markov chain with stochastic matrix $P$ and initial
857-
distribition $\psi_0$
852+
distribution $\psi_0$
858853
* $\mathbf{1}\{X_t = x\} = 1$ if $X_t = x$ and zero otherwise
859854
860855
````
861856

862-
TODO -- in the next line, refer to the theorem by number.
863-
864-
The result in theorem XXX is sometimes called **ergodicity**.
857+
The result in [theorem 4.3](llnfmc0) is sometimes called **ergodicity**.
865858

866859
The theorem tells us that the fraction of time the chain spends at state $x$
867860
converges to $\psi^*(x)$ as time goes to infinity.
@@ -969,7 +962,7 @@ dot.edge("1", "0", label="1.0", color='red')
969962
dot
970963
```
971964

972-
As you might notice, unlike other Markov chain we have seen before, it has a periodic cycle.
965+
As you might notice, unlike other Markov chains we have seen before, it has a periodic cycle.
973966

974967
This is formally called [periodicity](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/16:_Markov_Processes/16.05:_Periodicity_of_Discrete-Time_Chains#:~:text=A%20state%20in%20a%20discrete,limiting%20behavior%20of%20the%20chain.).
975968

@@ -1016,8 +1009,6 @@ stationary distribution regardless of where we begin.
10161009

10171010
For example, we have the following result
10181011

1019-
TODO -- convert to theorem environment
1020-
10211012
```{prf:theorem}
10221013
:label: strict_stationary
10231014
@@ -1269,37 +1260,10 @@ $$
12691260

12701261
TODO -- connect to the Neumann series lemma (Maanasee)
12711262

1272-
1273-
TODO -- verify the link.
1274-
1275-
12761263
## Exercises
12771264

1278-
TODO: Add this into bib file
1279-
1280-
@article{benhabib_wealth_2019,
1281-
title = {Wealth {Distribution} and {Social} {Mobility} in the {US}: {A} {Quantitative} {Approach}},
1282-
volume = {109},
1283-
issn = {0002-8282},
1284-
shorttitle = {Wealth {Distribution} and {Social} {Mobility} in the {US}},
1285-
url = {https://www.aeaweb.org/articles?id=10.1257/aer.20151684},
1286-
doi = {10.1257/aer.20151684},
1287-
abstract = {We quantitatively identify the factors that drive wealth dynamics in the United States and are consistent with its skewed cross-sectional distribution and with social mobility. We concentrate on three critical factors: (i) skewed earnings, (ii) differential saving rates across wealth levels, and (iii) stochastic idiosyncratic returns to wealth. All of these are fundamental for matching both distribution and mobility. The stochastic process for returns which best fits the cross-sectional distribution of wealth and social mobility in the United States shares several statistical properties with those of the returns to wealth uncovered by Fagereng et al. (2017) from tax records in Norway.},
1288-
language = {en},
1289-
number = {5},
1290-
urldate = {2023-02-03},
1291-
journal = {American Economic Review},
1292-
author = {Benhabib, Jess and Bisin, Alberto and Luo, Mi},
1293-
month = may,
1294-
year = {2019},
1295-
keywords = {Personal Income, Wealth, and Their Distributions, General Aggregative Models: Neoclassical, Macroeconomics: Consumption, Saving, Wealth, Aggregate Factor Income Distribution},
1296-
pages = {1623--1647},
1297-
file = {Full Text PDF:/Users/humphreyyang/Zotero/storage/P93BG5IZ/Benhabib et al. - 2019 - Wealth Distribution and Social Mobility in the US.pdf:application/pdf},
1298-
}
1299-
1300-
1301-
```{exercise}
1302-
:label: fm_ex1
1265+
````{exercise}
1266+
:label: mc_ex1
13031267
13041268
Benhabib el al. {cite}`benhabib_wealth_2019` estimated that the transition matrix for social mobility as the following
13051269
@@ -1335,9 +1299,9 @@ In this exercise,
13351299
13361300
1. use simulation to show ergodicity.
13371301
1338-
```
1302+
````
13391303

1340-
```{solution-start}
1304+
```{solution-start} mc_ex1
13411305
:class: dropdown
13421306
```
13431307

@@ -1399,7 +1363,7 @@ We can see that the time spent at each state quickly converges to the stationary
13991363

14001364

14011365
```{exercise}
1402-
:label: fm_ex2
1366+
:label: mc_ex2
14031367
14041368
According to the discussion {ref}`above <mc_eg1-2>`, if a worker's employment dynamics obey the stochastic matrix
14051369
@@ -1438,7 +1402,7 @@ $(0, 1)$.
14381402
The result should be similar to the plot we plotted [here](ergo)
14391403
```
14401404

1441-
```{solution-start} fm_ex2
1405+
```{solution-start} mc_ex2
14421406
:class: dropdown
14431407
```
14441408

@@ -1482,7 +1446,7 @@ plt.show()
14821446
```
14831447

14841448
```{exercise}
1485-
:label: fm_ex3
1449+
:label: mc_ex3
14861450
14871451
In `quantecon` library, irreducibility is tested by checking whether the chain forms a [strongly connected component](https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.components.is_strongly_connected.html).
14881452
@@ -1496,27 +1460,7 @@ Based on this claim, write a function to test irreducibility.
14961460
14971461
```
14981462

1499-
TODO:
1500-
1501-
add to .bib
1502-
1503-
@book{zhao_power_2012,
1504-
address = {Boston, MA},
1505-
series = {{SpringerBriefs} in {Computer} {Science}},
1506-
title = {Power {Distribution} and {Performance} {Analysis} for {Wireless} {Communication} {Networks}},
1507-
isbn = {978-1-4614-3283-8 978-1-4614-3284-5},
1508-
url = {https://link.springer.com/10.1007/978-1-4614-3284-5},
1509-
language = {en},
1510-
urldate = {2023-02-03},
1511-
publisher = {Springer US},
1512-
author = {Zhao, Dongmei},
1513-
year = {2012},
1514-
doi = {10.1007/978-1-4614-3284-5},
1515-
keywords = {Performance Analysis, Power Distribution, Radio Resource Management, Wireless Networks},
1516-
file = {Full Text:/Users/humphreyyang/Zotero/storage/6JG9FW3F/Zhao - 2012 - Power Distribution and Performance Analysis for Wi.pdf:application/pdf},
1517-
}
1518-
1519-
```{solution-start} fm_ex3
1463+
```{solution-start} mc_ex3
15201464
:class: dropdown
15211465
```
15221466

0 commit comments

Comments
 (0)