Skip to content

Commit ae592bd

Browse files
committed
changes based on comments
1 parent dd0c570 commit ae592bd

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

lectures/lln_clt.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,8 @@ Since the distribution of $\bar X$ follows a standard normal distribution, but t
368368
This violates {eq}`exp`, and thus breaks LLN.
369369

370370
```{note}
371+
:name: iid_violation
372+
371373
Although in this case, the violation of IID breaks LLN, it is not always the case for correlated data.
372374
373375
We will show an example in the [exercise](lln_ex3).

lectures/markov_chains.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,6 @@ Then we can address a range of questions, such as
255255

256256
We'll cover such applications below.
257257

258-
259-
260258
### Defining Markov Chains
261259

262260
So far we've given examples of Markov chains but now let's define them more
@@ -308,9 +306,6 @@ chain $\{X_t\}$ as follows:
308306

309307
By construction, the resulting process satisfies {eq}`mpp`.
310308

311-
312-
313-
314309
## Simulation
315310

316311
```{index} single: Markov Chains; Simulation
@@ -864,10 +859,8 @@ Importantly, the result is valid for any choice of $\psi_0$.
864859

865860
Notice that the theorem is related to the law of large numbers.
866861

867-
TODO -- link to our undergrad lln and clt lecture
868-
869862
It tells us that, in some settings, the law of large numbers sometimes holds even when the
870-
sequence of random variables is not IID.
863+
sequence of random variables is [not IID](iid_violation).
871864

872865

873866
(mc_eg1-2)=
@@ -919,7 +912,7 @@ for i in range(n_state):
919912
axes[i].set_xlabel('t')
920913
axes[i].set_ylabel(fr'average time spent at {i}')
921914
922-
# Compute the fraction of time spent, for each x
915+
# Compute the fraction of time spent, starting from different x_0s
923916
for x0, col in ((0, 'blue'), (1, 'green'), (2, 'red')):
924917
# Generate time series that starts at different x0
925918
X = mc.simulate(n, init=x0)
@@ -948,6 +941,8 @@ $$
948941
The diagram of the Markov chain shows that it is **irreducible**
949942

950943
```{code-cell} ipython3
944+
:tags: [hide-input]
945+
951946
dot = Digraph(comment='Graph')
952947
dot.attr(rankdir='LR')
953948
dot.node("0")
@@ -1077,6 +1072,7 @@ In the case of Hamilton's Markov chain, the distribution $\psi P^t$ converges to
10771072
P = np.array([[0.971, 0.029, 0.000],
10781073
[0.145, 0.778, 0.077],
10791074
[0.000, 0.508, 0.492]])
1075+
10801076
# Define the number of iterations
10811077
n = 50
10821078
n_state = P.shape[0]
@@ -1096,7 +1092,7 @@ for i in range(n):
10961092
# Loop through many initial values
10971093
for x0 in x0s:
10981094
x = x0
1099-
X = np.zeros((n,n_state))
1095+
X = np.zeros((n, n_state))
11001096
11011097
# Obtain and plot distributions at each state
11021098
for t in range(0, n):
@@ -1294,7 +1290,7 @@ In this exercise,
12941290
12951291
1. show this process is asymptotically stationary and calculate the stationary distribution using simulations.
12961292
1297-
1. use simulation to show ergodicity.
1293+
1. use simulations to demonstrate ergodicity of this process.
12981294
12991295
````
13001296

@@ -1322,7 +1318,7 @@ codes_B = ( '1','2','3','4','5','6','7','8')
13221318
np.linalg.matrix_power(P_B, 10)
13231319
```
13241320

1325-
We find rows transition matrix converge to the stationary distribution
1321+
We find rows of transition matrix converge to the stationary distribution
13261322

13271323
```{code-cell} ipython3
13281324
mc = qe.MarkovChain(P_B)
@@ -1353,7 +1349,7 @@ ax.legend()
13531349
plt.show()
13541350
```
13551351

1356-
We can see that the time spent at each state quickly converges to the stationary distribution.
1352+
Note that the average time spent at each state quickly converges to the stationary distribution.
13571353

13581354
```{solution-end}
13591355
```
@@ -1451,10 +1447,9 @@ However, another way to verify irreducibility is by checking whether $A$ satisfi
14511447
14521448
Assume A is an $n \times n$ $A$ is irreducible if and only if $\sum_{k=0}^{n-1}A^k$ is a positive matrix.
14531449
1454-
(see more at \cite{zhao_power_2012} and [here](https://math.stackexchange.com/questions/3336616/how-to-prove-this-matrix-is-a-irreducible-matrix))
1450+
(see more: {cite}`zhao_power_2012` and [here](https://math.stackexchange.com/questions/3336616/how-to-prove-this-matrix-is-a-irreducible-matrix))
14551451
14561452
Based on this claim, write a function to test irreducibility.
1457-
14581453
```
14591454

14601455
```{solution-start} mc_ex3

0 commit comments

Comments
 (0)