Skip to content

Commit dd9fd01

Browse files
Smit-createkp992mmcky
authored
MAINT: Fix small typos (#362)
* Remove `matplotlib inline` * Uncomment pip install cell * Fix a typo * Remove unused pip install * Fix a typo * Remove unused quantecon installation * Use pip install for other libraries * Remove unused install * TMP: disable build cache for a full execution run to test * add back in cache * remove +++ demarkers --------- Co-authored-by: kp992 <[email protected]> Co-authored-by: mmcky <[email protected]>
1 parent 3dbdccd commit dd9fd01

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+689
-808
lines changed

lectures/aiyagari.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ The Aiyagari model has been used to investigate many topics, including
5555
Let's start with some imports:
5656

5757
```{code-cell} ipython
58-
%matplotlib inline
5958
import matplotlib.pyplot as plt
6059
plt.rcParams["figure.figsize"] = (11, 5) #set default figure size
6160
import numpy as np

lectures/ar1_bayes.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ import jax.numpy as jnp
3434
from jax import random
3535
import matplotlib.pyplot as plt
3636
37-
%matplotlib inline
38-
3937
import logging
4038
logging.basicConfig()
4139
logger = logging.getLogger('pymc')
@@ -71,7 +69,7 @@ $$ (eq:themodel_2)
7169
7270
7371
74-
Consider a sample $\{y_t\}_{t=0}^T$ governed by this statistical model.
72+
Consider a sample $\{y_t\}_{t=0}^T$ governed by this statistical model.
7573
7674
The model
7775
implies that the likelihood function of $\{y_t\}_{t=0}^T$ can be **factored**:
@@ -80,7 +78,7 @@ $$
8078
f(y_T, y_{T-1}, \ldots, y_0) = f(y_T| y_{T-1}) f(y_{T-1}| y_{T-2}) \cdots f(y_1 | y_0 ) f(y_0)
8179
$$
8280
83-
where we use $f$ to denote a generic probability density.
81+
where we use $f$ to denote a generic probability density.
8482
8583
The statistical model {eq}`eq:themodel`-{eq}`eq:themodel_2` implies
8684
@@ -95,7 +93,7 @@ We want to study how inferences about the unknown parameters $(\rho, \sigma_x)$
9593
9694
Below, we study two widely used alternative assumptions:
9795
98-
- $(\mu_0,\sigma_0) = (y_0, 0)$ which means that $y_0$ is drawn from the distribution ${\mathcal N}(y_0, 0)$; in effect, we are **conditioning on an observed initial value**.
96+
- $(\mu_0,\sigma_0) = (y_0, 0)$ which means that $y_0$ is drawn from the distribution ${\mathcal N}(y_0, 0)$; in effect, we are **conditioning on an observed initial value**.
9997
10098
- $\mu_0,\sigma_0$ are functions of $\rho, \sigma_x$ because $y_0$ is drawn from the stationary distribution implied by $\rho, \sigma_x$.
10199
@@ -105,20 +103,20 @@ Below, we study two widely used alternative assumptions:
105103
106104
Unknown parameters are $\rho, \sigma_x$.
107105
108-
We have independent **prior probability distributions** for $\rho, \sigma_x$ and want to compute a posterior probability distribution after observing a sample $\{y_{t}\}_{t=0}^T$.
106+
We have independent **prior probability distributions** for $\rho, \sigma_x$ and want to compute a posterior probability distribution after observing a sample $\{y_{t}\}_{t=0}^T$.
109107
110108
The notebook uses `pymc4` and `numpyro` to compute a posterior distribution of $\rho, \sigma_x$. We will use NUTS samplers to generate samples from the posterior in a chain. Both of these libraries support NUTS samplers.
111109
112110
NUTS is a form of Monte Carlo Markov Chain (MCMC) algorithm that bypasses random walk behaviour and allows for convergence to a target distribution more quickly. This not only has the advantage of speed, but allows for complex models to be fitted without having to employ specialised knowledge regarding the theory underlying those fitting methods.
113111
114112
Thus, we explore consequences of making these alternative assumptions about the distribution of $y_0$:
115113
116-
- A first procedure is to condition on whatever value of $y_0$ is observed. This amounts to assuming that the probability distribution of the random variable $y_0$ is a Dirac delta function that puts probability one on the observed value of $y_0$.
114+
- A first procedure is to condition on whatever value of $y_0$ is observed. This amounts to assuming that the probability distribution of the random variable $y_0$ is a Dirac delta function that puts probability one on the observed value of $y_0$.
117115
118116
- A second procedure assumes that $y_0$ is drawn from the stationary distribution of a process described by {eq}`eq:themodel`
119117
so that $y_0 \sim {\cal N} \left(0, {\sigma_x^2\over (1-\rho)^2} \right) $
120118
121-
When the initial value $y_0$ is far out in a tail of the stationary distribution, conditioning on an initial value gives a posterior that is **more accurate** in a sense that we'll explain.
119+
When the initial value $y_0$ is far out in a tail of the stationary distribution, conditioning on an initial value gives a posterior that is **more accurate** in a sense that we'll explain.
122120
123121
Basically, when $y_0$ happens to be in a tail of the stationary distribution and we **don't condition on $y_0$**, the likelihood function for $\{y_t\}_{t=0}^T$ adjusts the posterior distribution of the parameter pair $\rho, \sigma_x $ to make the observed value of $y_0$ more likely than it really is under the stationary distribution, thereby adversely twisting the posterior in short samples.
124122
@@ -129,7 +127,7 @@ We begin by solving a **direct problem** that simulates an AR(1) process.
129127
130128
How we select the initial value $y_0$ matters.
131129
132-
* If we think $y_0$ is drawn from the stationary distribution ${\mathcal N}(0, \frac{\sigma_x^{2}}{1-\rho^2})$, then it is a good idea to use this distribution as $f(y_0)$. Why? Because $y_0$ contains information about $\rho, \sigma_x$.
130+
* If we think $y_0$ is drawn from the stationary distribution ${\mathcal N}(0, \frac{\sigma_x^{2}}{1-\rho^2})$, then it is a good idea to use this distribution as $f(y_0)$. Why? Because $y_0$ contains information about $\rho, \sigma_x$.
133131
134132
* If we suspect that $y_0$ is far in the tails of the stationary distribution -- so that variation in early observations in the sample have a significant **transient component** -- it is better to condition on $y_0$ by setting $f(y_0) = 1$.
135133
@@ -273,7 +271,7 @@ summary_y0
273271
274272
Please note how the posterior for $\rho$ has shifted to the right relative to when we conditioned on $y_0$ instead of assuming that $y_0$ is drawn from the stationary distribution.
275273
276-
Think about why this happens.
274+
Think about why this happens.
277275
278276
```{hint}
279277
It is connected to how Bayes Law (conditional probability) solves an **inverse problem** by putting high probability on parameter values

lectures/ar1_processes.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ Let's start with some imports:
4747

4848
```{code-cell} ipython
4949
import numpy as np
50-
%matplotlib inline
5150
import matplotlib.pyplot as plt
5251
plt.rcParams["figure.figsize"] = (11, 5) #set default figure size
5352
```

0 commit comments

Comments
 (0)