Warming up with the RBC Model¶
- Consider an RBC model in which preferences are given by
- E0∞∑t=0βtC1−γt1−γ,
- production follows
- Yt=ZtKαt−1ˉL1−α,
- capital evolves according to
- Kt=(1−δ)Kt−1+Yt−Ct,
- and productivity evolves according to
- logZt=ρlogZt−1+εt,
where ε is an i.i.d. mean-zero innovation. I have adopted an unconvention of dating the capital stock selected in period t and used in production in t+1 as Kt so that a variable dated t is measurable with respect to date-t information.
- The model can be summarized by the following expectational difference equations
- C−γt=βEt[Rt+1C−γt+1]Rt=αZt(Kt−1/ˉL)α−1+1−δKt=(1−δ)Kt−1+Yt−CtYt=ZtKαt−1ˉL1−αlogZt=ρlogZt−1+εt.
The unknown is a stochastic processes for Xt≡(Ct,Rt,Kt,Yt,Zt). We will linearize the model around the deterministic steady state and then solve for the dynamics of the economy that are locally accurate in a neighborhood of the steady state. We will fix ˉL=1. The steady state is then
Z=1R=1/βK=(R−1+δα)1/(α−1)Y=KαC=Y−δK.
- We then linearize the model equations to the form
- AEtXt+1+BXt+CXt−1+Eϵt=0,
where A, B, C, and E are matrices of coefficients and ϵt is a vector of shocks at date t.
Solving the linearized model¶
There are a variety of methods for solving linear rational expectations models. An intuitive solution method is provided by Rendahl (2017) [1] using a guess-and-verify approach based for a solution of the form Xt=PXt−1+Qϵt, where P and Q are coefficient matrices to be found. Plugging in this functional form
AEt[PXt+Qϵt+1]+BXt+CXt−1+Eϵt=0AEt[P(PXt−1+Qϵt)+Qϵt+1]+B(PXt−1+Qϵt)+CXt−1+Eϵt=0[AP2+BP+C]Xt−1+[APQ+BQ+E]ϵt=0.
ϵt+1 drops out of the linearized model because AQEtϵt+1=0. So the distribution of risks facing the economy do not influence the solution a property we call “certainty equivalence.” We seek values of P and Q that solve the above equation for all values of Xt−1 and ϵt, which means the two expressions in square brackets must be zero. Rendahl’s method finds a solution to AP2+BP+C=0 iteratively starting with an inital guess of a solution P(0). The method then supposes that P(0) will apply in period t+1 and solves for P(1) from
AP(n)P(n+1)+BP(n+1)+C=0P(n+1)=−[AP(n)+B]−1C.
One repeats this iteration until the solution for P(n+1) solves AP2+BP+C=0 to within some tolerance. With the solution for P in hand, one solves for Q from
APQ+BQ+E=0Q=−[AP+B]−1E.
With the solution for P and Q in hand, one can plot impulse response function, simulate business cycles, and calculate second moment properties of the economy.
Linearizing the model¶
In this example we could easily linearize the model by hand, but in the applications later that is a lot more work because there are many more equations in the system. Instead of doing it by hand, we will have the computer calculate the derivatives for us using a technique called automatic differentiation. The broad idea is that the computer knows how to differentiate basic mathematical operations and then strings them together using the Chain rule. That means that automatic differentiation works for computer code that can be considered as a series of basic mathematical operations and not, for example, an algorithm that iterates towards a solution. Here are some packages for automatic differentiation in Matlab and Python.
In practice we will write a function of the form F(Xt−1,Xt,Xt+1,ϵt)=0 that gives the residuals of the five model equations. Then we use automatic differentiation to differentiate this function at the steady state.
Footnotes
[1] | Rendahl, Pontus. “Linear Time Iteration.” (2017). |