Skip to content

Commit 8a63fbb

Browse files
committed
misc
1 parent 925aaba commit 8a63fbb

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

lectures/markov_chains_I.md

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,42 +1113,6 @@ mc = qe.MarkovChain(P)
11131113
ψ_star
11141114
```
11151115

1116-
Solution 3:
1117-
1118-
We find the distribution $\psi$ converges to the stationary distribution more quickly compared to the {ref}`hamilton's chain <hamilton>`.
1119-
1120-
```{code-cell} ipython3
1121-
ts_length = 10
1122-
num_distributions = 25
1123-
plot_distribution(P, ts_length, num_distributions)
1124-
```
1125-
1126-
In fact, the rate of convergence is governed by {ref}`eigenvalues<eigen>` {cite}`sargent2023economic`.
1127-
1128-
```{code-cell} ipython3
1129-
P_eigenvals = np.linalg.eigvals(P)
1130-
P_eigenvals
1131-
```
1132-
1133-
```{code-cell} ipython3
1134-
P_hamilton = np.array([[0.971, 0.029, 0.000],
1135-
[0.145, 0.778, 0.077],
1136-
[0.000, 0.508, 0.492]])
1137-
1138-
hamilton_eigenvals = np.linalg.eigvals(P_hamilton)
1139-
hamilton_eigenvals
1140-
```
1141-
1142-
More specifically, it is governed by the spectral gap, the difference between the largest and the second largest eigenvalue.
1143-
1144-
```{code-cell} ipython3
1145-
sp_gap_P = P_eigenvals[0] - np.diff(P_eigenvals)[0]
1146-
sp_gap_hamilton = hamilton_eigenvals[0] - np.diff(hamilton_eigenvals)[0]
1147-
1148-
sp_gap_P > sp_gap_hamilton
1149-
```
1150-
1151-
We will come back to this when we discuss {ref}`spectral theory<spec_markov>`.
11521116

11531117
```{solution-end}
11541118
```

0 commit comments

Comments
 (0)