Undergraduate Computational Macro
To introduce an endogenous choice, consider how an agent would compare alternative bundles of consumption goods. Assume agent:
This leads to preferences that are additively separable and they compare \(\{c_t\}_{t=0}^\infty\) streams of consumption at time \(t\)
\[ \sum_{j=0}^\infty \beta^j u(c_{t+j}) \]
What if the agent does not know \(\{c_t\}_{t=0}^\infty\) because it is random or uncertain?
In that case, we can instead have the agent compare expected utility streams
\[ \mathbb{E}_t\left[\sum_{j=0}^\infty \beta^j u(c_{t+j})\right] \]
Consider a utility \(u(c)\) and a lottery which is a random variable
Note if risk-neutral then \(\mathbb{E}[C] = \frac{1}{2} c_L + \frac{1}{2}c_H = \bar{c} = u(\bar{c})\)
Then if an agent is risk-averse, \[ u(\mathbb{E}(C)) > \mathbb{E}[u(C)] \]
Alternatively, if all of those accounting relationships must hold, substitute to form a single budget
Given forecasts of \(c_{t+j}\) and \(y_{t+j}\), the budget must fulfill
\[ \underbrace{\mathbb{E}_t\left[\sum_{j=0}^{\infty}\frac{c_{t+j}}{R^j}\right]}_{\text{EPDV of consumption}} = \underbrace{\mathbb{E}_t\left[\sum_{j=0}^{\infty} \frac{y_{t+j}}{R^j}\right]}_{\text{EPDV of income}} + F_t \]
The \(F_t\) is the current financial assets. Consider leaving in bank to pay for \(c_{t+j}\)
In that case, we see that the budget constraint simplifies to
\[ \underbrace{\mathbb{E}_t\left[\sum_{j=0}^{\infty}\beta^j c_{t+j}\right]}_{\text{EPDV of consumption}} = \underbrace{\mathbb{E}_t\left[\sum_{j=0}^{\infty} \beta^j y_{t+j}\right]}_{\text{EPDV of income}} + F_t \]
\[ \begin{aligned} \max_{\{c_{t+j}, F_{t+j+1}\}_{j=0}^\infty} & \mathbb{E}_t\left[\sum_{j=0}^\infty \beta^j u(c_{t+j})\right] \\ \text{s.t.} \,& F_{t+j+1} = R(F_{t+j} + y_{t+j} - c_{t+j})\,\quad \text{ for all } j \geq 0\\ & \text{no-ponzi scheme/transversality condition} \end{aligned} \]
While we cannot in extensions with borrowing constraints, etc., here we can use the LBC
\[ \begin{aligned} \max_{\{c_{t+j}\}_{j=0}^\infty} & \mathbb{E}_t\left[\sum_{j=0}^\infty \beta^j u(c_{t+j})\right] \\ \text{s.t.} \,& \mathbb{E}_t\left[\sum_{j=0}^{\infty}R^{-j} (c_{t+j}-y_{t+j})\right] = F_t \end{aligned} \]
Would they change their mind and choose a different \(c_{t+1}\) than their plan?
Solve for \(c_t\) and plan \(c_{t+1}\) for all \(y_{t+1}\) realizations \[ \max_{\{c_{t+j}\}_{j=0}^\infty} \mathbb{E}\left[\sum_{j=0}^\infty \beta^j u(c_{t+j})\,|\,\mathcal{I}_t\right] \text{ s.t.} \, \mathbb{E}\left[\sum_{j=0}^{\infty}R^{-j} (c_{t+j}-y_{t+j})\,|\,\mathcal{I}_t\right] = F_t \]
See \(y_{t+1}\) and \(F_{t+1}\) and “reoptimize”, solving for \(c_{t+1}\) \[ \max_{\{c_{t+j+1}\}_{j=0}^\infty} \mathbb{E}\left[\sum_{j=0}^\infty \beta^j u(c_{t+j+1})\,|\,\mathcal{I}_{t+1}\right] \text{ s.t.} \, \mathbb{E}\left[\sum_{j=0}^{\infty}R^{-j} (c_{t+j+1}-y_{t+j+1})\,|\,\mathcal{I}_{t+1}\right] = F_{t+1} \]
Without proof, with these preferences the plan is time-consistent: they will not want to change their plan, even after seeing \(y_{t+j}\) for \(j > 0\)
Without a full derivation, can show that the solution to this problem exists, for strictly concave \(u(c)\) where, given a \(F_0\) initial condition
\[ \begin{aligned} u'(c_t) &= \beta R\, \mathbb{E}_t[u'(c_{t+1})],\quad \text{ Euler equation} \\ F_{t+1} &= R(F_t + y_t - c_t),\quad \text{ Budget Constraint}\\ 0 &= \mathbb{E}_0\left[\lim_{j \to \infty} \beta^j F_{t+j}\right],\quad \text{ No-Ponzi Scheme} \end{aligned} \]
Still challenging since we need to forecast optimal \(c_{t+1}\)
Euler Equations are ubiquitous intertemporal optimality conditions
\[ u'(c_t) = \beta R\, \mathbb{E}_t[u'(c_{t+1})] \]
The cost consuming less today is the marginal utility today, \(u'(c_t)\)
The right-hand term is the benefit
\[ \begin{aligned} \max_{c_t} & \left[u(c_t) + \beta \mathbb{E}_t[u(c_{t+1})]\right]\\ & \text{s.t.} \,c_{t+1} = y_{t+1} + R(F_t + y_t - c_t) \end{aligned} \]
\[ \max_{c_t} \left[u(c_t) + \beta \mathbb{E}_t[u(y_{t+1} + R(F_t + y_t - c_t))]\right] \]
\[ \begin{aligned} 0 &= u'(c_t) - \beta R \mathbb{E}_t[u'(y_{t+1} + R(F_t + y_t - c_t))]\\ u'(c_t) &= \beta R\, \mathbb{E}_t[u'(c_{t+1})] \end{aligned} \]
If \(y_t\) is deterministic, then this problem no longer requires forcasts
Furthermore, assume \(\beta R = 1\) (i.e. interest exactly offsets impatience)
\[ u'(c_t) = u'(c_{t+1}) \]
Moreover, given assumptions that \(u'(c) > 0\) and \(u''(c) < 0\), this implies that \(c_t = c_{t+1}\)
This is the classic Permanent Income Result
With \(\beta R = 1\), use \(c_t = \bar{c}\) with the LBC \[ \begin{aligned} \sum_{j=0}^{\infty}\beta^j c_{t+j} &= \sum_{j=0}^{\infty}\beta^j y_{t+j} + F_t\\ \bar{c} \sum_{j=0}^{\infty}\beta^j &= \sum_{j=0}^{\infty}\beta^j y_{t+j} + F_t\\ c_t = \bar{c} &= \underbrace{(1-\beta)}_{\text{MPC}}\bigg[\underbrace{\sum_{j=0}^{\infty}\beta^j y_{t+j}}_{\text{Human Wealth}} + F_t\bigg] \end{aligned} \]
\[te F_{t+1} = R(F_t - c_t) = R\left(F_t - \frac{R-1}{R}F_t\right) = F_t \]
Leaving \(\beta R = 1\) for the remainder of the slides
Optimality: agents would LOVE to equate all marginal utilities
\[ u'(c_t) = \mathbb{E}_t[u'(c_{t+1})] \]
With enough financial instruments to hedge all risks, they might!
Since \(u'(c) = a_2 c + a_1\) we can write the euler equation as
\[ \begin{aligned} u'(c_t) &= \mathbb{E}_t[u'(c_{t+1})]\\ a_2 c_t + a_1 &= \mathbb{E}_t[a_2 c_{t+1} + a_1]\\ c_t &= \mathbb{E}_t[c_{t+1}] \end{aligned} \]
With more general strictly concave preferences, often: \(c_t \approx \mathbb{E}_t[c_{t+1}]\)
We know that \(c_t = \mathbb{E}_t[c_{t+1}]\) and there is no systematic bias in forecasting
Changes are driven by shocks. Without proof, can show
\[ c_{t+1} - c_t = (1-\beta)\sum_{j=0}^\infty \beta^j \left[\mathbb{E}_{t+1}[y_{t+j+1}] - \mathbb{E}_t[y_{t+j+1}]\right] \]
While this theory applies to any stochastic process for income, consider a special case which is a Linear Gaussian State Space \[ \begin{aligned} x_{t+1} & = A x_t + C w_{t+1},&\text{ evolution equation} \\ y_t &= G x_t,&\text{ observation equation} \end{aligned} \]
Key result if \(\beta\in(0,1)\) and \(\max\{|\text{ eigenvalue of } A|\} < 1/\beta\):
\[ \mathbb{E}_t\left[\sum_{j=0}^\infty \beta^j y_{t+j}\right] = G (I - \beta A)^{-1} x_t \]
Take the optimal consumption we derived earlier
\[ \begin{aligned} c_t &= (1-\beta)\left[\mathbb{E}_t\left[\sum_{j=0}^\infty \beta^j y_{t+j}\right] + F_t\right]\\ &= (1-\beta)\left[G (I - \beta A)^{-1} x_t + F_t\right] \end{aligned} \]
We can use this in the evolution of the financial assets, with \(R = 1/\beta\)
\[ \begin{aligned} F_{t+1} &= \beta^{-1}(F_t + y_t - c_t)\\ &= \beta^{-1}(F_t + G x_t - (1-\beta)\left[G (I - \beta A)^{-1} x_t + F_t\right])\\ &= F_t + G(I - \beta A)^{-1}(I - A)x_t,\quad \text{ after some algebra} \end{aligned} \]
The impulse is a \(w_1\) shock, typically just zeros and ones depending on the experiment and then \(w_{t+1} = 0\) for all \(t > 1\)
Then for some \(x_0\) initial condition, compare the evolution with this shock relative to one with \(w_{t+1} = 0\) for all \(t\geq 1\)
Denote the version with zero shocks throughout as \(\bar{x}_t\), then
\[ \begin{aligned} x_1 - \bar{x}_1 &= A x_0 + C w_1 - (A x_0 + C\times 0) = C w_1\\ x_2 - \bar{x}_2 &= A x_1 + C \times 0 - (A \bar{x}_1 + C\times 0)= A C w_1 \end{aligned} \]
More generally, for any \(t > 0\)
Consider instead the expected present-discounted value of this “shock”
\[ \sum_{j=0}^\infty \beta^j y_{t+j} - \sum_{j=0}^\infty \beta^j \bar{y}_{t+j} = \sum_{j=0}^\infty \beta^j G A^{t+j-1} C w_1 = G(I - \beta A)^{-1} C w_1 \]
Going back to the change in consumption, we can show that
\[ \begin{aligned} c_{t+1} - c_t &= (1-\beta)\sum_{j=0}^\infty \beta^j \left[\mathbb{E}_{t+1}[y_{t+j+1}] - \mathbb{E}_t[y_{t+j+1}]\right]\\ &= (1-\beta)G(I - \beta A)^{-1} C w_{t+1} \end{aligned} \]
Consider the case where IID income: \(y_t \sim N(\mu, \sigma^2)\)
One way to write as a state-space model is: \(x_t \equiv \begin{bmatrix} w_t & 1 \end{bmatrix}^{\top}\)
\[ \begin{aligned} \underbrace{\begin{bmatrix} w_{t+1} \\ 1 \end{bmatrix}}_{x_{t+1}} &= \underbrace{\begin{bmatrix} 0 & 0 \\ 0 & 1 \end{bmatrix}}_{A} \underbrace{\begin{bmatrix} w_t \\ 1 \end{bmatrix}}_{x_t} + \underbrace{\begin{bmatrix} 1 \\ 0 \end{bmatrix}}_{C} w_{t+1}\\ y_t &= \underbrace{\begin{bmatrix} \sigma & \mu \end{bmatrix}}_{G} \underbrace{\begin{bmatrix} w_t \\ 1 \end{bmatrix}}_{x_t} \end{aligned} \]
\[ \begin{aligned} \underbrace{\begin{bmatrix} w_{t+1}\\ 1 \\ F_{t+1} \end{bmatrix}}_{\tilde{x}_{t+1}} &= \underbrace{\begin{bmatrix} 0 & 0 & 0\\ 0 & 1 & 0\\ \sigma & 0 & 1 \end{bmatrix}}_{\tilde{A}} \underbrace{\begin{bmatrix} w_t \\ 1 \\ F_t \end{bmatrix}}_{\tilde{x}_t} + \underbrace{\begin{bmatrix} 1 \\0 \\ 0 \end{bmatrix}}_{\tilde{C}} w_{t+1}\\ \underbrace{\begin{bmatrix} y_t \\ c_t \end{bmatrix}}_{\tilde{y}_t} &= \underbrace{\begin{bmatrix} \sigma & \mu & 0\\ (1-\beta)\sigma & \mu & 1-\beta \end{bmatrix}}_{\tilde{G}} \underbrace{\begin{bmatrix} w_t \\ 1 \\ F_t \end{bmatrix}}_{\tilde{x}_t} \end{aligned} \]
From this, we see that
\[ F_{t+1} = F_t + \sigma w_t \]
Note that if \(F_0 = 0\) and \(w_0 = 0\) (i.e., \(y_t = \mu\))
\[ F_t = \sigma w_0 + \sigma w_1 + \ldots + \sigma w_{t-1} = \sigma \sum_{j=0}^{t-1} w_j \]
The row of \(\tilde{G}\) in the LSS row is \(c_t = \mu + (1-\beta)\left[\sigma w_t + F_t\right]\)
And with \(F_0 = 0\) and \(w_0 = 0\) (i.e., \(y_t = \mu\))
\[ c_t = \mu + (1-\beta)\left[\sigma w_t + \sigma \sum_{j=0}^{t-1} w_j\right] = \mu + (1-\beta)\sigma \sum_{j=0}^t w_j \]
Change in consumption is driven by IID shocks. MPC \(\times\) annuitized value of the shock \[ c_{t+1} - c_t = (1-\beta)\sigma w_{t+1} \]
function simulate_iid_income(p, T; w = randn(T))
w_sum = cumsum(w) #(w_1, w_1 + w_2, w_1 + w_2 + w_3, ... sum_{j=1}^T w_j))
c = p.mu .+ (1 - p.beta) * p.sigma * w_sum # (c_1, c_2, ... c_T)
y = p.mu .+ p.sigma * w # (y_1, y_2, ... y_T)
F = [0.0; p.sigma * w_sum[1:end-1]] #(F_1, F_2, ... F_T)
return (;w, F, c, y)
end
p = (;beta= 1.0 / (1.0 + 0.05), mu = 1.0, sigma = 0.15)
T = 60
res = simulate_iid_income(p, T)
plot(1:T, res.y, color = :green, label = L"non-financial income, $y_t$",
xlabel="Time", legend = :bottomright)
plot!(res.c, color = :black, label = L"consumption, $c_t$")
plot!(res.F, color = :blue, label = L"Assets, $F_t$")
hline!([p.mu], color = :black, linestyle = :dash, label = L"mean income, $\mu$")
A = [0 0; 0 1]
G = [p.sigma p.mu]
C = [1; 0]
H = G*inv(I-p.beta*A)
A_tilde = [A zeros(2,1); H*(I-A) 1]
C_tilde = [C; 0]
G_tilde = [G 0; (1-p.beta)*H 1-p.beta]
x_tilde_0 = [0.0, 1, 0.0] #[w_0, 1, F_0]
lss_pi = LSS(A_tilde, C_tilde, G_tilde;
mu_0 = x_tilde_0)
x, y = simulate(lss_pi, T)
plot(1:T, y[1,:];label=L"y_t", size=(600,400))
plot!(1:T, y[2,:], label=L"c_t")
hline!([p.mu], color=:black, linestyle=:dash,
label = L"mean income, $\mu$")
Classic model analyzes income with persistent and transitory shocks
Let \(x_{1t}\) be the permanent component and \(x_{2t}\) be the transitory component where \[ \begin{bmatrix} x_{1t+1}\\ x_{2t+1} \end{bmatrix} = \underbrace{\begin{bmatrix} 1 & 0\\ 0 & 0 \end{bmatrix}}_{A} \begin{bmatrix} x_{1t}\\ x_{2t} \end{bmatrix} + \underbrace{\begin{bmatrix} \sigma_1 & 0\\ 0 &\sigma_2 \end{bmatrix}}_{C} \underbrace{\begin{bmatrix}w_{1t+1}\\w_{2t+1} \end{bmatrix}}_{w_{t+1}} \]
And income itself is the sum of these two components
\[ y_t = \underbrace{\begin{bmatrix} 1 & 1 \end{bmatrix}}_{G}\begin{bmatrix} x_{1t}\\ x_{2t} \end{bmatrix} \]
function iterate_LSS(A, C, G, x_0, T; w = randn(size(C,2), T))
x = zeros(length(x_0), T + 1)
x[:, 1] = x_0
for t in 2:(T + 1)
x[:, t] = A * x[:, t - 1] + C * w[:, t - 1]
end
return x, G * x #x, y
end
function IRF(A, C, G, w_1, T)
h_x = zeros(size(A,1), T+1)
h_x[:,2] = C * w_1
for t in 3:T+1
h_x[:,t] = A * h_x[:,t-1]
end
return h_x, G * h_x #h_x, h_y
end
sigma_1, sigma_2 = 0.15, 0.15
beta = 1.0/(1.0 + 0.05)
A = [1 0; 0 0]
G = [1 1]
C = [sigma_1 0; 0 sigma_2]
H = G*inv(I-beta*A)
A_tilde = [A zeros(2,1); H*(I-A) 1]
C_tilde = [C; zeros(1,2)]
G_tilde = [G 0; (1-beta)*H 1-beta]
x_tilde_0 = [1.0, 0.0, 0.0]#[x_10, x_20, F_0]
lss_pi = LSS(A_tilde, C_tilde, G_tilde;
mu_0 = x_tilde_0)
T = 20
x, y = simulate(lss_pi, T)
plot(1:T, y[1,:];label=L"y_t",size=(600,400))
plot!(1:T, y[2,:], label=L"c_t")