Skip to content

Commit

Permalink
[markov_markov_II] Fix prf:theorem in markov_chains_II (#556)
Browse files Browse the repository at this point in the history
* fix `prf:theorem` in markov_chains_II

* fix a small bug in indexing for prob_dist
  • Loading branch information
HumphreyYang authored Nov 3, 2024
1 parent 655a9fc commit 1f23a64
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions lectures/markov_chains_II.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ that
The stochastic matrix $P$ is called **irreducible** if all states communicate;
that is, if $x$ and $y$ communicate for all $(x, y)$ in $S \times S$.

```{prf:example}
````{prf:example}
:label: mc2_ex_ir
For example, consider the following transition probabilities for wealth of a
fictitious set of households
Expand All @@ -81,8 +81,6 @@ fictitious set of households
:align: center
```


We can translate this into a stochastic matrix, putting zeros where
there's no edge between nodes
Expand All @@ -97,7 +95,7 @@ $$
It's clear from the graph that this stochastic matrix is irreducible: we can eventually
reach any state from any other state.
```
````

We can also test this using [QuantEcon.py](http://quantecon.org/quantecon-py)'s MarkovChain class

Expand All @@ -110,7 +108,7 @@ mc = qe.MarkovChain(P, ('poor', 'middle', 'rich'))
mc.is_irreducible
```

```{prf:example}
````{prf:example}
:label: mc2_ex_pf
Here's a more pessimistic scenario in which poor people remain poor forever
Expand All @@ -122,7 +120,7 @@ Here's a more pessimistic scenario in which poor people remain poor forever
This stochastic matrix is not irreducible since, for example, rich is not
accessible from poor.
```
````

Let's confirm this

Expand Down Expand Up @@ -279,7 +277,7 @@ In any of these cases, ergodicity will hold.

### Example: a periodic chain

```{prf:example}
````{prf:example}
:label: mc2_ex_pc
Let's look at the following example with states 0 and 1:
Expand All @@ -301,7 +299,8 @@ The transition graph shows that this model is irreducible.
```
Notice that there is a periodic cycle --- the state cycles between the two states in a regular way.
```
````

Not surprisingly, this property
is called [periodicity](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/16%3A_Markov_Processes/16.05%3A_Periodicity_of_Discrete-Time_Chains).

Expand Down
2 changes: 1 addition & 1 deletion lectures/prob_dist.md
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ x_costco = prices.pct_change()[1:] * 100

```{code-cell} ipython3
fig, ax = plt.subplots()
ax.violinplot([x_amazon, x_costco])
ax.violinplot([x_amazon['AMZN'], x_costco['COST']])
ax.set_ylabel('monthly return (percent change)')
ax.set_xlabel('retailers')
Expand Down

1 comment on commit 1f23a64

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.