45. Matching a Ramsey Model to a Descriptive Model#

45.1. Overview#

Sargent and Yang [2026] study three growth miracles: China after 1984, Singapore after 1966, and South Korea after 1963.

They conduct a two-stage specification search in the spirit of Leamer [1978].

The first stage fits a scalar additive-functional model to annual growth rates of per capita GDP.

That model is descriptive: its parameters compress the data and answer no economic question.

The second stage chooses parameters of a Brock and Mirman [1972] stochastic optimal growth model to make three moments of the growth rates that it simulates match the corresponding moments of the fitted descriptive model.

Koopmans [1947] separates the two stages, the first a “Kepler stage” summary of the data, the second a “Newton stage” model of preferences and technologies.

Sargent and Yang open by describing what a specification search ranges over:

A manifold of statistical models is swept out as we vary the parameter vector within a set of possible values.

This lecture computes the second stage as an information projection onto that manifold.

  • The descriptive model makes the \(T\) growth rates jointly normal with mean \(\nu + \phi^t x_0\) and covariance \(LL^\top\), where \(L\) is lower triangular with \(F\) on its diagonal and \(B\phi^{i-1-j}\) below it. Its log determinant is \(2T\log F\), and the model’s own recursion applies \(L^{-1}\).

  • The m-projection onto that family, in the sense of Information Projections, depends on the Ramsey model only through the mean vector and covariance matrix of its growth rates. Concentrating out \(\nu\), \(x_0\), and \(F\) leaves a two-dimensional search over \(\phi\) and \(B/F\).

  • The map from the Ramsey model’s parameters to the projection is the binding function of Gourieroux et al. [1993]. Choosing those parameters to bring the projection to the descriptive fit is the indirect inference that Which Moments to Match? describes.

  • The divergence criterion and Sargent and Yang’s three moments deliver almost the same TFP growth rate and shock volatility, and they differ in initial capital. For China they give \(4.78\) against \(4.59\) percent, \(0.022\) against \(0.022\), and \(1.04\) against \(0.81\).

  • A large divergence survives at every parameter value. Deviations of growth from its fitted mean path are negatively autocorrelated in the Ramsey model, about \(-0.48\) at lag one, and positively autocorrelated in China’s data, \(+0.57\).

  • The projection therefore sets \(B=0\) throughout the region our estimates visit, at a boundary of the descriptive model’s parameter space. Released from the restriction \(B \geq 0\), it chooses \(B<0\).

  • That one restriction accounts for \(94\) percent of the divergence that remains for China, \(92\) percent for South Korea, and \(56\) percent for Singapore. The three moments that Sargent and Yang match contain no autocovariance, so their criterion is silent about it.

  • How firmly the data demand \(B>0\) differs across the three economies. China’s likelihood peaks near its posterior median and pays \(5.5\) log points at \(B=0\); Singapore’s and South Korea’s likelihoods peak at \(B = 0\), and their posterior medians are positive because the prior puts no mass below zero. The discrepancy is sharp for China alone.

  • A likelihood ratio between the best descriptive model and the one the Ramsey model projects onto, with its null distribution simulated from the Ramsey model, rejects the model for China and South Korea and not for Singapore. Two thirds of China’s statistic comes from \(B\) and none of South Korea’s does, so the test and the divergence disagree about what the model gets wrong in South Korea.

The lecture proceeds as follows.

The lecture builds on Information Projections, Which Moments to Match?, and Turbulence, Earnings Instability, and Indirect Inference.

Exponential Family and Maximum Entropy describes the Gaussian family that the descriptive model sits inside, Statistical Divergence Measures the Kullback–Leibler divergence in which we measure every distance below, and Likelihood Ratio Processes the likelihood ratios that the divergence governs and that our specification test computes.

Additive and Multiplicative Functionals studies the class of models that the first stage uses, Optimal Growth Under Uncertainty and Tobin’s q and Cass-Koopmans Model the growth model that the second stage uses, and Posterior Distributions for AR(1) Parameters the Bayesian methods that Sargent and Yang apply in the first stage.

We use the following imports.

import numpy as np
import matplotlib.pyplot as plt
from collections import namedtuple
from numpy.polynomial.hermite import hermgauss
from scipy.optimize import minimize
from scipy.stats import norm, chi2

45.2. Growth facts#

Sargent and Yang use real GDP per capita in constant 2015 US dollars, series NY.GDP.PCAP.KD of the World Bank’s World Development Indicators.

The table below holds the snapshot that they froze for their replication package.

Hide code cell source

# World Bank NY.GDP.PCAP.KD, constant 2015 US$: China, Singapore, South Korea, US
GDP_PC = {
    1960: (241.39, 3611.95, 1037.73, 18899.16),
    1961: (177.35, 3777.39, 1077.10, 19015.98),
    1962: (166.09, 3951.76, 1087.79, 19868.02),
    1963: (178.75, 4239.99, 1153.23, 20445.84),
    1964: (206.40, 4004.46, 1229.37, 21333.30),
    1965: (235.70, 4214.51, 1286.17, 22416.62),
    1966: (253.64, 4529.53, 1404.84, 23599.57),
    1967: (232.94, 4984.78, 1498.01, 23927.60),
    1968: (217.63, 5562.32, 1657.19, 24826.99),
    1969: (247.62, 6237.25, 1856.48, 25347.71),
    1970: (287.36, 6997.20, 2001.05, 25108.39),
    1971: (299.31, 7722.86, 2170.96, 25609.29),
    1972: (303.17, 8590.61, 2286.94, 26668.17),
    1973: (319.33, 9325.57, 2583.31, 27906.14),
    1974: (320.02, 9732.73, 2784.47, 27502.85),
    1975: (341.84, 9974.22, 2955.20, 27177.02),
    1976: (331.30, 10572.57, 3294.13, 28370.46),
    1977: (351.56, 11141.58, 3644.59, 29385.32),
    1978: (386.17, 11863.69, 3987.00, 30685.00),
    1979: (409.98, 12834.16, 4270.07, 31309.05),
    1980: (436.59, 13953.89, 4139.96, 30930.42),
    1981: (453.07, 14737.30, 4377.64, 31405.61),
    1982: (486.89, 15106.25, 4675.53, 30546.76),
    1983: (531.39, 16186.91, 5227.54, 31656.17),
    1984: (604.35, 17280.37, 5712.64, 33654.31),
    1985: (676.28, 17149.32, 6105.74, 34748.27),
    1986: (725.83, 17396.03, 6740.70, 35620.76),
    1987: (797.34, 18986.75, 7535.13, 36523.40),
    1988: (872.66, 20595.98, 8367.05, 37705.06),
    1989: (895.53, 22031.90, 8878.30, 38722.25),
    1990: (917.27, 23272.70, 9672.58, 39009.37),
    1991: (989.55, 24132.72, 10618.84, 38449.88),
    1992: (1117.27, 24973.43, 11176.56, 39256.05),
    1993: (1258.35, 27139.95, 11837.47, 39807.88),
    1994: (1406.86, 29220.27, 12817.24, 40907.02),
    1995: (1545.19, 30379.90, 13924.30, 41507.91),
    1996: (1681.63, 31349.32, 14894.33, 42575.69),
    1997: (1819.10, 32835.25, 15682.27, 43936.91),
    1998: (1944.44, 31043.11, 14800.51, 45374.62),
    1999: (2076.82, 32557.05, 16402.92, 47004.47),
    2000: (2237.44, 34890.08, 17763.14, 48379.76),
    2001: (2405.89, 33597.87, 18460.43, 48361.02),
    2002: (2610.73, 34598.83, 19775.38, 48729.16),
    2003: (2857.04, 36709.80, 20278.04, 49662.75),
    2004: (3127.86, 39856.64, 21244.81, 51098.56),
    2005: (3465.82, 41798.49, 22123.76, 52393.45),
    2006: (3883.35, 44159.41, 23162.19, 53335.59),
    2007: (4409.76, 46178.81, 24391.77, 53889.40),
    2008: (4811.47, 44601.58, 24934.54, 53442.71),
    2009: (5237.77, 43331.87, 25009.91, 51611.32),
    2010: (5764.87, 48752.05, 26623.05, 52555.77),
    2011: (6275.91, 50713.53, 27393.46, 52956.66),
    2012: (6723.19, 51679.35, 27944.06, 53738.15),
    2013: (7198.07, 53298.97, 28732.71, 54462.63),
    2014: (7686.58, 54681.93, 29470.67, 55394.45),
    2015: (8175.33, 55645.61, 30171.79, 56572.92),
    2016: (8679.38, 56986.79, 31005.41, 57151.47),
    2017: (9221.51, 59485.30, 31979.90, 58151.70),
    2018: (9798.65, 61250.35, 32852.89, 59526.67),
    2019: (10356.48, 61345.53, 33496.31, 60750.99),
    2020: (10573.64, 59189.70, 33215.93, 59194.67),
    2021: (11469.57, 67731.26, 34792.94, 62680.25),
    2022: (11830.60, 68218.81, 35809.01, 63886.13),
    2023: (12484.16, 66167.36, 36347.70, 65186.60),
}

CODES = ("CHN", "SGP", "KOR", "USA")
NAMES = {"CHN": "China", "SGP": "Singapore", "KOR": "South Korea", "USA": "United States"}
START = {"CHN": 1984, "SGP": 1966, "KOR": 1963}

years = np.array(sorted(GDP_PC))
levels = {c: np.array([GDP_PC[y][i] for y in years]) for i, c in enumerate(CODES)}
log_levels = {c: np.log(v) for c, v in levels.items()}
growth = {c: np.diff(v) for c, v in log_levels.items()}

Sargent and Yang date each miracle from a reform.

China’s starts in 1984, the year of the Decision on Economic Structural Reform.

Singapore’s starts in 1966, its first full year of independence.

South Korea’s starts in 1963, the first year of Park Chung-hee’s presidency.

For an economy whose episode starts at \(\tau^*\), write \(\ell_\tau\) for log GDP per capita and

\[ y_t = \ell_{\tau^* + t} - \ell_{\tau^*}, \qquad t = 0, 1, \ldots, T , \]

so that \(y_0 = 0\) and \(\Delta y_{t+1} = y_{t+1} - y_t\) is the growth rate between \(t\) and \(t+1\).

def episode(code):
    "Growth rates of normalized log GDP per capita, from the miracle start year."
    t0 = np.where(years == START[code])[0][0]
    y = log_levels[code][t0:] - log_levels[code][t0]
    return np.diff(y)

data = {c: episode(c) for c in START}
us_growth = growth["USA"].mean()

print(f"US mean growth, 1961-2023: {us_growth:.4f}\n")
print(f"{'':14}{'T':>4}{'mean':>9}{'std':>8}{'first':>8}{'lag-1 autocorr':>16}")
for c, dy in data.items():
    ac1 = np.corrcoef(dy[:-1], dy[1:])[0, 1]
    print(f"{NAMES[c]:14}{len(dy):4d}{dy.mean():9.4f}{dy.std(ddof=1):8.4f}"
          f"{dy[0]:8.4f}{ac1:16.3f}")
US mean growth, 1961-2023: 0.0197

                 T     mean     std   first  lag-1 autocorr
China           39   0.0776  0.0261  0.1125           0.548
Singapore       57   0.0470  0.0428  0.0958           0.245
South Korea     60   0.0575  0.0364  0.0639           0.362

Growth rates in all three economies far exceed the US rate of about two percent per year, and they fall toward it.

Growth rates in all three economies are positively autocorrelated.

fig, ax = plt.subplots()
for c in START:
    g = growth[c]
    ma = np.convolve(g, np.ones(5) / 5, mode="valid")
    ax.plot(years[1:][2:-2], ma, lw=2, label=NAMES[c])
    ax.axvline(START[c], color="0.8", lw=0.8, zorder=0)
ax.axhline(us_growth, color="k", ls="--", lw=1.2,
           label=f"US mean, 1961–2023 ({us_growth:.3f})")
ax.axhline(0, color="0.7", lw=0.8)
ax.set_xlabel("year")
ax.set_ylabel("growth rate of per capita GDP")
ax.legend()
plt.show()
_images/c77dafc9ce937e8591b52720e0af7203c6b4653e4038155788d9b89a0f00f937.png

Fig. 45.1 Per capita GDP growth, five-year moving averages#

45.3. The descriptive model#

Sargent and Yang’s descriptive model is a scalar additive functional of the kind that Additive and Multiplicative Functionals studies:

(45.1)#\[\begin{split}\begin{aligned} x_{t+1} &= \phi x_t + B z_{t+1} , \\ \Delta y_{t+1} &= \nu + x_t + F z_{t+1} , \end{aligned}\end{split}\]

where \(z_{t+1} \sim \mathcal{N}(0,1)\) are i.i.d., \(0 < \phi < 1\), \(B \geq 0\), and \(F > 0\).

The parameter \(\nu\) is the long-run growth rate; \(x_t\) is a transient growth gap; \(\phi\) determines the persistence of that gap; \(B\) and \(F\) determine how the shock \(z_{t+1}\) impinges on the gap and on growth.

Collect the parameters in \(\psi = (\nu, \phi, B, F, x_0)\), in which the initial state \(x_0\) is a parameter rather than a draw from a distribution.

Hansen [2012] decomposes \(y_t\) into a trend, a martingale, and a stationary component, as Sargent and Yang’s Proposition 1 records:

\[ y_t = \underbrace{t\nu}_{\text{trend}} + \underbrace{\sum_{j=1}^t \Bigl(F + \frac{B}{1-\phi}\Bigr) z_j}_{\text{martingale}} - \underbrace{\frac{x_t}{1-\phi}}_{\text{stationary}} + \underbrace{\frac{x_0}{1-\phi} + y_0}_{\text{constant}} . \]

45.3.1. The growth rates are jointly normal#

Solving (45.1) forward gives \(x_t = \phi^t x_0 + B\sum_{j=1}^t \phi^{t-j} z_j\), so

\[ \Delta y_{t+1} = \nu + \phi^t x_0 + B \sum_{j=1}^{t} \phi^{t-j} z_j + F z_{t+1} . \]

The vector \(\Delta y = (\Delta y_1, \ldots, \Delta y_T)^\top\) is therefore normal with mean vector and covariance matrix

(45.2)#\[\begin{split}m(\psi)_i = \nu + \phi^{i-1} x_0 , \qquad \Sigma(\psi) = L(\psi) L(\psi)^\top , \qquad L(\psi)_{ij} = \begin{cases} F & i = j \\ B \phi^{i-1-j} & j < i \\ 0 & j > i \end{cases}\end{split}\]

Equation (45.2) has three consequences.

The diagonal of \(L\) is constant, so \(\log \det \Sigma(\psi) = 2T \log F\) whatever \(\phi\) and \(B\) are.

The variance of a single growth rate is \(F^2 + B^2(1-\phi^{2t})/(1-\phi^2)\), which rises with \(t\) toward \(F^2 + B^2/(1-\phi^2)\).

The covariance between the first growth rate and the one \(k\) periods later is \(BF\phi^{k-1}\), and for later pairs

\[ \operatorname{Cov}(\Delta y_i, \Delta y_{i+k}) = BF\phi^{k-1} + B^2 \phi^{k}\,\frac{1-\phi^{2(i-1)}}{1-\phi^{2}} , \]

in which every term is non-negative when \(B \geq 0\), \(F > 0\), and \(0 < \phi < 1\).

The family therefore cannot produce a negative autocovariance.

AMF = namedtuple("AMF", ("ν", "φ", "B", "F", "x0"))

def amf_mean(ψ, T):
    "Mean vector of (Δy_1, ..., Δy_T)."
    return ψ.ν + ψ.φ ** np.arange(T) * ψ.x0

def amf_factor(ψ, T):
    "The lower triangular factor L of Σ(ψ)."
    i, j = np.tril_indices(T, -1)
    L = np.zeros((T, T))
    L[i, j] = ψ.B * ψ.φ ** (i - 1 - j)
    L[np.diag_indices(T)] = ψ.F
    return L

def amf_cov(ψ, T):
    "Covariance matrix of (Δy_1, ..., Δy_T)."
    L = amf_factor(ψ, T)
    return L @ L.T

Because \(L\) is known, no factorization is needed to apply \(L^{-1}\).

Applying \(L^{-1}\) is the model’s own recursion: \(z_{t+1} = (\Delta y_{t+1} - \nu - x_t)/F\) followed by \(x_{t+1} = \phi x_t + B z_{t+1}\).

def whiten(ψ, V):
    """
    Apply L(ψ)^{-1} to each column of V by running the model's recursion.

    With V = Δy - m(ψ) this returns the shocks z that generated Δy.
    """
    V = np.atleast_2d(np.asarray(V, dtype=float).T).T
    out = np.empty_like(V)
    x = np.zeros(V.shape[1])
    for t in range(V.shape[0]):
        z = (V[t] - x) / ψ.F
        out[t] = z
        x = ψ.φ * x + ψ.B * z
    return out

The recursion also delivers the log likelihood of a growth path, since the shocks are standard normal and \(\log\det\Sigma = 2T\log F\).

def amf_loglike(ψ, dy):
    "Log likelihood of the growth path dy under the descriptive model."
    T = len(dy)
    z = whiten(ψ, dy - amf_mean(ψ, T))[:, 0]
    return -0.5 * T * np.log(2 * np.pi) - T * np.log(ψ.F) - 0.5 * z @ z
ψ_test = AMF(0.05, 0.9, 0.01, 0.03, 0.08)
T_test = 12
L = amf_factor(ψ_test, T_test)

print(f"log det Σ: {np.linalg.slogdet(amf_cov(ψ_test, T_test))[1]:.8f}"
      f"   2T log F: {2 * T_test * np.log(ψ_test.F):.8f}")
print(f"whitening inverts L: "
      f"{np.allclose(L @ whiten(ψ_test, np.eye(T_test)), np.eye(T_test))}")
print(f"Cov(Δy_1, Δy_2): {amf_cov(ψ_test, T_test)[1, 0]:.8f}"
      f"   B F: {ψ_test.B * ψ_test.F:.8f}")
print(f"later lag-one autocovariances rise: "
      f"{np.round(np.diag(amf_cov(ψ_test, T_test), 1)[:4], 8)}")
print(f"smallest entry of Σ: {amf_cov(ψ_test, T_test).min():.8f}")
log det Σ: -84.15738954   2T log F: -84.15738954
whitening inverts L: True
Cov(Δy_1, Δy_2): 0.00030000   B F: 0.00030000
later lag-one autocovariances rise: [0.0003     0.00039    0.0004629  0.00052195]
smallest entry of Σ: 0.00010460

The log determinant matches \(2T\log F\), the recursion inverts \(L\), the first lag-one autocovariance is \(BF\) while later ones exceed it, and no entry of \(\Sigma\) is negative.

45.3.2. The fitted descriptive models#

Sargent and Yang place a flat prior on \(\phi\), half-normal priors on \(B\) and \(F\), a normal prior on \(x_0\) with standard deviation \(0.5\), and, in the specification that estimates it, a diffuse \(\nu \sim \mathcal{N}(0.02, 0.5^2)\).

They sample the posterior with the No-U-Turn sampler of Hoffman and Gelman [2014].

They report two specifications: one fixes \(\nu = 0.02\), the long-run US rate; the other estimates \(\nu\).

We take the posterior medians of the second specification, their Table 2, as the fitted descriptive models \(\hat\psi\).

ψ_hat = {"CHN": AMF(0.075, 0.5236, 0.0139, 0.0229, 0.041),
         "SGP": AMF(0.030, 0.9083, 0.0032, 0.0397, 0.092),
         "KOR": AMF(0.013, 0.9843, 0.0056, 0.0325, 0.072)}

ψ_hat_fixed = {"CHN": AMF(0.02, 0.9286, 0.0176, 0.0246, 0.086),
               "SGP": AMF(0.02, 0.9277, 0.0024, 0.0391, 0.093),
               "KOR": AMF(0.02, 0.9717, 0.0052, 0.0324, 0.062)}

print(f"{'':14}{'log likelihood':>16}{'implied lag-1 autocorr':>24}{'data':>8}")
for c, dy in data.items():
    Σ = amf_cov(ψ_hat[c], len(dy))
    s = np.sqrt(np.diag(Σ))
    ac1 = (np.diag(Σ, 1) / (s[:-1] * s[1:])).mean()
    print(f"{NAMES[c]:14}{amf_loglike(ψ_hat[c], dy):16.2f}{ac1:24.3f}"
          f"{np.corrcoef(dy[:-1], dy[1:])[0, 1]:8.3f}")
                log likelihood  implied lag-1 autocorr    data
China                    95.13                   0.577   0.548
Singapore               106.32                   0.107   0.245
South Korea             123.29                   0.432   0.362

The fitted descriptive models imply positively autocorrelated growth in all three economies.

They do so through \(B\), the only parameter that makes a shock to growth persist.

The table above compares them with the raw autocorrelation of the data, which also contains the declining mean path; The residual divergence makes the comparison on a common basis and finds the fitted model close to the data for China and well above it for the other two.

These are posterior medians, not maximum likelihood estimates, and the two differ.

The maximized log likelihood exceeds the value at \(\hat\psi\) by \(0.45\) for China, \(2.11\) for Singapore, and \(3.10\) for South Korea, and the maximizer for South Korea is degenerate.

Exercise 45.4 examines that degeneracy and the role that Sargent and Yang’s priors play in removing it.

45.3.3. The three moments#

Sargent and Yang compress each \(\hat\psi\) into three numbers, which become the targets of their second stage:

(45.3)#\[\hat m_1 = \frac{1}{T}\sum_{t=0}^{T-1} (\nu + \phi^t x_0) , \qquad \hat m_2 = \Bigl[F^2 + \frac{B^2}{T}\sum_{t=0}^{T-1}\frac{1-\phi^{2t}}{1-\phi^2}\Bigr]^{1/2} , \qquad \hat m_3 = \nu + x_0 .\]

The first is average growth, the second the root average variance of growth, the third the first period’s expected growth.

Each is a function of \(\hat\psi\) alone.

def three_moments(ψ, T):
    "Sargent and Yang's three target moments, as functions of ψ."
    t = np.arange(T)
    m1 = (ψ.ν + ψ.φ ** t * ψ.x0).mean()
    m2 = np.sqrt(ψ.F ** 2 + (ψ.B ** 2 / T) * ((1 - ψ.φ ** (2 * t))
                                              / (1 - ψ.φ ** 2)).sum())
    return np.array([m1, m2, ψ.ν + ψ.x0])

print(f"{'':14}{'m1':>9}{'m2':>9}{'m3':>9}")
for c, dy in data.items():
    m = three_moments(ψ_hat[c], len(dy))
    print(f"{NAMES[c]:14}{m[0]:9.4f}{m[1]:9.4f}{m[2]:9.4f}")
                     m1       m2       m3
China            0.0772   0.0279   0.1160
Singapore        0.0475   0.0404   0.1220
South Korea      0.0599   0.0401   0.0850

No autocovariance appears in (45.3).

45.4. Projection onto the descriptive family#

Write \(\mathcal{Q} = \{Q_\psi\}\) for the family of distributions (45.2) of the growth vector \(\Delta y\), a five-parameter manifold inside the Gaussian distributions on \(\mathbb{R}^T\).

Let \(P\) be the distribution of \(\Delta y\) in some other model.

The m-projection of \(P\) onto \(\mathcal{Q}\) minimizes \(D(P \| Q_\psi)\) over \(\psi\), as in Information Projections.

Theorem 40.2 characterizes that projection for an exponential family, where it matches the means of the sufficient statistics.

\(\mathcal{Q}\) is a curved five-parameter sub-family of the \(T(T+3)/2\)-parameter Gaussian family, so five parameters cannot match \(T + T(T+1)/2\) moments, and the theorem’s characterization does not apply.

A first-order condition replaces it.

At an interior projection the residuals \(\mu_P - m(\psi)\) and \(S_P + (\mu_P - m)(\mu_P - m)^\top - \Sigma(\psi)\) satisfy, for each of the five parameters,

\[ \tfrac{1}{2}\operatorname{tr}\bigl(\Sigma^{-1}(A - \Sigma)\Sigma^{-1}\partial_k \Sigma\bigr) + (\mu_P - m)^\top \Sigma^{-1} \partial_k m = 0 , \qquad A = S_P + (\mu_P - m)(\mu_P - m)^\top . \]

The two terms vanish separately only for parameters that move \(m\) alone, \(\nu\) and \(x_0\), or \(\Sigma\) alone, \(B\) and \(F\).

The projections computed below are not interior: they sit at \(B = 0\), where the condition in the \(B\) direction becomes an inequality.

Since \(D(P\|Q_\psi) = -E_P[\log q_\psi(\Delta y)] - H(P)\) and the entropy \(H(P)\) does not depend on \(\psi\), the projection minimizes the cross entropy \(-E_P[\log q_\psi(\Delta y)]\).

Writing \(\mu_P\) and \(S_P\) for the mean vector and covariance matrix of \(\Delta y\) under \(P\), and dropping the constant \(\tfrac{T}{2}\log 2\pi\),

(45.4)#\[C(\psi; \mu_P, S_P) = T \log F + \tfrac{1}{2} \operatorname{tr}\bigl(L^{-1} S_P L^{-\top}\bigr) + \tfrac{1}{2} \bigl\| L^{-1}(\mu_P - m(\psi)) \bigr\|^2 .\]

The projection depends on \(P\) only through \(\mu_P\) and \(S_P\).

Those are the expectations of the sufficient statistics of the Gaussian family that contains \(\mathcal{Q}\), so the projection discards everything else about \(P\).

Skewness, kurtosis, and all higher cumulants of the Ramsey model’s growth rates leave the projection unchanged.

def cross_entropy(ψ, μ_P, S_P):
    "Cross entropy -E_P log q_ψ, dropping the constant (T/2) log 2π."
    T = len(μ_P)
    if ψ.F <= 0 or ψ.B < 0 or not 0 < ψ.φ < 1:
        return np.inf
    W = whiten(ψ, whiten(ψ, S_P).T)
    w = whiten(ψ, μ_P - amf_mean(ψ, T))[:, 0]
    return T * np.log(ψ.F) + 0.5 * np.trace(W) + 0.5 * w @ w

45.4.1. Concentrating out three parameters#

Three of the five parameters drop out of the search.

Write \(B = bF\) and factor \(L = F M(\phi, b)\), where \(M\) has ones on its diagonal and \(b\phi^{i-1-j}\) below it.

Then (45.4) becomes

\[\begin{split} C = T \log F + \frac{1}{2F^2} \Bigl[ \operatorname{tr}\bigl(M^{-1} S_P M^{-\top}\bigr) + \bigl\| M^{-1}\bigl(\mu_P - Z(\phi) c\bigr) \bigr\|^2 \Bigr] , \qquad Z(\phi) = \begin{bmatrix} 1 & 1 \\ \vdots & \vdots \\ 1 & \phi^{T-1} \end{bmatrix} , \quad c = \begin{bmatrix} \nu \\ x_0 \end{bmatrix} . \end{split}\]

The mean parameters \(c\) enter one least squares problem, whose solution regresses the whitened \(\mu_P\) on the whitened columns of \(Z(\phi)\).

Let \(Q(\phi, b)\) be the bracket evaluated at that solution.

The first-order condition in \(F\) gives \(F^2 = Q(\phi,b)/T\), and substituting leaves

(45.5)#\[C^*(\phi, b) = \frac{T}{2}\Bigl[\log \frac{Q(\phi,b)}{T} + 1\Bigr] .\]

A two-dimensional search over \(\phi\) and \(b\) in (45.5) therefore delivers the projection.

def concentrated(φ, b, μ_P, S_P):
    "Cross entropy minimized over (ν, x0, F) at given (φ, b = B/F), and the ψ attaining it."
    T = len(μ_P)
    unit = AMF(0.0, φ, b, 1.0, 0.0)              # the factor M(φ, b)
    Z = np.column_stack([np.ones(T), φ ** np.arange(T)])
    Z_w, μ_w = whiten(unit, Z), whiten(unit, μ_P)[:, 0]
    c, *_ = np.linalg.lstsq(Z_w, μ_w, rcond=None)
    r = μ_w - Z_w @ c
    W = whiten(unit, whiten(unit, S_P).T)
    Q = np.trace(W) + r @ r
    F = np.sqrt(Q / T)
    return 0.5 * T * (np.log(Q / T) + 1), AMF(c[0], φ, b * F, F, c[1])


def project(μ_P, S_P, b_free=False):
    """
    m-projection of a distribution with mean μ_P and covariance S_P
    onto the descriptive family.  b_free=True drops the restriction B ≥ 0.
    """
    def crit(u):
        φ = 1 / (1 + np.exp(-u[0]))
        b = u[1] if b_free else abs(u[1])
        return concentrated(φ, b, μ_P, S_P)[0]

    starts = [(0.5, 0.2), (0.92, 0.2)] + ([(0.5, -0.2), (0.92, -0.2)] if b_free else [])
    best = None
    for φ0, b0 in starts:
        res = minimize(crit, [np.log(φ0 / (1 - φ0)), b0], method="Nelder-Mead",
                       options=dict(maxiter=600, maxfev=600, fatol=1e-12, xatol=1e-9))
        if best is None or res.fun < best.fun:
            best = res
    φ = 1 / (1 + np.exp(-best.x[0]))
    b = best.x[1] if b_free else abs(best.x[1])
    return concentrated(φ, b, μ_P, S_P)[1], best.fun

A projection of a member of \(\mathcal{Q}\) onto \(\mathcal{Q}\) returns that member.

for c, dy in data.items():
    T = len(dy)
    ψ = ψ_hat[c]
    ψ_p, _ = project(amf_mean(ψ, T), amf_cov(ψ, T))
    gap = max(abs(a - b) for a, b in zip(ψ, ψ_p))
    print(f"{NAMES[c]:14} largest parameter gap: {gap:.2e}")
China          largest parameter gap: 1.55e-09
Singapore      largest parameter gap: 1.21e-08
South Korea    largest parameter gap: 2.74e-09

45.4.2. Divergence within the family#

Two members of \(\mathcal{Q}\) are both Gaussian, so the divergence between them is available in closed form.

def family_divergence(ψ_a, ψ_b, T):
    "D(Q_{ψ_a} ‖ Q_{ψ_b}) for the T growth rates."
    W = whiten(ψ_b, whiten(ψ_b, amf_cov(ψ_a, T)).T)
    w = whiten(ψ_b, amf_mean(ψ_a, T) - amf_mean(ψ_b, T))[:, 0]
    return 0.5 * (np.trace(W) + w @ w - T
                  + 2 * T * (np.log(ψ_b.F) - np.log(ψ_a.F)))

T_chn = len(data["CHN"])
print(f"D(Q ‖ Q) = {family_divergence(ψ_hat['CHN'], ψ_hat['CHN'], T_chn):.2e}")
for c, dy in data.items():
    d = family_divergence(ψ_hat[c], ψ_hat_fixed[c], len(dy))
    print(f"{NAMES[c]:14} fixed ν against estimated ν: {d:7.3f} nats")
D(Q ‖ Q) = 0.00e+00
China          fixed ν against estimated ν:   3.214 nats
Singapore      fixed ν against estimated ν:   0.320 nats
South Korea    fixed ν against estimated ν:   0.244 nats

The specification search of the first stage therefore moves the descriptive model by \(3.2\) nats for China and by much less for the other two economies.

That number is a yardstick for the divergences that the second stage produces below.

45.5. The Ramsey model#

A planner maximizes \(E_0 \sum_{t=0}^\infty \beta^t u(C_t)\) with \(u(C) = (C^{1-\gamma}-1)/(1-\gamma)\), subject to

\[ C_t + K_{t+1} - (1-\delta)K_t = Y_t = A_t \xi_t K_t^\alpha , \qquad A_{t+1} = \mu A_t , \qquad \log \xi_t \sim \mathcal{N}\bigl(-\tfrac{1}{2}\sigma_\xi^2, \sigma_\xi^2\bigr) , \]

so that total factor productivity grows at the gross rate \(\mu\) and \(E\xi_t = 1\).

The planner observes \(\xi_t\) before choosing \(K_{t+1}\).

Dividing by the balanced-growth scale \(A_t^{1/(1-\alpha)}\) gives detrended capital \(k_t\), consumption \(c_t\), and output \(\tilde y_t = \xi_t k_t^\alpha\), and the problem becomes

(45.6)#\[v(k) = E_\xi \max_{k'} \Bigl\{ u\bigl(\xi k^\alpha + (1-\delta)k - \mu^{1/(1-\alpha)} k'\bigr) + \tilde\beta \, v(k') \Bigr\} , \qquad \tilde\beta = \beta \mu^{(1-\gamma)/(1-\alpha)} .\]

Log output grows at \(\log(\mu)/(1-\alpha)\) along a balanced growth path, so

(45.7)#\[\Delta y_{t+1} = \frac{\log \mu}{1-\alpha} + \log \tilde y_{t+1} - \log \tilde y_t .\]

We follow Sargent and Yang in fixing \(\alpha = 0.35\), \(\beta = 0.96\), \(\gamma = 2\), and \(\delta = 0.03\), and in estimating \(\theta = (\mu, \sigma_\xi, k_0)\).

The function ramsey_model builds the capital grid and the Gauss-Hermite nodes that evaluate the expectation in (45.6).

Ramsey = namedtuple("Ramsey", ("k", "ξ", "p", "β", "g", "α", "γ", "δ", "μ", "σ_ξ"))

def ramsey_model(μ=1.02, σ_ξ=0.03, α=0.35, β=0.96, γ=2.0, δ=0.03,
                 k_min=0.05, k_max=12.0, n_k=600, n_q=7):
    "Detrended stochastic growth model: capital grid, shock nodes, effective discount factor."
    nodes, weights = hermgauss(n_q)
    β_eff = β * μ ** ((1 - γ) / (1 - α))
    if β_eff >= 1:
        raise ValueError(f"effective discount factor {β_eff:.4f} must be below one")
    return Ramsey(k=np.linspace(k_min, k_max, n_k),
                  ξ=np.exp(-0.5 * σ_ξ ** 2 + np.sqrt(2.0) * σ_ξ * nodes),
                  p=weights / np.sqrt(np.pi), β=β_eff,
                  g=μ ** (1 / (1 - α)), α=α, γ=γ, δ=δ, μ=μ, σ_ξ=σ_ξ)

def utility(c, γ):
    c = np.maximum(c, 1e-12)
    return np.log(c) if abs(γ - 1) < 1e-10 else (c ** (1 - γ) - 1) / (1 - γ)

def rewards(m):
    "R[i, s, j] = u(c) at capital k_i, shock ξ_s, and choice k_j; -inf where c ≤ 0."
    resources = m.ξ[None, :] * m.k[:, None] ** m.α + (1 - m.δ) * m.k[:, None]
    c = resources[:, :, None] - m.g * m.k[None, None, :]
    return np.where(c > 0, utility(c, m.γ), -np.inf)

Optimistic policy iteration solves (45.6), the method that Sargent and Stachurski [2025] describe.

Each sweep maximizes once and then evaluates the resulting policy several times.

def solve_ramsey(m, tol=1e-8, max_iter=500, n_eval=25):
    "Optimistic policy iteration for the ex ante value function v(k)."
    R = rewards(m)
    v = np.zeros_like(m.k)
    gap = np.inf
    rows, cols = np.arange(m.k.size)[:, None], np.arange(m.p.size)[None, :]
    for sweep in range(max_iter):
        σ = (R + m.β * v[None, None, :]).argmax(axis=2)
        for _ in range(n_eval):
            v_new = (m.p[None, :] * (R[rows, cols, σ] + m.β * v[σ])).sum(axis=1)
            gap = np.max(np.abs(v_new - v))
            v = v_new
            if gap < tol:
                break
        if gap < tol:
            break
    if gap >= tol:
        raise RuntimeError(f"value iteration stopped at a gap of {gap:.2e}")
    return v, σ, sweep
m_demo = ramsey_model(μ=1.0459, σ_ξ=0.022)
_, σ_demo, sweeps = solve_ramsey(m_demo)
print(f"converged in {sweeps + 1} sweeps; effective discount factor {m_demo.β:.4f}")
converged in 10 sweeps; effective discount factor 0.8960
fig, ax = plt.subplots()
pol = m_demo.k[σ_demo]
for s in (0, 3, 6):
    ax.plot(m_demo.k, pol[:, s], lw=2, label=rf"$\xi = {m_demo.ξ[s]:.3f}$")
ax.plot(m_demo.k, m_demo.k, "k--", lw=1, label="45 degree line")
ax.set_xlabel("$k$")
ax.set_ylabel("$k'$")
ax.set_xlim(0, 4)
ax.set_ylim(0, 4)
ax.legend()
plt.show()
_images/c57eae058957cda3ac0b544b4e02f53653f30eb97e09a34ecb9a6d7c6758915f.png

Fig. 45.2 Saving policy in the detrended Ramsey model#

The policy crosses the 45 degree line near \(k = 2\) at the median shock, which is where the deterministic version of the model settles: \(\tilde\beta\,[\alpha k^{\alpha-1} + 1 - \delta] = \mu^{1/(1-\alpha)}\) gives \(k^* = 1.96\).

That is well above the initial capital stocks that Sargent and Yang estimate, which run from \(0.65\) to \(1.25\).

An economy that starts well below its balanced growth path grows quickly as it accumulates capital, and Sargent and Yang’s second stage uses that transition to account for a growth miracle.

Simulation draws log-normal shocks, interpolates the policy, and returns growth rates by (45.7).

The quadrature nodes span about \(\pm 3.75\) standard deviations of \(\log\xi\), and np.interp holds the policy flat for the few draws that fall outside them.

def interp_rows(grid, values, x):
    """
    Interpolate values[:, i] over grid at x[i], one draw per column.

    Outside the grid the end value is held, as np.interp does.
    """
    j = np.clip(np.searchsorted(grid, x) - 1, 0, grid.size - 2)
    w = np.clip((x - grid[j]) / (grid[j + 1] - grid[j]), 0.0, 1.0)
    cols = np.arange(x.size)
    return (1 - w) * values[j, cols] + w * values[j + 1, cols]


def simulate_ramsey(m, σ, k0, T, n_paths, rng):
    "Simulate n_paths growth-rate paths of length T from detrended capital k0."
    drift = np.log(m.μ) / (1 - m.α)
    ξ = np.exp(-0.5 * m.σ_ξ ** 2 + m.σ_ξ * rng.standard_normal((n_paths, T + 1)))
    pol = m.k[σ]
    k = np.full(n_paths, float(k0))
    log_y = np.empty((n_paths, T + 1))
    for t in range(T + 1):
        log_y[:, t] = np.log(ξ[:, t]) + m.α * np.log(k)
        if t < T:
            by_node = np.array([np.interp(k, m.k, pol[:, s]) for s in range(m.ξ.size)])
            k = interp_rows(m.ξ, by_node, ξ[:, t])
    return np.diff(log_y, axis=1) + drift


def structural_moments(θ, T, n_paths=2000, seed=0, n_k=600):
    "Mean vector and covariance matrix of the Ramsey model's T growth rates."
    μ, σ_ξ, k0 = θ
    m = ramsey_model(μ=μ, σ_ξ=σ_ξ, n_k=n_k)
    _, σ, _ = solve_ramsey(m)
    dy = simulate_ramsey(m, σ, k0, T, n_paths, np.random.default_rng(seed))
    return dy.mean(axis=0), np.cov(dy, rowvar=False)

Sargent and Yang’s estimates, their Table 3, report TFP growth as \(g_\mu = 100(\mu - 1)\) percent.

Output grows faster than TFP along a balanced growth path, at \(\log(\mu)/(1-\alpha)\), so \(g_\mu = 4.59\) percent for China corresponds to trend output growth of \(6.9\) percent.

θ_paper = {"CHN": (1.0459, 0.022, 0.811),
           "SGP": (1.0241, 0.031, 0.650),
           "KOR": (1.0368, 0.031, 1.251)}

print(f"{'':14}{'m1 target':>11}{'m1 model':>10}{'m2 target':>11}{'m2 model':>10}"
      f"{'m3 target':>11}{'m3 model':>10}")
for c, dy in data.items():
    T = len(dy)
    target = three_moments(ψ_hat[c], T)
    μ_P, S_P = structural_moments(θ_paper[c], T)
    model = np.array([μ_P.mean(), np.sqrt(np.diag(S_P).mean()), μ_P[0]])
    print(f"{NAMES[c]:14}{target[0]:11.4f}{model[0]:10.4f}{target[1]:11.4f}"
          f"{model[1]:10.4f}{target[2]:11.4f}{model[2]:10.4f}")
                m1 target  m1 model  m2 target  m2 model  m3 target  m3 model
China              0.0772    0.0769     0.0279    0.0285     0.1160    0.1171
Singapore          0.0475    0.0472     0.0404    0.0410     0.1220    0.1233
South Korea        0.0599    0.0596     0.0401    0.0407     0.0850    0.0862

The Ramsey model matches the three moments that Sargent and Yang asked it to match, to within about two percent.

Our solver is a reimplementation rather than their code: it uses \(2000\) simulated paths against their \(1000\), interpolates the policy in \(\xi\) rather than in \(\log\xi\), and imposes no feasibility projection, which their code carries.

45.6. The binding function#

The projection of the Ramsey model onto the descriptive family is a point \(b(\theta)\) in that family:

\[ b(\theta) = \operatorname*{argmin}_{\psi} \; D\bigl(P_\theta \,\|\, Q_\psi\bigr) . \]

Gourieroux et al. [1993] call \(\theta \mapsto b(\theta)\) the binding function; Which Moments to Match? writes it \(\theta^0(\rho)\).

def binding(θ, T, **kwargs):
    "The descriptive parameters that the Ramsey model at θ projects onto."
    return project(*structural_moments(θ, T, **kwargs))[0]

print(f"{'':14}{'ν':>9}{'φ':>9}{'B':>10}{'F':>9}{'x0':>9}")
for c, dy in data.items():
    b = binding(θ_paper[c], len(dy))
    print(f"{NAMES[c]:14}{b.ν:9.4f}{b.φ:9.4f}{b.B:10.5f}{b.F:9.4f}{b.x0:9.4f}")
    ψ = ψ_hat[c]
    print(f"{'  fitted ψ̂':14}{ψ.ν:9.4f}{ψ.φ:9.4f}{ψ.B:10.5f}{ψ.F:9.4f}{ψ.x0:9.4f}")
                      ν        φ         B        F       x0
China            0.0696   0.8422   0.00000   0.0285   0.0446
  fitted ψ̂      0.0750   0.5236   0.01390   0.0229   0.0410
Singapore        0.0380   0.8468   0.00000   0.0410   0.0799
  fitted ψ̂      0.0300   0.9083   0.00320   0.0397   0.0920
South Korea      0.0558   0.8728   0.00000   0.0407   0.0290
  fitted ψ̂      0.0130   0.9843   0.00560   0.0325   0.0720

The binding function sets \(B\) to zero for all three economies.

It reproduces the Ramsey model’s own moments, not the targets taken from \(\hat\psi\), and it does not reproduce \(\hat\psi\) parameter by parameter.

Two facts follow from \(B = 0\).

The whitening is then the identity, so fitting the mean path is ordinary least squares of \(\mu_P\) on the columns of \(Z(\phi)\), whose residual is orthogonal to the column of ones; the projection therefore reproduces the Ramsey model’s average growth \(\bar m_1(\theta)\) exactly.

And \(F^2 = \bar m_2(\theta)^2 + \lVert r \rVert^2 / T\), so \(F\) is at least the Ramsey model’s root average variance and exceeds it by the misfit of the mean path.

For China that puts \(F\) at \(0.0285\), against the Ramsey model’s \(\bar m_2 = 0.0285\), the target \(\hat m_2 = 0.0279\), and the fitted \(\hat F = 0.0229\).

The persistence \(\phi\) settles between \(0.84\) and \(0.87\), against fitted values of \(0.52\), \(0.91\), and \(0.98\), because with \(B = 0\) it has to describe the shape of the mean path alone.

Slices of the binding function for China show how its components respond to \(\theta\), with the other components of \(\theta\) held at Sargent and Yang’s estimates.

T = len(data["CHN"])
g_grid = np.linspace(0.03, 0.06, 9)
k_grid = np.linspace(0.4, 2.0, 9)
by_g = [binding((1 + g, 0.022, 0.811), T) for g in g_grid]
by_k = [binding((1.0459, 0.022, k), T) for k in k_grid]

fig, axes = plt.subplots(1, 2, figsize=(11, 4))
for ax, grid, bs, lab, point in (
        (axes[0], 100 * g_grid, by_g, r"$g_\mu$ (percent)", 4.59),
        (axes[1], k_grid, by_k, "$k_0$", 0.811)):
    ax.plot(grid, [b.ν for b in bs], "o-", lw=2, label=r"$\nu$")
    ax.plot(grid, [b.x0 for b in bs], "s-", lw=2, label=r"$x_0$")
    ax.plot(grid, [b.F for b in bs], "^-", lw=2, label="$F$")
    ax.axvline(point, color="0.7", lw=1)
    ax.set_xlabel(lab)
    ax.legend()
axes[0].set_title("varying TFP growth")
axes[1].set_title("varying initial capital")
plt.show()
_images/88f82a4d2562869984ab66e6c8bee7affc60f7816199f14cc74d9a53e84b35f2.png

Fig. 45.3 Binding function slices for China#

TFP growth raises \(\nu\) with a slope of about \(1.4\).

The benchmark is \(1.47\): output grows at \(\log(\mu)/(1-\alpha)\), and the horizontal axis is \(\mu - 1\) rather than \(\log\mu\), so the slope is \(1/[(1-\alpha)\mu] = 1.538/1.046\).

Faster TFP growth lowers \(x_0\), because a higher trend leaves less of the first period’s growth for a transient gap to explain.

Initial capital \(k_0\) leaves \(\nu\) and \(F\) almost unchanged and lowers \(x_0\), because an economy that starts closer to its balanced growth path has a smaller initial growth gap.

Neither experiment moves \(B\) away from zero.

45.7. Indirect inference#

Indirect inference chooses \(\theta\) to bring \(b(\theta)\) to the fitted \(\hat\psi\).

Three components of \(\theta\) cannot generally place \(b(\theta)\) on a given point of a five-dimensional family, and here they cannot do it at all, because \(b(\theta)\) has \(B = 0\) while \(\hat B > 0\).

We therefore minimize a divergence:

(45.8)#\[\hat\theta = \operatorname*{argmin}_{\theta} \; D\bigl(Q_{\hat\psi} \,\|\, Q_{b(\theta)}\bigr) .\]

The criterion (45.8) measures distance inside the descriptive family, where both arguments are Gaussian and the divergence is exact.

Its arguments run in the opposite order from the projection, which minimizes \(D(P_\theta \| Q_\psi)\) over \(\psi\) while (45.8) minimizes \(D(Q_{\hat\psi} \| Q_{b(\theta)})\) over \(\theta\).

Both orderings penalize the same displacement to second order, since the two divergences agree to that order, and we use the one in which \(\hat\psi\) is the reference distribution.

Expanding (45.8) around \(\hat\psi\) gives \(\tfrac{1}{2}(b(\theta)-\hat\psi)^\top I(\hat\psi)(b(\theta)-\hat\psi)\) to second order, where \(I(\hat\psi)\) is the Fisher information of the descriptive model.

Gourieroux et al. [1993] show that \(I\) is the efficient weighting matrix when the auxiliary model is correctly specified, in which case it is the inverse asymptotic variance of the auxiliary estimator.

The auxiliary model is not correctly specified here, as The residual divergence shows, so we minimize the divergence itself rather than a quadratic approximation to it.

Two further gaps separate this calculation from the setting of their theorem: their result is asymptotic and presumes stationarity and ergodicity, which Sargent and Yang build their model class to violate, and \(\hat\psi\) is a vector of posterior medians rather than the extremum estimator that the theorem concerns.

Sargent and Yang’s criterion instead weights the three moments (45.3) by a diagonal matrix.

def indirect_inference(c, θ_start, max_eval=150):
    "Choose θ to minimize the divergence of the fitted ψ̂ from the projection b(θ)."
    T = len(data[c])

    def criterion(u):
        θ = (1 + abs(u[0]), abs(u[1]), abs(u[2]))
        if not (1e-4 < θ[1] < 0.3 and 0.05 < θ[2] < 10 and θ[0] < 1.15):
            return 1e6
        return family_divergence(ψ_hat[c], binding(θ, T), T)

    u0 = np.array([θ_start[0] - 1, θ_start[1], θ_start[2]])
    res = minimize(criterion, u0, method="Nelder-Mead",
                   options=dict(maxiter=max_eval, maxfev=max_eval,
                                fatol=1e-7, xatol=1e-6))
    θ = (1 + abs(res.x[0]), abs(res.x[1]), abs(res.x[2]))
    return θ, res.fun, res.success
θ_kl, D_kl, D_paper, converged = {}, {}, {}, {}
for c in data:
    T = len(data[c])
    θ_kl[c], D_kl[c], converged[c] = indirect_inference(c, θ_paper[c])
    D_paper[c] = family_divergence(ψ_hat[c], binding(θ_paper[c], T), T)

for c in data:
    if not converged[c]:
        print(f"{NAMES[c]}: the simplex search stopped at its evaluation cap")

print(f"{'':14}{'g_μ paper':>11}{'g_μ KL':>9}{'σ_ξ paper':>11}{'σ_ξ KL':>9}"
      f"{'k0 paper':>10}{'k0 KL':>8}{'D paper':>10}{'D KL':>8}")
for c in data:
    p, q = θ_paper[c], θ_kl[c]
    print(f"{NAMES[c]:14}{100*(p[0]-1):11.2f}{100*(q[0]-1):9.2f}{p[1]:11.3f}"
          f"{q[1]:9.3f}{p[2]:10.3f}{q[2]:8.3f}{D_paper[c]:10.3f}{D_kl[c]:8.3f}")
China: the simplex search stopped at its evaluation cap
Singapore: the simplex search stopped at its evaluation cap
South Korea: the simplex search stopped at its evaluation cap
                g_μ paper   g_μ KL  σ_ξ paper   σ_ξ KL  k0 paper   k0 KL   D paper    D KL
China                4.59     4.78      0.022    0.022     0.811   1.042     8.792   8.248
Singapore            2.41     2.26      0.031    0.031     0.650   0.513     1.917   1.678
South Korea          3.68     3.63      0.031    0.031     1.251   1.047    13.817  13.656

The search stops at its evaluation cap in all three economies, because the criterion is nearly flat in \(k_0\) and the simplex cannot meet its tolerance in that direction.

Raising the cap from \(150\) to \(600\) lets it converge and moves China’s \(k_0\) from \(1.042\) to \(1.044\), so the cap is not what determines the answer.

The two criteria deliver almost the same TFP growth and the same shock volatility.

They differ in initial capital, by \(0.23\) for China and by \(0.20\) for South Korea.

The divergence falls by six percent for China, twelve percent for Singapore, and one percent for South Korea.

The two differences do not carry equal weight.

T = len(data["CHN"])
μ_c, σ_c, k0_c = θ_kl["CHN"]

print(f"{'k0':>7}{'D':>9}      {'σ_ξ':>7}{'D':>9}")
k0_line = np.array([0.70, 0.85, 1.00, 1.042, 1.15, 1.30])
σ_line = np.array([0.016, 0.019, 0.022, 0.025, 0.028])
for i in range(max(len(k0_line), len(σ_line))):
    left = (f"{k0_line[i]:7.3f}"
            f"{family_divergence(ψ_hat['CHN'], binding((μ_c, σ_c, k0_line[i]), T), T):9.3f}"
            if i < len(k0_line) else " " * 16)
    right = (f"{σ_line[i]:7.3f}"
             f"{family_divergence(ψ_hat['CHN'], binding((μ_c, σ_line[i], k0_c), T), T):9.3f}"
             if i < len(σ_line) else "")
    print(left + "      " + right)
     k0        D          σ_ξ        D
  0.700    9.489        0.016   12.818
  0.850    8.623        0.019    9.099
  1.000    8.283        0.022    8.253
  1.042    8.248        0.025    8.897
  1.150    8.267        0.028   10.307
  1.300    8.460

The criterion varies by less than \(0.04\) nats as \(k_0\) moves from \(1.00\) to \(1.15\), and by \(0.6\) nats when \(\sigma_\xi\) moves from \(0.022\) to \(0.025\), by two nats when it moves to \(0.028\).

Both parameters are identified, and the criterion curves far more sharply in \(\sigma_\xi\) than in \(k_0\).

The two criteria therefore agree about \(\sigma_\xi\) where agreement is informative, and differ about \(k_0\) where the criterion barely distinguishes the two answers.

Changing the criterion therefore moves the estimates little, and it leaves a large divergence in place.

45.7.1. The other specification#

Sargent and Yang report two descriptive fits and treat the pair as a sensitivity check.

Fixing \(\nu\) at the United States rate of \(0.02\) takes trend growth out of the descriptive model and leaves the transient gap to carry a growth miracle.

For China that replaces a gap of \(0.041\) decaying at \(0.52\) a year with one of \(0.086\) decaying at \(0.93\), and raises the persistent component \(B\) from \(0.0139\) to \(0.0176\).

We run the second stage again against those targets.

θ_fixed, D_fixed = {}, {}
for c in data:
    T = len(data[c])

    def criterion(u, c=c, T=T):
        θ = (1 + abs(u[0]), abs(u[1]), abs(u[2]))
        if not (1e-4 < θ[1] < 0.3 and 0.05 < θ[2] < 10 and θ[0] < 1.15):
            return 1e6
        return family_divergence(ψ_hat_fixed[c], binding(θ, T), T)

    u0 = np.array([θ_paper[c][0] - 1, θ_paper[c][1], θ_paper[c][2]])
    res = minimize(criterion, u0, method="Nelder-Mead",
                   options=dict(maxiter=150, maxfev=150, fatol=1e-7, xatol=1e-6))
    θ_fixed[c] = (1 + abs(res.x[0]), abs(res.x[1]), abs(res.x[2]))
    D_fixed[c] = res.fun

print(f"{'':14}{'g_μ est':>9}{'g_μ fix':>9}{'σ_ξ est':>9}{'σ_ξ fix':>9}"
      f"{'k0 est':>8}{'k0 fix':>8}{'D est':>8}{'D fix':>8}{'B at b, fix':>13}")
for c in data:
    e, f = θ_kl[c], θ_fixed[c]
    print(f"{NAMES[c]:14}{100*(e[0]-1):9.2f}{100*(f[0]-1):9.2f}{e[1]:9.3f}"
          f"{f[1]:9.3f}{e[2]:8.3f}{f[2]:8.3f}{D_kl[c]:8.2f}{D_fixed[c]:8.2f}"
          f"{binding(θ_fixed[c], len(data[c])).B:13.2e}")
                g_μ est  g_μ fix  σ_ξ est  σ_ξ fix  k0 est  k0 fix   D est   D fix  B at b, fix
China              4.78     2.17    0.022    0.037   1.042   0.660    8.25   27.61     3.27e-17
Singapore          2.26     1.86    0.031    0.031   0.513   0.571    1.68    2.15     5.13e-17
South Korea        3.63     2.81    0.031    0.029   1.047   0.953   13.66    9.78     3.65e-18

The estimates move, and they move most for China, whose estimated \(\nu\) of \(0.075\) had been doing the most work: TFP growth falls from \(4.78\) to \(2.17\) percent and initial capital from \(1.04\) to \(0.66\).

The residual divergence moves in both directions, more than tripling for China, rising by about a quarter for Singapore, and falling by about a quarter for South Korea, which gains a higher trend and a less persistent gap when \(\nu\) is fixed at \(0.02\).

What does not move is the projection: \(B\) is zero at the fixed-\(\nu\) estimates too, and a large divergence survives in every case.

The first-stage specification therefore sets the size of the discrepancy and the structural estimates, and the character of the discrepancy is the same under both.

45.8. The residual divergence#

The projection sets \(B = 0\) throughout the region of the parameter space that our estimates visit, and the end of this section reports the three exceptions that a wider scan turns up.

The two models disagree about the autocorrelation of growth.

In the Ramsey model, detrended output is \(\tilde y_t = \xi_t k_t^\alpha\) with \(\xi_t\) i.i.d., so (45.7) makes \(\log \xi_t\) enter \(\Delta y_{t+1}\) positively and \(\Delta y_{t+2}\) negatively.

Differencing an i.i.d. series produces an autocorrelation of exactly \(-1/2\).

Splitting the simulated growth rates into the two terms of (45.7) shows what the capital term adds.

def mean_autocorr(S, lag=1):
    "Average correlation between growth rates lag periods apart."
    s = np.sqrt(np.diag(S))
    return (np.diag(S, lag) / (s[:-lag] * s[lag:])).mean()


def growth_components(θ, T, n_paths=2000, seed=0):
    "Split simulated growth into its productivity and capital terms."
    μ, σ_ξ, k0 = θ
    m = ramsey_model(μ=μ, σ_ξ=σ_ξ)
    _, policy, _ = solve_ramsey(m)
    rng = np.random.default_rng(seed)
    ξ = np.exp(-0.5 * σ_ξ ** 2 + σ_ξ * rng.standard_normal((n_paths, T + 1)))
    pol, k = m.k[policy], np.full(n_paths, float(k0))
    log_k = np.empty((n_paths, T + 1))
    for t in range(T + 1):
        log_k[:, t] = np.log(k)
        if t < T:
            by_node = np.array([np.interp(k, m.k, pol[:, j])
                                for j in range(m.ξ.size)])
            k = interp_rows(m.ξ, by_node, ξ[:, t])
    return np.diff(np.log(ξ), axis=1), m.α * np.diff(log_k, axis=1)


d_ξ, d_k = growth_components(θ_kl["CHN"], len(data["CHN"]))
print(f"{'':22}{'std dev':>10}{'lag-1 autocorr':>17}")
for name, x in (("productivity term", d_ξ), ("capital term", d_k),
                ("growth rate", d_ξ + d_k)):
    print(f"{name:22}{x.std():10.4f}{mean_autocorr(np.cov(x, rowvar=False)):17.3f}")
print(f"correlation between the two terms: "
      f"{np.corrcoef(d_ξ.ravel(), d_k.ravel())[0, 1]:+.3f}")
                         std dev   lag-1 autocorr
productivity term         0.0313           -0.502
capital term              0.0084           -0.065
growth rate               0.0296           -0.480
correlation between the two terms: -0.338

The capital term has about a quarter of the productivity term’s standard deviation, is itself negatively autocorrelated, and is negatively correlated with the productivity term, which leaves the total at \(-0.48\).

In the descriptive family every autocovariance is non-negative.

Comparing the two requires care, because the covariance matrix that the Ramsey model delivers is taken across simulated paths at each date and so removes the declining mean path, while the raw autocorrelation of a single data series does not.

We therefore compare deviations around each fitted mean path.

print(f"{'':14}{'raw data':>10}{'data around':>13}{'descriptive':>13}{'Ramsey':>9}")
print(f"{'':14}{'':>10}{'fitted mean':>13}{'implied':>13}{'':>9}")
for c, dy in data.items():
    T = len(dy)
    resid = dy - amf_mean(ψ_hat[c], T)
    _, S_P = structural_moments(θ_kl[c], T)
    print(f"{NAMES[c]:14}{np.corrcoef(dy[:-1], dy[1:])[0, 1]:10.3f}"
          f"{np.corrcoef(resid[:-1], resid[1:])[0, 1]:13.3f}"
          f"{mean_autocorr(amf_cov(ψ_hat[c], T)):13.3f}"
          f"{mean_autocorr(S_P):9.3f}")
                raw data  data around  descriptive   Ramsey
                          fitted mean      implied
China              0.548        0.567        0.577   -0.480
Singapore          0.245       -0.023        0.107   -0.491
South Korea        0.362        0.135        0.432   -0.487

Most of the raw autocorrelation in Singapore’s and South Korea’s growth rates comes from the declining mean path, which the Ramsey model reproduces.

Around that path, China’s deviations remain strongly autocorrelated at \(+0.57\), South Korea’s weakly at \(+0.14\), and Singapore’s not at all.

The disagreement is large for China.

Released from the restriction \(B \geq 0\), the projection chooses a negative \(B\) and reaches a lower cross entropy.

print(f"{'':14}{'B (B ≥ 0)':>11}{'B (free)':>10}{'C (B ≥ 0)':>12}{'C (free)':>11}")
for c, dy in data.items():
    T = len(dy)
    μ_P, S_P = structural_moments(θ_kl[c], T)
    b_pos, C_pos = project(μ_P, S_P)
    b_free, C_free = project(μ_P, S_P, b_free=True)
    print(f"{NAMES[c]:14}{b_pos.B:11.5f}{b_free.B:+10.5f}{C_pos:12.3f}{C_free:11.3f}")
                B (B ≥ 0)  B (free)   C (B ≥ 0)   C (free)
China             0.00000  -0.00882    -119.012   -123.039
Singapore         0.00000  -0.00742    -153.792   -158.011
South Korea       0.00000  -0.01893    -161.987   -168.944

A boundary solution can be an artifact of an optimizer, so we check the first-order conditions directly.

At the projection the derivative of the cross entropy is negligible in the four free directions and large and positive in \(B\).

def cross_entropy_gradient(ψ, μ_P, S_P, h=1e-6):
    "Central differences of the cross entropy in each parameter."
    out = {}
    for k, name in enumerate(ψ._fields):
        up, down = list(ψ), list(ψ)
        up[k] += h
        down[k] -= h
        if name == "B":                      # one sided at the boundary B = 0
            out[name] = (cross_entropy(AMF(*up), μ_P, S_P)
                         - cross_entropy(ψ, μ_P, S_P)) / h
        else:
            out[name] = (cross_entropy(AMF(*up), μ_P, S_P)
                         - cross_entropy(AMF(*down), μ_P, S_P)) / (2 * h)
    return out

μ_P, S_P = structural_moments(θ_kl["CHN"], len(data["CHN"]))
b_chn, _ = project(μ_P, S_P)
grad = cross_entropy_gradient(b_chn, μ_P, S_P)
for name, g in grad.items():
    print(f"  ∂C/∂{name:<3} = {g: .3e}")
  ∂C/∂ν   =  0.000e+00
  ∂C/∂φ   = -1.137e-07
  ∂C/∂B   =  6.447e+02
  ∂C/∂F   = -2.757e-06
  ∂C/∂x0  =  0.000e+00

The four free derivatives are smaller than the derivative in \(B\) by eight orders of magnitude, and what remains of them reflects the tolerance at which the search over \(\phi\) and \(b\) stops.

That is the Karush-Kuhn-Tucker condition for a minimum at a boundary: raising \(B\) raises the cross entropy.

The result does not depend on the simulation.

print(f"{'seed':>5}{'paths':>8}{'B':>12}{'φ':>9}{'F':>9}")
for seed in (0, 1, 2):
    for n_paths in (2000, 8000):
        b, _ = project(*structural_moments(θ_kl["CHN"], len(data["CHN"]),
                                           n_paths=n_paths, seed=seed))
        print(f"{seed:5d}{n_paths:8d}{b.B:12.2e}{b.φ:9.4f}{b.F:9.4f}")
 seed   paths           B        φ        F
    0    2000    1.12e-17   0.8471   0.0287
    0    8000    9.77e-18   0.8473   0.0287
    1    2000    3.03e-18   0.8470   0.0287
    1    8000    3.52e-18   0.8466   0.0286
    2    2000    3.51e-18   0.8487   0.0286
    2    8000    9.70e-18   0.8474   0.0286

Wherever the projection sets \(B = 0\), the divergence that indirect inference can reach is bounded below by the divergence from \(\hat\psi\) to the closest member of the family with \(B = 0\).

Computing that bound needs no Ramsey model.

A scan over a grid in \((\mu, \sigma_\xi, k_0)\) shows how far that holds.

T_chn = len(data["CHN"])
exceptions = []
for μ_g in (1.00, 1.02, 1.05, 1.08):
    for σ_g in (0.005, 0.02, 0.05, 0.10):
        for k_g in (0.1, 0.5, 2.0, 5.0):
            μ_P, S_P = structural_moments((μ_g, σ_g, k_g), T_chn)
            b, _ = project(μ_P, S_P)
            if b.B > 1e-10:
                exceptions.append(((μ_g, σ_g, k_g), b.B, mean_autocorr(S_P)))

print(f"grid points with B > 0: {len(exceptions)} of 64")
for θ_g, B_g, ac in exceptions:
    print(f"  μ={θ_g[0]:.2f} σ_ξ={θ_g[1]:.3f} k0={θ_g[2]:.1f}: "
          f"B={B_g:.2e}, lag-1 autocorrelation {ac:+.3f}")
grid points with B > 0: 3 of 64
  μ=1.00 σ_ξ=0.005 k0=0.1: B=2.20e-03, lag-1 autocorrelation -0.480
  μ=1.02 σ_ξ=0.005 k0=0.1: B=1.37e-03, lag-1 autocorrelation -0.480
  μ=1.05 σ_ξ=0.005 k0=0.1: B=5.40e-04, lag-1 autocorrelation -0.469

The exceptions all combine a nearly deterministic technology with a capital stock far below the balanced growth path, and at each of them the autocorrelation of growth is still about \(-0.48\).

What lifts \(B\) there is the profile of variances over the sample rather than the sign of the autocovariance.

The bound is therefore a numerical finding over the region that our estimates visit, not a theorem.

def closest_with_B_zero(ψ_a, T):
    "min over (ν, φ, F, x0) of D(Q_{ψ_a} ‖ Q_ψ) subject to B = 0."
    S_a, m_a = amf_cov(ψ_a, T), amf_mean(ψ_a, T)

    def at(φ):
        Z = np.column_stack([np.ones(T), φ ** np.arange(T)])
        c, *_ = np.linalg.lstsq(Z, m_a, rcond=None)
        r = m_a - Z @ c
        F = np.sqrt((np.trace(S_a) + r @ r) / T)
        ψ = AMF(c[0], φ, 0.0, F, c[1])
        return family_divergence(ψ_a, ψ, T), ψ

    grid = np.linspace(0.01, 0.99, 99)
    φ0 = grid[int(np.argmin([at(φ)[0] for φ in grid]))]
    res = minimize(lambda u: at(1 / (1 + np.exp(-u[0])))[0],
                   [np.log(φ0 / (1 - φ0))], method="Nelder-Mead",
                   options=dict(xatol=1e-10, fatol=1e-12))
    return at(1 / (1 + np.exp(-res.x[0])))

print(f"{'':14}{'D at θ̂':>9}{'bound':>9}{'share':>8}{'D per year':>12}{'exp(D)':>12}")
for c, dy in data.items():
    T = len(dy)
    bound, _ = closest_with_B_zero(ψ_hat[c], T)
    print(f"{NAMES[c]:14}{D_kl[c]:9.3f}{bound:9.3f}{bound / D_kl[c]:8.1%}"
          f"{D_kl[c] / T:12.3f}{np.exp(D_kl[c]):12.0f}")
                D at θ̂    bound   share  D per year      exp(D)
China             8.248    7.772   94.2%       0.211        3821
Singapore         1.678    0.937   55.8%       0.029           5
South Korea      13.656   12.552   91.9%       0.228      852268

The last column converts the divergence into a likelihood ratio.

Since \(D(Q_{\hat\psi}\|Q_{b})\) is the expected log likelihood ratio under \(Q_{\hat\psi}\), its exponential is the geometric mean of the likelihood ratio between the two models on a sample of \(T\) growth rates.

Dividing by \(T\) puts the three economies on a common footing, at \(0.21\), \(0.03\), and \(0.23\) nats a year; South Korea’s larger total reflects its longer sample as much as its worse fit.

The restriction \(B = 0\) accounts for almost all of the divergence that remains for China and South Korea, and for a little more than half of it for Singapore.

Singapore’s fitted \(B\) is \(0.0032\), a quarter of China’s, so less of its divergence comes from this source.

Sargent and Yang’s three moments contain no autocovariance, so no value of their criterion registers this discrepancy.

The projection locates it in a single parameter, at a boundary.

45.8.1. Evidence on \(B\)#

The projection measures the discrepancy against \(\hat\psi\), a posterior median.

Whether the data insist on \(B > 0\) is a separate question, and it has a different answer in each economy.

The profile log likelihood maximizes over \(\nu\), \(\phi\), \(F\), and \(x_0\) at each value of \(B\).

def profile_B(dy, B, starts=(0.3, 0.9)):
    "Maximized log likelihood of the growth path at a fixed B."
    def negative(u):
        ψ = AMF(u[0], 1 / (1 + np.exp(-u[1])), B, abs(u[2]), u[3])
        return -amf_loglike(ψ, dy)
    best = np.inf
    for φ0 in starts:
        res = minimize(negative, [0.03, np.log(φ0 / (1 - φ0)), 0.03, dy[0] - 0.03],
                       method="Nelder-Mead",
                       options=dict(maxiter=4000, maxfev=4000, fatol=1e-10, xatol=1e-8))
        best = min(best, res.fun)
    return -best


B_grid = np.array([0.0, 0.003, 0.006, 0.0139, 0.02])
print(f"{'':14}" + "".join(f"{b:>9.4f}" for b in B_grid) + f"{'median B':>11}")
for c, dy in data.items():
    prof = np.array([profile_B(dy, b) for b in B_grid])
    prof -= prof.max()
    print(f"{NAMES[c]:14}" + "".join(f"{v:>9.2f}" for v in prof)
          + f"{ψ_hat[c].B:>11.4f}")
                 0.0000   0.0030   0.0060   0.0139   0.0200   median B
China             -5.52    -4.33    -1.96     0.00    -1.51     0.0139
Singapore          0.00    -1.82    -3.36    -6.40    -6.78     0.0032
South Korea        0.00    -1.71    -3.05    -6.47    -8.90     0.0056

Each row reports the profile log likelihood relative to its maximum over the grid.

China’s likelihood peaks near its posterior median and pays about five and a half log points at \(B = 0\).

Singapore’s and South Korea’s likelihoods peak at \(B = 0\) and pay two or three log points at their posterior medians.

Sargent and Yang’s half-normal prior puts no mass below zero, so it delivers a positive posterior median even when the likelihood is flat or falling in \(B\).

Their reported intervals say the same thing: the 95 percent interval for \(B\) is \((0.0060, 0.0239)\) for China, \((0.0000, 0.0137)\) for Singapore, and \((0.0000, 0.0136)\) for South Korea.

We evaluate the divergence at the lower end of each interval.

B_low = {"CHN": 0.0060, "SGP": 0.0000, "KOR": 0.0000}

print(f"{'':14}{'D at median':>12}{'D at lower end':>16}{'share':>8}")
for c, dy in data.items():
    T = len(dy)
    b = binding(θ_kl[c], T)
    ψ_low = ψ_hat[c]._replace(B=max(B_low[c], 1e-6))
    D_low = family_divergence(ψ_low, b, T)
    print(f"{NAMES[c]:14}{D_kl[c]:12.3f}{D_low:16.3f}{D_low / D_kl[c]:8.1%}")
               D at median  D at lower end   share
China                8.248           3.295   39.9%
Singapore            1.678           0.779   46.4%
South Korea         13.656           3.752   27.5%

Moving \(B\) to the bottom of its interval removes about \(60\) percent of China’s divergence and about \(70\) percent of South Korea’s.

These shares differ from the \(94\) and \(92\) percent of the preceding section because the two calculations ask different questions.

The earlier one holds \(\hat\psi\) fixed and asks how close any \(B = 0\) model can come to it; this one moves \(\hat\psi\) itself and asks how much of the distance survives when \(B\) is as small as the posterior allows.

Neither is a statement about the data, since both reference a posterior median whose other four components stay at values the joint posterior need not support at a marginal endpoint for \(B\).

The Ramsey model’s failure to generate positively autocorrelated deviations is therefore a sharp finding for China, whose likelihood and posterior both demand \(B > 0\), and a soft one for Singapore and South Korea, whose likelihoods do not.

This is the lesson that Leamer [1978] drew, and Sargent and Yang close their abstract with it: their analysis “illustrates how priors and likelihoods jointly determine posterior distributions and inferences about parameters.”

The projection localizes a discrepancy in one parameter, and only the prior and the likelihood together say how much of that parameter the data supply.

The figure below compares growth rates in the data with those of the fitted descriptive model and of the Ramsey model at the indirect inference estimates.

fig, axes = plt.subplots(1, 3, figsize=(14, 4))
rng = np.random.default_rng(7)
for ax, (c, dy) in zip(axes, data.items()):
    T = len(dy)
    m = ramsey_model(μ=θ_kl[c][0], σ_ξ=θ_kl[c][1])
    _, σ, _ = solve_ramsey(m)
    sim = simulate_ramsey(m, σ, θ_kl[c][2], T, 400, rng)
    lo, hi = np.percentile(sim, [5, 95], axis=0)
    ax.fill_between(np.arange(1, T + 1), lo, hi, alpha=0.2,
                    label="Ramsey, 90 percent band")
    ax.plot(np.arange(1, T + 1), sim.mean(axis=0), lw=2, label="Ramsey, mean")
    ax.plot(np.arange(1, T + 1), amf_mean(ψ_hat[c], T), "--", lw=2,
            label="descriptive, mean")
    ax.plot(np.arange(1, T + 1), dy, "k-", lw=1.2, label="data")
    ax.axhline(0, color="0.7", lw=0.8)
    ax.set_title(NAMES[c])
    ax.set_xlabel("$t$")
axes[0].set_ylabel(r"$\Delta y_t$")
axes[0].legend(fontsize=8)
plt.show()
_images/534f3b4d8ea2a0ad435b8d80e8a614612c91c5044922131f5a38cb65ddca2ca3.png

Fig. 45.4 Growth rates in data and models#

Both models send expected growth from a high initial value toward a lower long-run value, and the Ramsey model’s band covers most of the realized path.

The two models differ in the year-to-year pattern inside the band.

45.9. A specification test#

The divergences of the last section are distances between fitted objects.

They do not say whether a distance is larger than sampling variation in a sample of forty or sixty years would produce.

To ask that, we need a statistic computed from the data and a distribution for it under the hypothesis that the Ramsey model generated the data.

45.9.1. The statistic#

The descriptive model supplies the statistic, and the Ramsey model supplies the distribution.

Let \(\ell_T(\psi)\) be the log likelihood of the observed growth path under \(Q_\psi\), and compare the best descriptive model with the one that the Ramsey model projects onto:

(45.9)#\[LR_T = 2\left[ \max_{\psi} \ell_T(\psi) - \ell_T\bigl(b(\hat\theta)\bigr) \right] .\]

\(LR_T\) measures how much better a free descriptive model describes the data than the descriptive model that the structural model implies.

Under the hypothesis that \(P_{\hat\theta}\) generated the data, \(LR_T\) is small: the simulations below put its median between \(1.0\) and \(1.6\).

The same concentration that served the projection serves the maximization in (45.9): at fixed \(\phi\) and \(b = B/F\), the whitened residuals are linear in \((\nu, x_0)\) and \(F^2\) is the residual mean square, so the likelihood reduces to a two-dimensional search.

def concentrated_loglike(φ, b, dy):
    "Log likelihood maximized over (ν, x0, F) at fixed (φ, b = B/F)."
    T = len(dy)
    unit = AMF(0.0, φ, b, 1.0, 0.0)
    Z = np.column_stack([np.ones(T), φ ** np.arange(T)])
    Z_w, d_w = whiten(unit, Z), whiten(unit, dy)[:, 0]
    c, *_ = np.linalg.lstsq(Z_w, d_w, rcond=None)
    rss = ((d_w - Z_w @ c) ** 2).sum()
    F = np.sqrt(rss / T)
    return -0.5 * T * (np.log(2 * np.pi * rss / T) + 1), AMF(c[0], φ, b * F, F, c[1])


def fit_descriptive(dy, φ_max=0.999, b_max=3.0):
    "Maximum likelihood by a two-dimensional search over (φ, b)."
    def negative(u):
        φ = φ_max / (1 + np.exp(-u[0]))
        return -concentrated_loglike(φ, min(abs(u[1]), b_max), dy)[0]

    best = None
    for φ0, b0 in ((0.4, 0.2), (0.9, 0.2)):
        res = minimize(negative, [np.log(φ0 / (1 - φ0)), b0], method="Nelder-Mead",
                       options=dict(maxiter=400, maxfev=400, fatol=1e-10, xatol=1e-8))
        if best is None or res.fun < best.fun:
            best = res
    φ = φ_max / (1 + np.exp(-best.x[0]))
    return concentrated_loglike(φ, min(abs(best.x[1]), b_max), dy)

The bound \(\phi \leq 0.999\) keeps the maximization away from the ridge that Exercise 45.4 examines, on which \(\phi \to 1\) and only \(\nu + x_0\) is identified.

Without it the maximum is not attained.

45.9.2. The null distribution#

Standard asymptotics would send \(LR_T\) to a chi-squared distribution with \(\dim\psi - \dim\theta = 2\) degrees of freedom.

Two features of this problem put that outside its warrant: \(b(\hat\theta)\) minimizes a divergence between distributions rather than the sample likelihood, so it is not the constrained maximum likelihood estimate, and Sargent and Yang build their model class to violate the stationarity and ergodicity that the asymptotics assume.

We therefore simulate the null distribution, drawing growth paths of the same length from the Ramsey model at \(\hat\theta\) and recomputing (45.9) on each.

def specification_test(c, n_samples=400, seed=12345):
    "Parametric bootstrap of LR_T under the Ramsey model at θ̂."
    dy, T = data[c], len(data[c])
    μ, σ_ξ, k0 = θ_kl[c]
    m = ramsey_model(μ=μ, σ_ξ=σ_ξ)
    _, policy, _ = solve_ramsey(m)
    ψ_b = binding(θ_kl[c], T)

    def statistic(path):
        return 2 * (fit_descriptive(path)[0] - amf_loglike(ψ_b, path))

    paths = simulate_ramsey(m, policy, k0, T, n_samples, np.random.default_rng(seed))
    null = np.array([statistic(paths[i]) for i in range(n_samples)])
    observed = statistic(dy)
    p_value = (1 + (null >= observed).sum()) / (1 + n_samples)
    return observed, null, p_value


results = {c: specification_test(c) for c in data}

print(f"{'':14}{'LR':>8}{'null median':>13}{'null 95th':>11}"
      f"{'p value':>10}{'χ²(2) 95th':>12}")
for c in data:
    observed, null, p_value = results[c]
    print(f"{NAMES[c]:14}{observed:8.2f}{np.median(null):13.2f}"
          f"{np.percentile(null, 95):11.2f}{p_value:10.3f}"
          f"{chi2.ppf(0.95, 2):12.2f}")
                    LR  null median  null 95th   p value  χ²(2) 95th
China            17.20         1.61       6.50     0.005        5.99
Singapore         3.85         1.02       6.01     0.120        5.99
South Korea      22.43         1.03       6.02     0.002        5.99

The simulated null distributions sit close to the chi-squared distribution that the asymptotics would have suggested, which is reassuring but not something the test relies on.

The test rejects the Ramsey model for China and for South Korea, and does not reject it for Singapore.

Repeating the simulation with other seeds and with twice as many artificial samples moves the p values within \(0.001\) to \(0.005\) for China, \(0.001\) to \(0.002\) for South Korea, and \(0.11\) to \(0.15\) for Singapore, so the Monte Carlo error does not drive the verdicts.

45.9.3. What the test rejects#

Splitting \(LR_T\) at the best descriptive model with \(B = 0\) separates the autocorrelation of growth from everything else:

\[ LR_T = \underbrace{2\left[\max_{\psi} \ell_T(\psi) - \max_{\psi: B = 0} \ell_T(\psi)\right]}_{\text{from } B} \; + \; \underbrace{2\left[\max_{\psi: B = 0} \ell_T(\psi) - \ell_T(b(\hat\theta))\right]}_{\text{from the rest}} . \]
def fit_descriptive_B0(dy, φ_max=0.999):
    "Maximum likelihood subject to B = 0: a one-dimensional search over φ."
    def negative(u):
        return -concentrated_loglike(φ_max / (1 + np.exp(-u[0])), 0.0, dy)[0]

    best = min((minimize(negative, [np.log(φ0 / (1 - φ0))], method="Nelder-Mead",
                         options=dict(maxiter=200, maxfev=200,
                                      fatol=1e-10, xatol=1e-8))
                for φ0 in (0.4, 0.9)), key=lambda r: r.fun)
    return -best.fun


print(f"{'':14}{'LR':>8}{'from B':>9}{'from the rest':>15}")
for c, dy in data.items():
    observed = results[c][0]
    from_B = 2 * (fit_descriptive(dy)[0] - fit_descriptive_B0(dy))
    print(f"{NAMES[c]:14}{observed:8.2f}{from_B:9.2f}{observed - from_B:15.2f}")
                    LR   from B  from the rest
China            17.20    11.25           5.95
Singapore         3.85     0.00           3.85
South Korea      22.43     0.00          22.43

Two thirds of China’s statistic comes from \(B\), which is the discrepancy that The residual divergence measures.

None of South Korea’s does, because its own maximum likelihood estimate of \(B\) is zero.

South Korea’s rejection comes entirely from the rest, which is the shape of the mean path: its likelihood wants \(\phi\) at the bound and a growth gap that decays almost linearly over sixty years, while \(b(\hat\theta)\) delivers \(\phi = 0.86\).

Because that likelihood has no maximizer, South Korea’s \(LR_T\) has no bound-free value and the \(22.4\) we report is the value at \(\phi \leq 0.999\).

The bootstrap imposes the same bound, so the test is valid even though the statistic is not bound-free.

All of Singapore’s statistic sits in the rest as well, and all of it is small.

fig, axes = plt.subplots(1, 3, figsize=(14, 4))
for ax, c in zip(axes, data):
    observed, null, p_value = results[c]
    ax.hist(null, bins=30, density=True, alpha=0.6, label="null distribution")
    ax.axvline(observed, color="k", lw=2,
               label=f"observed ({observed:.1f})")
    ax.axvline(np.percentile(null, 95), color="r", ls="--", lw=1.2,
               label="95th percentile")
    ax.set_title(f"{NAMES[c]}, p = {p_value:.3f}")
    ax.set_xlabel("$LR_T$")
    ax.set_xlim(0, max(observed, np.percentile(null, 99)) * 1.1)
axes[0].set_ylabel("density")
axes[0].legend(fontsize=8)
plt.show()
_images/21b1e566a1e37e1e5dcc39960b9c2d4ca95c9a93968f75e0725fed81a4e5e721.png

Fig. 45.5 Simulated null distribution of \(LR_T\)#

We hold \(\hat\theta\) fixed across the artificial samples instead of re-estimating it on each one.

Re-estimating would typically raise \(\ell_T(b(\theta))\) on every artificial sample and so lower the simulated statistic, and the observed statistic already enjoys a \(\hat\theta\) fitted to its own data.

Both effects raise the critical value relative to the observed statistic, so the test errs toward not rejecting.

And the test conditions on \(\alpha\), \(\beta\), \(\gamma\), and \(\delta\), which Sargent and Yang fix rather than estimate, so it asks whether the three free parameters can reconcile that calibration with the data and not whether some Ramsey model can.

45.9.4. Why the two diagnostics differ#

The residual divergence attributes \(92\) percent of South Korea’s divergence to the restriction \(B = 0\), and the test attributes none of its rejection to that restriction.

The two measure the discrepancy against different targets.

The divergence compares the Ramsey model with \(Q_{\hat\psi}\), whose \(B\) of \(0.0056\) comes from a prior that puts no mass below zero.

The test compares it with the data, whose likelihood sets \(B\) to zero.

Where the prior and the likelihood disagree about a parameter, a diagnostic aimed at the posterior and a diagnostic aimed at the data will disagree about what the structural model gets wrong.

45.10. Concluding remarks#

Sargent and Yang’s two stages fit a descriptive model to growth rates and then choose Ramsey parameters to match three moments of that fit.

Reading the second stage as an information projection onto the descriptive family changes three things.

The criterion becomes a divergence rather than a weighted distance between three statistics, and the metric it implies for small departures is the Fisher information of the descriptive model rather than a diagonal matrix of estimated moment variances.

The projection delivers all five descriptive parameters at every candidate \(\theta\), so the comparison with \(\hat\psi\) reports which parameters the structural model can reach and which it cannot.

The part of the divergence that no \(\theta\) removes becomes a number, and for China and South Korea one restriction accounts for almost all of it.

The estimates themselves barely move.

Across every parameter vector that we tried, the Ramsey model with i.i.d. productivity shocks delivers growth rates with autocorrelation near \(-0.48\), and the three moments do not ask it for anything else.

A likelihood ratio test rejects the model for China and South Korea at the five percent level and does not reject it for Singapore.

The test and the divergence agree about China and part company over South Korea, for the reason that A specification test sets out.

Exercise 45.3 makes the productivity shock persistent and finds that persistence moves the autocorrelation to \(+0.30\) at \(\rho = 0.99\), still short of China’s \(+0.57\).

Specification Tests develops tests of this kind, and Approximation Errors in Time Series Models studies what a projection discards.

Statistical Divergence Measures and Likelihood Ratio Processes approach the same question from the other side, asking how large a sample has to be before a likelihood ratio separates two models that lie a given divergence apart.

45.11. Exercises#

Exercise 45.1

This exercise establishes the three properties of the descriptive family that the lecture uses.

  1. Show that \(\Sigma(\psi) = L(\psi)L(\psi)^\top\) with \(L\) as in (45.2), and conclude that \(\log\det\Sigma(\psi) = 2T\log F\).

  2. Show that \(\operatorname{Cov}(\Delta y_1, \Delta y_{1+k}) = BF\phi^{k-1}\) for \(k \geq 1\), and that for a later pair the autocovariance carries the additional term \(B^2\phi^k(1-\phi^{2(i-1)})/(1-\phi^2)\). Conclude that the family cannot produce a negative autocovariance when \(B \geq 0\), \(F > 0\), and \(0 < \phi < 1\).

  3. Verify both claims numerically, and verify that whiten applied to a simulated path recovers the shocks that generated it.

  4. Explain why the m-projection onto this family depends on the projected distribution only through its mean vector and covariance matrix, and why the projection of \(Q_{\psi}\) is \(Q_\psi\) itself.

Exercise 45.2

This exercise compares the two criteria for one economy.

  1. Write Sargent and Yang’s criterion \(Q(\theta) = (\bar m(\theta) - \hat m)^\top W (\bar m(\theta) - \hat m)\) with \(W\) the identity, using the three moments of (45.3) and their simulated counterparts.

  2. Estimate \(\theta\) for China by minimizing \(Q\), starting from Sargent and Yang’s estimate.

  3. Report both estimates, the divergence \(D(Q_{\hat\psi}\|Q_{b(\theta)})\) at each, and the three moments at each.

  4. Explain why the two criteria locate \(\mu\) and \(\sigma_\xi\) so similarly and \(k_0\) so differently.

Exercise 45.3

The Ramsey model’s i.i.d. productivity shock delivers negatively autocorrelated growth rates.

Replace it with an AR(1) in logs,

\[ \log \xi_{t+1} = \rho \log \xi_t + \sigma_\eta \eta_{t+1} , \qquad \eta_{t+1} \sim \mathcal{N}(0,1) , \]

and hold the unconditional standard deviation \(\sigma_\eta/\sqrt{1-\rho^2}\) at Sargent and Yang’s \(\sigma_\xi\), so that the amount of productivity risk does not change with \(\rho\).

  1. Discretize the shock with the method of Tauchen [1986], solve the model over the state \((k, \xi)\), and simulate growth rates.

  2. For China’s \(\theta\), report the model’s average lag-one autocorrelation of growth and the projection \(b(\theta)\) for \(\rho \in \{0, 0.5, 0.9, 0.99\}\).

  3. At which \(\rho\) does the projection leave the boundary \(B = 0\), and does any \(\rho\) reach the autocorrelation in China’s data?

Exercise 45.4

The lecture takes \(\hat\psi\) from Sargent and Yang’s posterior medians rather than from maximum likelihood.

This exercise shows why that choice matters.

  1. For each economy, maximize the log likelihood of the growth path under (45.1) over \(\psi\) from several starting values, and compare the maximum with the value at \(\hat\psi\).

  2. Report the maximizer for South Korea. What happens to \(\nu\), \(x_0\), and \(\phi\)?

  3. Trace the profile log likelihood of South Korea along \(\nu\), maximizing over the other four parameters. What shape does it have?

  4. Explain which of Sargent and Yang’s priors removes the problem, and what that implies for the divergences that this lecture computes.