GitHub

@@ -65,7 +65,7 @@ Thus, we change the specification in [](likelihood_bayes) in the following way.

6565

Now, **each period** $t \geq 0$, nature flips a possibly unfair coin that comes up $f$ with probability $\alpha$

6666

and $g$ with probability $1 -\alpha$.

676768-

Thus, nature perpetually draws from the **mixture distribution** with c.d.f.

68+

Thus, nature perpetually draws from the **mixture distribution** with CDF

69697070

$$

7171

H(w) = \alpha F(w) + (1-\alpha) G(w), \quad \alpha \in (0,1)

@@ -220,7 +220,7 @@ Here is pseudo code for a direct "method 1" for drawing from our compound lotter

220220221221

Our second method uses a uniform distribution and the following fact that we also described and used in [](prob_matrix):

222222223-

* If a random variable $X$ has c.d.f. $F$, then a random variable $F^{-1}(U)$ also has c.d.f. $F$, where $U$ is a uniform random variable on $[0,1]$.

223+

* If a random variable $X$ has CDF $F$, then a random variable $F^{-1}(U)$ also has CDF $F$, where $U$ is a uniform random variable on $[0,1]$.

224224225225

In other words, if $X \sim F(x)$ we can generate a random sample from $F$ by drawing a random sample from

226226

a uniform distribution on $[0,1]$ and computing $F^{-1}(U)$.

@@ -267,6 +267,12 @@ def draw_lottery_MC(key, p, N):

267267

```

268268269269

```{code-cell} ipython3

270+

---

271+

mystnb:

272+

figure:

273+

caption: Direct and Monte Carlo draws

274+

name: fig-lottery-draws

275+

---

270276

# verify

271277

N = 100000

272278

α = 0.0

@@ -457,6 +463,12 @@ def plot_π_seq(key, α, π1=0.2, π2=0.8, T=200):

457463

```

458464459465

```{code-cell} ipython3

466+

---

467+

mystnb:

468+

figure:

469+

caption: Belief paths, $\alpha = 0.6$

470+

name: fig-pi-seq-1

471+

---

460472

plot_π_seq(jax.random.key(42), α=0.6)

461473

```

462474

@@ -467,6 +479,12 @@ sample paths of $\pi_t$ that start from two distinct initial conditions.

467479

Let's see what happens when we change $\alpha$.

468480469481

```{code-cell} ipython3

482+

---

483+

mystnb:

484+

figure:

485+

caption: Belief paths, $\alpha = 0.2$

486+

name: fig-pi-seq-2

487+

---

470488

plot_π_seq(jax.random.key(42), α=0.2)

471489

```

472490

@@ -568,6 +586,12 @@ def π_lim(key, α, T=5000, π_0=0.4):

568586

Let us first plot the KL divergences $KL_g\left(\alpha\right), KL_f\left(\alpha\right)$ for each $\alpha$.

569587570588

```{code-cell} ipython3

589+

---

590+

mystnb:

591+

figure:

592+

caption: KL divergences against $\alpha$

593+

name: fig-kl

594+

---

571595

α_arr = np.linspace(0, 1, 100)

572596

KL_g_arr = KL_g_v(α_arr)

573597

KL_f_arr = KL_f_v(α_arr)

@@ -598,6 +622,12 @@ recorded on the $x$ axis.

598622

Thus, the graph below confirms how a minimum KL divergence governs what our type 1 agent eventually learns.

599623600624

```{code-cell} ipython3

625+

---

626+

mystnb:

627+

figure:

628+

caption: Limit points and KL divergences

629+

name: fig-kl-limit

630+

---

601631

α_arr_x = α_arr[(α_arr < discretion) | (α_arr > discretion)]

602632

keys = jax.random.split(jax.random.key(42), len(α_arr_x))

603633

π_lim_arr = π_lim_v(keys, α_arr_x)

@@ -710,6 +740,12 @@ def MCMC_run(ws):

710740

The following code generates the graph below that displays Bayesian posteriors for $\alpha$ at various history lengths.

711741712742

```{code-cell} ipython3

743+

---

744+

mystnb:

745+

figure:

746+

caption: Posterior for $\alpha$ as $t$ grows

747+

name: fig-posterior-alpha

748+

---

713749

fig, ax = plt.subplots()

714750715751

for i in range(len(sizes)):

Read the original on github.com ↗