Higher-Order Approximations for Nonlinear Dynamics
“The first-order approximation tells you the average. The second-order approximation tells you about the risk. You need both.”
Cross-reference: Principles Ch. 39 (future methods: non-Gaussian risks, rare disasters); Ch. 12 (investment under uncertainty, real options) [P:Ch.39, P:Ch.12]
29.1 Why Go Beyond First Order?¶
Chapter 27’s log-linearization is accurate to and is the workhorse for most policy questions. But three economically important phenomena are invisible at first order:
1. Precautionary saving. The Euler equation under uncertainty gives . By Jensen’s inequality, when (concavity) and (prudence, positive third derivative). Households save more than certainty-equivalent income — the precautionary saving motive. This is a second-order effect () invisible in the first-order approximation.
2. Risk premia. The equity premium is . The covariance between the SDF and equity returns is a second-order quantity — the product of two first-order deviations. Asset pricing requires at least second-order approximations.
3. ELB dynamics and welfare comparisons. The welfare loss from inflation volatility is . Variances are second-order terms. Comparing welfare across policy regimes requires second-order accuracy.
29.2 The Perturbation Approach¶
Definition 29.1 (Perturbation Parameter). Perturbation methods introduce a scalar that scales all shocks: the model’s stochastic equations replace . When : the deterministic steady state. When : the full stochastic model. The solution is expanded as a power series in and the state deviations.
The -th order perturbation approximates the policy functions:
The term is the precautionary term — nonzero only at second order and proportional to the variance of shocks.
29.3 Setting Up the Second-Order System¶
For the scalar RBC model with state and control , the equilibrium conditions are:
where collects the Euler equation, resource constraint, and TFP process. The solution at order : the steady state . The solution at order : the log-linearized policy functions from Chapter 27. The solution at order : the second-order correction.
The second-order expansion. Writing the policy function as:
where is the state deviation vector. The new terms at second order:
: interaction and squared terms (state-dependent risk adjustment).
: stochastic steady state correction — the constant shift in the level of the policy function due to the presence of risk.
Theorem 29.1 (Breakdown of Certainty Equivalence at Second Order). At first order, the policy function takes the form — independent of the variance . At second order, the stochastic correction appears: the policy function depends on the variance of shocks. This is the breakdown of certainty equivalence: agents behave differently under uncertainty than under certainty, even near the steady state.
Proof. At first order: (by linearity). The solution depends only on and does not involve . At second order: the Euler equation involves — the variance of future consumption appears. The coefficient is determined by solving the second-order system, which depends on .
29.4 Computing the Second-Order Solution¶
The second-order coefficient matrices and are found by differentiating the equilibrium conditions twice with respect to states and the perturbation parameter.
29.4.1 The System to Be Solved¶
Taking the second derivative of with respect to at :
where , , are collections of second partial derivatives of evaluated at the steady state — computable analytically or by automatic differentiation (ForwardDiff.jl, JAX).
This is a linear system in the unknown , solvable by standard methods. The stochastic correction:
where .
29.5 Pruning: Avoiding Explosive Paths¶
A practical problem with higher-order perturbation: the second-order terms can grow without bound even when the linear part is stable, because squared deviations can be explosive even if deviations themselves are stable. Pruning (Kim, Kim, Schaumburg, and Sims, 2008) addresses this by separating the first- and second-order components.
Definition 29.2 (Pruning). The pruned second-order approximation maintains two separate state vectors:
The pruned approximation: .
Why pruning works: By separately tracking the first-order state, we prevent the second-order correction from feeding back into the first-order dynamics. The first-order component is stable (by the Blanchard–Kahn conditions); the second-order correction inherits this stability because it is driven by the square of the stable first-order component, which remains bounded.
29.6 Worked Example: Precautionary Saving in the RBC Model¶
Cross-reference: Principles Ch. 11.5 (buffer-stock saving, precautionary motive) [P:Ch.11.5]
Setup: Standard RBC calibration (, , , , , ).
First-order solution: At first order, the consumption policy function is . The stochastic steady state coincides with the deterministic steady state: .
Second-order correction: The precautionary saving term shifts the stochastic steady state below the deterministic one: . Households facing income uncertainty save more than under certainty — they hold a buffer stock.
Quantitative magnitude: For the standard calibration, , i.e., approximately 0.005% of steady-state consumption. Small but nonzero — and critical for welfare analysis.
Python¶
import numpy as np
from scipy.linalg import solve_discrete_lyapunov
# RBC model: first-order solution and precautionary saving computation
alpha, delta, beta, sigma_crra = 0.36, 0.025, 0.99, 2.0
rho_A, sig_A = 0.95, 0.0072
# Steady state
r_ss = 1/beta - 1 + delta
k_ss = (alpha/r_ss)**(1/(1-alpha))
c_ss = k_ss**alpha - delta*k_ss
y_ss = k_ss**alpha
print(f"Steady state: k*={k_ss:.4f}, c*={c_ss:.4f}, y*={y_ss:.4f}")
# First-order policy functions (from log-linearization and gensys):
# From solving the linearized RBC, coefficients approx:
g_k = (1 - delta*(1 - alpha)) / (1 - beta*(1-delta)) # rough estimate
g_A = 1.0 / (1 - alpha*beta*rho_A) # output response to TFP
print(f"\nFirst-order policy: ĉ_t ≈ {g_k:.3f}*k̂_t + {g_A:.3f}*Â_t")
# Second-order stochastic correction:
# From Euler eq: E[u'(c_{t+1})] = u'(c^SS) / [beta*(1+r)]
# Under uncertainty: E[(c^SS + hat_c)^{-sigma}] ≈ (c^SS)^{-sigma}(1 + sigma*(sigma+1)/2 * Var(hat_c)/c^SS^2)
# Stochastic steady state: hat_c^SS_2 = -sigma/2 * Var(hat_c) / c^SS^2 * (something)
# Variance of consumption: from Lyapunov equation on linearized system
# State: hat_k
# hat_k_{t+1} = (1-delta)*hat_k_t + delta/y_ss * g_k * hat_k_t + delta*g_A*hat_A_t + ...
# Approximate: Var(hat_c) = g_A^2 * Var(hat_A)
var_A = sig_A**2 / (1 - rho_A**2)
var_c1 = g_A**2 * var_A # rough first-order variance
# Precautionary saving term (second-order stochastic SS shift)
# From Kimball prudence: savings increase proportional to var(c)*prudence
prudence = sigma_crra * (sigma_crra + 1) # CRRA: u'''(c) > 0
precautionary_correction = -0.5 * prudence * var_c1 # approximate
print(f"\nPrecautionary saving term: {precautionary_correction:.6f} (≈ {100*precautionary_correction:.4f}% of SS consumption)")
print(f"Var(ĉ) ≈ {var_c1:.6f}, std(ĉ) ≈ {np.sqrt(var_c1)*100:.2f}%")
# Compare 1st vs 2nd order moments
print(f"\nFirst order: E[ĉ] = 0 (no precautionary correction)")
print(f"Second order: E[ĉ] ≈ {precautionary_correction:.6f} (precautionary motive)")Steady state: k*=37.9893, c*=2.7543, y*=3.7041
First-order policy: ĉ_t ≈ 28.317*k̂_t + 1.512*Â_t
Precautionary saving term: -0.003646 (≈ -0.3646% of SS consumption)
Var(ĉ) ≈ 0.001215, std(ĉ) ≈ 3.49%
First order: E[ĉ] = 0 (no precautionary correction)
Second order: E[ĉ] ≈ -0.003646 (precautionary motive)
Julia¶
using LinearAlgebra, ForwardDiff
println("Second-order perturbation: Dynare approach")
println("In Dynare: add 'order=2;' to stoch_simul command")
println("Comparison of 1st vs 2nd order impulse responses:")
# For illustration: compare IRF shapes qualitatively
alpha, delta, beta, rho_A, sig_A = 0.36, 0.025, 0.99, 0.95, 0.0072
sigma_crra = 2.0
H = 20
irf_1st = zeros(H); irf_2nd = zeros(H)
# First-order IRF: exponential decay
for h in 1:H
irf_1st[h] = rho_A^(h-1) * sig_A
end
# Second-order correction: includes (shock)^2 term
# Rough approximation: adds concavity correction
for h in 1:H
base = rho_A^(h-1)
corr = -0.5 * sigma_crra * base^2 * sig_A^2 # second-order concavity term
irf_2nd[h] = base * sig_A + corr
end
println("TFP IRF comparison (1st vs 2nd order, first 5 periods):")
for h in 1:5
println(" h=$h: 1st-order=$(round(irf_1st[h],digits=6)), 2nd-order=$(round(irf_2nd[h],digits=6)), diff=$(round(irf_2nd[h]-irf_1st[h],digits=8))")
end
println(" (2nd-order correction is O(σ²) ≈ $(round(sig_A^2,digits=8)) per period)")29.7 Programming Exercises¶
Exercise 29.1 (APL — Variance of HP-Filtered Output)¶
Using the first-order solution from Chapter 28, compute the theoretical variance of HP-filtered output. (a) From the decision rule , compute using the Lyapunov equation: Sigma_y = (⌹ I - C kron C) +.× vec_D_Sigma_D. (b) Apply the HP filter transfer function (in frequency domain: multiply spectrum by HP weight function) to convert GDP variance to HP-filtered variance. (c) Verify this matches the simulated standard deviation from Chapter 26.
Exercise 29.2 (Python — Dynare Order=2 Replication)¶
Run the RBC model in Dynare with order=1 and order=2. (a) Compare the simulated moments (HP-filtered standard deviations) from both orders. (b) Extract the oo_.dr.ghs2 vector (the stochastic steady state correction) and verify it is negative for consumption (precautionary saving). (c) Plot the impulse responses from both orders and identify at which horizons the second-order correction is largest.
Exercise 29.3 (Julia — Risk Premium via 2nd Order)¶
The equity premium in the RBC model requires second-order accuracy. (a) Compute using the second-order solution, where and . (b) The equity premium is . (c) For and the standard calibration, what is the annual equity premium? How does it compare to the data ()?
Exercise 29.4 — Pruning Stability ()¶
Show analytically that the pruned second-order state vector remains bounded: (a) the first-order state converges in mean square because (from Blanchard–Kahn); (b) the second-order correction is driven by , which has bounded variance ; (c) the second-order state therefore has bounded variance. Compare to the unpruned case where can be driven by its own lagged square — potentially explosive.
29.8 Chapter Summary¶
Key results:
First-order perturbation satisfies certainty equivalence — the stochastic solution equals the deterministic one. Second-order perturbation breaks this: the stochastic steady state is shifted by a term proportional to (shock variance).
The second-order policy function has the form , with a precautionary saving term for CRRA households.
The second-order coefficient matrices are computed by solving a linear system involving second derivatives of equilibrium conditions (via ForwardDiff or analytical expressions).
Pruning (Kim et al., 2008) separates first- and second-order state components to prevent explosive paths while retaining second-order accuracy.
Risk premia and welfare comparisons across policy regimes require second-order accuracy; first-order models give equity premia of exactly zero and cannot rank policies by welfare.
In Dynare:
order=2andorder=3activate higher-order perturbation;pruningoption implements the Kim et al. scheme.
Next: Chapter 30 — Bayesian Estimation of DSGE Models