Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lectures/phillips_credibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,9 @@ The forecast $x_t$ depends only on shocks dated $t-1$ and earlier, as it must, b

This is Bray's market of {ref}`br_bray`, written in the notation of this lecture.

* The government's best response $B$ plays the role of the firms' best response $h$.
* The forecast $x_t$ plays the role of the firms' belief $X^*_{t-1}$, formed from data through $t-1$.
* Inflation $y_t$ plays the role of realized average output $X_t$.
* The government's best response $B$ corresponds to the firms' best response $h$.
* The forecast $x_t$ corresponds to the firms' belief $X^*_{t-1}$, formed from data through $t-1$.
* Inflation $y_t$ corresponds to realized average output $X_t$.

The feedback from beliefs to outcomes is

Expand Down
60 changes: 59 additions & 1 deletion lectures/phillips_escaping_nash.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ subject to the *perturbed* mean dynamics
\gamma(0) = \bar\gamma, \; \gamma(T) \notin G .
```

Read {eq}`en_control` as a least squares problem: $v$ is the extra "forcing" that the mean dynamics would need to escape, $Q$ plays the role of a covariance matrix, and the least-cost forcing is the most likely unusual shock sequence.
Read {eq}`en_control` as a least squares problem: $v$ is the extra "forcing" that the mean dynamics would need to escape, $Q$ is the covariance matrix of the noise in the belief updates, and the least-cost forcing is the most likely unusual shock sequence.

{cite:t}`Williams2019` (p. 892) reports that the 2001 version computed $H$ by misapplying a theorem of Worms (1999).

Expand Down Expand Up @@ -769,6 +769,64 @@ This self-reinforcing process halts when the perceived Phillips curve is vertica

The system cannot stay there forever: in truth there *is* a short-run Phillips curve, which the government eventually rediscovers, rekindling the mean dynamics that carry it back to Nash.

Fisher information makes the trap precise.

At the self-confirming equilibrium the residual of the perceived model {eq}`en_belief` has variance $\sigma_1^2$, so each observation carries Fisher information $\bar M(\bar\gamma)/\sigma_1^2$ about $\gamma$, as in {ref}`ppr_natural_gradient`.

The perceived model is right about everything the government sees there ({ref}`sc_why_nash`), so this is also the information in the true data.

```{code-cell} ipython3
fisher = model.M(γ_sce) / model.σ1**2 # Fisher information per observation
eigvals, eigvecs = np.linalg.eigh(fisher)
γ_ramsey = np.array([0.0, model.u]) # Belief 2
d_ramsey = γ_ramsey - γ_sce
v_least = eigvecs[:, 0]
angle = np.degrees(np.arccos(abs(v_least @ d_ramsey) / np.linalg.norm(d_ramsey)))

print(f"Fisher information eigenvalues at the SCE: {eigvals[0]:.4f} and {eigvals[1]:.1f}")
print(f"least-informative direction {v_least.round(4)}, "
f"{angle:.2f} degrees from the Nash-to-Ramsey direction")
print(f"KL rate of the true data from the Ramsey belief: "
f"{0.5 * d_ramsey @ fisher @ d_ramsey:.3f} nats per observation")

K_center = np.array([[1.0, 0.0], [model.x(γ_sce), 1.0]]) # coefficients on (π - θu, 1)
K_inv = np.linalg.inv(K_center)
print(f"eigenvalues with inflation measured from θu: "
f"{np.linalg.eigvalsh(K_inv.T @ fisher @ K_inv).round(4)}")
```

The two eigenvalues differ by a factor of about 7,600.

The eigenvector of the small one points along $(1, -\theta u)$, the direction from the Nash belief $(-\theta, u(1 + \theta^2))$ to the Ramsey belief $(0, u)$.

A move in that direction rotates the perceived Phillips curve about the point $(\pi, U) = (\theta u, u)$ where the data sit.

The Nash curve and the Ramsey curve both predict unemployment $u$ at inflation $\theta u$.

They disagree only about unemployment when inflation is away from $\theta u$, and in a self-confirming equilibrium only the surprise $\sigma_2 W_2$ moves inflation away from $\theta u$.

The data still reject the Ramsey belief.

The KL divergence rate of the true data from the Ramsey belief is $\theta^2 \sigma_2^2 / (2 \sigma_1^2) = 0.5$ nats per observation, so six observations give an expected log likelihood ratio of $3$, the benchmark of {ref}`pmis_ex3`.

The small eigenvalue matters for learning through the noise in the updates.

At the self-confirming equilibrium, an update {eq}`en_rls` with $R = \bar M(\bar\gamma)$ adds noise with covariance $\varepsilon^2 \sigma_1^2 \bar M(\bar\gamma)^{-1}$, which is $\varepsilon^2$ times the inverse of the Fisher information.

So the beliefs jitter most along the direction the data inform least, the line through the Nash and Ramsey beliefs.

{doc}`phillips_priors` finds the same direction as the instantaneous escape direction under its baseline prior, which is proportional to the inverse of the Fisher information ({ref}`ppr_escape_direction`).

The eigenvalues depend on the coordinates in which beliefs are measured.

Measuring inflation from $\theta u$, as in {ref}`ppr_ex7`, makes the Fisher information diagonal, with eigenvalues $1$ and $11.1$.

In those coordinates the move from Nash to Ramsey changes the slope alone, so the slope is still the least-informative coefficient, but the ratio of the eigenvalues falls from about 7,600 to 11.

The large ratio comes from measuring the intercept at $\pi = 0$, five units of inflation away from any data.

The KL divergence between two beliefs does not depend on the coordinates; it is an invariant in the sense of {ref}`ef_invariants`.

(en_simulation)=
## Simulating escapes

Expand Down
2 changes: 1 addition & 1 deletion lectures/phillips_learning.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ $$
The inner sum averages the innovations over a block of length $N$; the double limit lets us treat serially dependent innovations.
```

Second, the **Legendre transform** of $H$, which plays the role of a rate function:
Second, the **Legendre transform** of $H$, the rate function for averages of the innovations:

```{math}
:label: pl_legendre
Expand Down
35 changes: 35 additions & 0 deletions lectures/phillips_misspecified.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,33 @@ The fixed point $C = B(C)$ has several names in the later literature, each empha

There the agents' fit is a least squares projection onto a basis; here it is a nonlinear fit of an ARMA model across the whole spectrum.

The two parts of the fit differ geometrically.

For a fixed $c$, the perceived models with different $\sigma_\epsilon^2$ form an exponential family with natural parameter $1/\sigma_\epsilon^2$.

So {eq}`pm_sigma2` is a moment-matching condition, and the Pythagorean identity {eq}`ip_pythagoras_m` holds along $\sigma_\epsilon^2$: the divergence rate of the true process from any model in that family equals its divergence rate from the fitted model plus the divergence rate of the fitted model from the other one.

The perceived models with different $c$ form a curved family, so the identity fails along $c$, and the choice of $c$ is a nonlinear fit.

```{code-cell} ipython3
def kl_rate(F, ν, G):
"KL divergence rate of a process (mean ν, spectrum F) from a mean-zero model with spectrum G."
r = F / G
return 0.5 * (np.mean(r - 1 - np.log(r)) + ν**2 / G[0])

G_fit = bray.approx_spectrum(c_star, σ_bar**2)
D_fit = kl_rate(F_star, bray.ν, G_fit)

print(f"{'model':>11s} {'D(true ‖ model)':>16s} {'D(true ‖ fit) + D(fit ‖ model)':>32s}")
for label, c, s2 in [("σ² halved", c_star, σ_bar**2 / 2), ("σ² doubled", c_star, 2 * σ_bar**2),
("c halved", c_star / 2, σ_bar**2), ("c doubled", 2 * c_star, σ_bar**2)]:
G = bray.approx_spectrum(c, s2)
print(f"{label:>11s} {kl_rate(F_star, bray.ν, G):16.5f} "
f"{D_fit + kl_rate(G_fit, 0.0, G):32.5f}")
```

The two columns agree when only $\sigma_\epsilon^2$ moves and disagree when $c$ moves.

Because $B$ works like a best-response map, we can ask whether agents who nudge their gain toward the best estimate would find the equilibrium.

The associated differential equation $dC/d\tau = B(C) - C$ is the E-stability condition of {ref}`br_one_recursion`: the fixed point is E-stable when $B'(C^*) < 1$.
Expand Down Expand Up @@ -702,10 +729,18 @@ e_model = lfilter([1, -bray.ρ], [1, -(1 - c_star)], p)
llr = (-np.log(σ_true) - e_true**2 / (2 * σ_true**2)) \
- (-np.log(σ_bar) - e_model**2 / (2 * σ_bar**2))
print(f"simulated mean log-likelihood ratio = {llr[burn:].mean():.4f}")

mean_term = 0.5 * bray.ν**2 / G_fit[0]
total = kl_rate(F_star, bray.ν, G_fit)
print(f"mean term {mean_term:.4f} of {total:.4f} nats ({mean_term / total:.0%})")
```

The divergence is about $0.015$ nats per observation, so it takes roughly two hundred observations before the data favor the true model by a likelihood ratio of about 20, and that is for a statistician who already knows which alternative to test.

The mean term $\nu^2/(2G(0))$ accounts for 45% of the rate.

Almost half of what separates the true process from the perceived model comes from the model's use of second moments to fit a first moment.

```{solution-end}
```

Expand Down
3 changes: 2 additions & 1 deletion lectures/phillips_priors.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ the counterpart for this model of the algebraic Riccati equation in {ref}`kalman

Following {cite:t}`SargentWilliams2005`, we index the size of the drift by a scalar $\varepsilon$, writing $V = \varepsilon^2 \hat V$ for a fixed matrix $\hat V$.

Equation {eq}`pp_riccati` then makes $P$ proportional to $\varepsilon / \sigma$, so $\varepsilon$ plays the role of the constant gain of {doc}`phillips_learning`.
Equation {eq}`pp_riccati` then makes $P$ proportional to $\varepsilon / \sigma$, so $\varepsilon$ sets the speed of updating, as the constant gain does in {doc}`phillips_learning`.

Most of our calculations use $\varepsilon = 0.05$, the largest gain in Tables 1 and 2 of {cite:t}`SargentWilliams2005`; when we compare with constant-gain least squares we use the gain $0.02$ of {ref}`olg_phillips`, and Sims's example carries its own, much larger, drift.

Expand Down Expand Up @@ -587,6 +587,7 @@ For the baseline prior, {cite:t}`SargentWilliams2005` compute a large-deviation

At those gains, escapes from a stable self-confirming equilibrium recur on the same time scale as this cycle turns over, and {ref}`ppr_ex4` shows that a simulated time series can hardly tell the two apart.

(ppr_escape_direction)=
## Escape dynamics and the direction of escape

For priors that keep the self-confirming equilibrium stable, disinflations are escapes.
Expand Down
90 changes: 89 additions & 1 deletion lectures/phillips_self_confirming.md
Original file line number Diff line number Diff line change
Expand Up @@ -633,10 +633,14 @@ Its reported numbers are reproduced with $\sigma_2 = 1$, which is also consisten

We use $\sigma_2 = 1$.

The choice matters because the fitting criterion is not scale-invariant.
The choice matters because the fit depends on the size of $\sigma_2$ relative to the mean.

The criterion of {doc}`phillips_misspecified` equals $\sigma_2^2$ times a function of $c$ that depends on $\sigma_2$ only through the ratio $\nu/\sigma_2$ of the mean that the perceived model must fit to the size of the surprises.

Measuring inflation and unemployment in other units scales $U^*$, $\nu$, and $\sigma_2$ together, leaves that ratio alone, and leaves the equilibrium gain unchanged, as it must, because minimizing the criterion is the same as minimizing a KL divergence rate ({doc}`approximation_errors`), and a KL divergence does not depend on the units of the data.

Changing $\sigma_2$ with $U^*$ fixed changes the ratio, and so describes a different economy.

A smaller $\sigma_2$ makes the mean relatively larger, which pushes the public toward a larger gain and so, by {eq}`sc_nu`, lowers mean inflation.

```{code-cell} ipython3
Expand All @@ -651,6 +655,10 @@ print(f"Nash inflation θ U* = {mp.θ * mp.U_star:.3f}")

C_03, ν_03, _ = MisspecifiedPhillips(δ=0.97, σ2=0.3).solve()
print(f"\nwith σ2 = 0.3: C = {C_03:.4f}, mean inflation = {ν_03:.3f}")

C_10, ν_10, _ = MisspecifiedPhillips(δ=0.97, U_star=50.0, σ2=10.0).solve()
print(f"units one-tenth as large (U* = 50, σ2 = 10): C = {C_10:.4f}, "
f"mean inflation = {ν_10:.3f}")
```

With $\sigma_2 = 1$, these are the values that chapter 7 of {cite:t}`Sargent1999` reports.
Expand Down Expand Up @@ -1063,3 +1071,83 @@ The claim that the equilibrium approaches Ramsey as the government becomes patie

```{solution-end}
```

```{exercise-start}
:label: sc_ex4
```

Each direction of fit is an m-projection, in the sense of {doc}`information_projections`, of a different conditional distribution.

The classical fit projects the true distribution of $U_t$ given $y_t$, and the Keynesian fit projects the true distribution of $y_t$ given $U_t$.

With Gaussian shocks, each projection is exact in its own static self-confirming equilibrium: the fitted regression is the true conditional distribution.

The Keynesian government acts on the inverted curve {eq}`sc_invert`, a model of $U_t$ given $y_t$ with slope $\beta_1^{-1}$, intercept $-\beta_{-1}/\beta_1$, and residual variance $\mathbb{V}[\varepsilon_{K,t}]/\beta_1^2$.

1. In the static Keynesian self-confirming equilibrium, show that the KL divergence rate of the true conditional distribution of $U_t$ given $y_t$ from the inverted curve is $\frac12 \log\left(1 + \sigma_1^2/(\theta^2 \sigma_2^2)\right)$, and that this equals $\frac12 \log(\bar y_K / \theta U^*)$.
2. Compute it for the baseline parameters, and the number of observations it takes for the expected log likelihood ratio to reach 3. Compare with {ref}`pmis_ex3`.
3. Confirm the rate by simulation.

```{exercise-end}
```

```{solution-start} sc_ex4
:class: dropdown
```

In the Keynesian equilibrium, inflation is $y_t = \bar y_K + v_{2t}$ and unemployment is $U_t = U^* - \theta v_{2t} + v_{1t}$.

So the true distribution of $U_t$ given $y_t$ is normal, with mean $U^* - \theta(y_t - \bar y_K)$ and variance $\sigma_1^2$.

The inverted curve passes through the means $(\bar y_K, U^*)$, because the Keynesian regression does.

By the formula for $\beta_1$, its slope differs from the true slope by $\beta_1^{-1} + \theta = -\sigma_1^2/(\theta \sigma_2^2)$.

The residual variance of the Keynesian regression is $\mathbb{V}[y_t] - \beta_1^2 \mathbb{V}[U_t] = \sigma_1^2 \sigma_2^2 / (\sigma_1^2 + \theta^2 \sigma_2^2)$, so the residual variance of the inverted curve is

$$
s^2 = \frac{\sigma_1^2 (\sigma_1^2 + \theta^2 \sigma_2^2)}{\theta^2 \sigma_2^2}
= \sigma_1^2 + (\beta_1^{-1} + \theta)^2 \sigma_2^2 .
$$

The KL divergence of $N(m_0, \sigma_1^2)$ from $N(m_1, s^2)$ is $\frac12 \left[\log(s^2/\sigma_1^2) + (\sigma_1^2 + (m_0 - m_1)^2)/s^2 - 1\right]$.

Averaged over $y_t$, the squared gap between the two means is $(\beta_1^{-1} + \theta)^2 \sigma_2^2$, so the last two terms cancel, and the rate is

$$
\frac12 \log \frac{s^2}{\sigma_1^2} = \frac12 \log\left(1 + \frac{\sigma_1^2}{\theta^2 \sigma_2^2}\right) .
$$

By {eq}`sc_ykeynes`, the argument of the logarithm is $\bar y_K / \theta U^*$.

```{code-cell} ipython3
θ, U_star, σ1, σ2 = sce.θ, sce.U_star, sce.σ1, sce.σ2
γ1_K, γ0_K, y_K = sce.keynesian()
s2 = σ1**2 * (σ1**2 + θ**2 * σ2**2) / (θ**2 * σ2**2)

kl_K = 0.5 * np.log(1 + σ1**2 / (θ**2 * σ2**2))
print(f"KL rate = {kl_K:.4f} nats per observation, "
f"½ log(ȳ_K / θU*) = {0.5 * np.log(y_K / (θ * U_star)):.4f}")
print(f"observations for an expected log likelihood ratio of 3: {3 / kl_K:.1f}")

rng = np.random.default_rng(2)
n = 1_000_000
v1, v2 = σ1 * rng.standard_normal(n), σ2 * rng.standard_normal(n)
y, U = y_K + v2, U_star - θ * v2 + v1
m_true = U_star - θ * (y - y_K) # true mean of U given y
m_inv = γ0_K + γ1_K * y # mean under the inverted curve
llr = (-0.5 * np.log(σ1**2) - (U - m_true)**2 / (2 * σ1**2)) \
- (-0.5 * np.log(s2) - (U - m_inv)**2 / (2 * s2))
print(f"simulated mean log likelihood ratio = {llr.mean():.4f}")
```

The divergence is about $0.35$ nats per observation, so about nine observations give an expected log likelihood ratio of 3.

The agents' misspecified model in {ref}`pmis_ex3` needs about two hundred.

A Keynesian government that tested the curve it acts on, by fitting its own data in the classical direction, would reject that curve quickly.

As $\sigma_1 \to 0$ the rate goes to zero, and so does the excess of Keynesian over Nash inflation in {ref}`sc_ex1`.

```{solution-end}
```
Loading