6ansen RBC Model. FONCs. Equilibrium. Steady State. Log"Linearization. Dynamics. Analysis. Data vs. Simulation Results (
Practical Tools for DSGE Modeling Part 1
Mathias Trabandt
March 2014
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Aim of the Masterclass 1
Learning how to: Set up Solve and analyze DSGE models
2
Model workhorses: Hansen’s (1985) canonical Real Business Cycle model (Part 1 and 2) Clarida, Gali, and Gertler’s (1999) canonical New Keynesian model (Part 3 and 4)
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Selection of RBC Literature Kydland & Prescott (1982), "Time to Build and Aggregate Fluctuations", Econometrica Hansen (1985), "Indivisible Labor and the Business Cycle",Journal of Monetary Economics Rogerson (1988), ”Indivisible Labor, Lotteries and Equilibrium”, Journal of Monetary Economics Cooley (1995), editor, ”Frontiers of Business Cycle Research”, Princeton University Press King & Rebelo (1999), "Resuscitating Real Business Cycles", Handbook of Macroeconomics
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Data
Let’s take a look at some data.... ....before we start building a model to explain it.
Dynamics
Analysis
Data
Hansen RBC Model
FONCs
Data: US GDP
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Data: US Private Consumption
Dynamics
Analysis
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Data: US Private Investment
Dynamics
Analysis
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Data: US Hours Worked
Log-Linearization
Dynamics
Analysis
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
US Data (HP-Filtered)
Log-Linearization
Dynamics
Analysis
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Properties of US Data (HP-Filtered)
GDP Consumption Investment Hours
Crosscorrelation with GDP t-1 t t+1 t+2
Standard Deviation
t-2
1.68% 0.98% 4.70% 1.35%
0.60 0.64 0.59 0.50
0.84 0.77 0.73 0.73
1.00 0.80 0.77 0.87
0.84 0.63 0.60 0.83
0.60 0.41 0.35 0.65
RBC literature attempts to replicate data properties in a DSGE framework
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Why DSGE Models? Dynamic: intertemporal e¤ects of optimal economic decisions e.g. investment decisions; anticipation e¤ects
Stochastic: economic environment is subject to unexpected disturbances e.g. technology shocks
General Equilibrium: all markets clear endogenously and interdependently feedback e¤ects from policy to economic behavior and vice versa explicit treatment of agent’s expectations (Lucas critique) micro foundations; optimal plans
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Solution Strategy Uhlig (1999), "A toolkit for analysing nonlinear dynamic stochastic models easily" in Marimon and Scott, eds, Computational Methods for the Study of Dynamic Economies, Oxford University Press (book contains alternative solution methods as well) 1 2 3 4 5 6 7 8
Set up model Derive …rst order conditions De…ne equilibrium Solve for the steady state Log-Linearize Solve for the dynamics Analysis (Calibration, impulse responses, hp-…ltered moments) Recently: Estimation
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Step 1: Set up Hansen’s (1985) RBC Model ∞
Preferences : maxfCt ,Nt ,Kt ,It g∞ E0 ∑ βt [log Ct t=0
s.t. Production : Yt = Zt Ktα 1 Nt1 α ¯ + ρ log Z TFP : log Zt = (1 ρ) log Z t Capital acc. Feasibility Endowment Information
: : : :
ANt ]
t=0
1 + εt
with εt N (0, σ2 ) iid Kt = (1 δ)Kt 1 + It Ct + It = Yt K 1 given E0 , rational expectations, complete information
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Notes Stochastic version of neoclassical growth model Social planner problem. Isomorphic to decentralized problem (representative household and representative …rm) All variables in real terms. Normalized price level Elastic aggregate - inelastic individual labor supply (see Rogerson 1988) Literature Extensions: Sticky prices, sticky wages, consumption habit, investment adjustment and capacity utilization costs Monetary and …scal policy Open economy Information frictions Financial frictions, labor market frictions Deterministic or stochastic growth ...
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Step 2: Derive First Order Conditions
Lagrangian representation:
L=
max ∞
fCt ,Nt ,Kt gt=0
"
∞
E0 ∑ β t t=0
log Ct ANt Zt Ktα 1 Nt1 α
λ t ( Ct + Kt ( 1 δ ) Kt 1 )
#
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Step 2: Derive First Order Conditions “Telescope out”: 2
L=
max
fCt ,Nt ,Kt gt∞=0
6 6 6 E0 6 6 6 4
+ βt
... log Ct ANt Zt Ktα 1 N1t α
λt (Ct + Kt ( 1 δ ) Kt 1 )
Analysis
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Step 2: Derive First Order Conditions “Telescope out”: 2
L=
max
fCt ,Nt ,Kt gt∞=0
6 6 + βt 6 E0 6 6 6 + β t+1 4
... log Ct ANt λt (Ct + Kt Zt Ktα 1 N1t α (1 δ)Kt 1 ) log Ct+1 ANt+1 λt (Ct+1 + Kt+1 Zt+1 Ktα Nt1+1α (1 δ)Kt ) +...
3 7 7 7 7 7 7 5
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Step 2: Derive First Order Conditions Derivatives: ∂L 1 = βt βt λt = 0 ∂Ct Ct ∂L = βt A + βt λt (1 α) Zt Ktα 1 Nt α = 0 ∂Nt ∂L αZt+1 Ktα 1 Nt1+1α = β t λ t + β t + 1 Et λ t + 1 =0 +(1 δ) ∂Kt ∂L = β t Ct + β t Kt βt Zt Ktα 1 Nt1 α βt (1 δ)Kt 1 = 0 ∂λt De…ne real return Rt = α KYt t 1 + (1 obtain...
δ) and simplify to
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Step 3: Equilibrium Equations Labor/Leisure :
A Ct = ( 1
Euler Equation : 1 = βEt
α)
Yt Nt
Ct Rt + 1 Ct + 1
Production : Yt = Zt Ktα 1 Nt1 α Feasibility : Ct + Kt = Yt + (1 δ)Kt 1 Yt + (1 δ ) Real Return : Rt = α Kt 1 TFP : log Zt = (1 ρ) log Z¯ + ρ log Zt Check: 6 equations in 6 unknowns
1
+ εt
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Solving the Model
No closed form solution possible (except for very special cases such as δ = 1 and constant hours) Need numerical methods to solve the model Solve for steady state (no shocks, constant variables) Solve for dynamics around steady state (‡uctuations of variables due to shocks) Uhlig (1999) and others
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Step 4: Solve for the Steady State Drop time subscripts of equilibrium equations 2 possibilities: solve for endogenous varables given parameters (δ, β, α, ρ, A) ¯ impose steady states (great ratios KY¯ etc) and back out corresponding parameters
Solve Euler equation for: 1 R¯ = β Solve real return equation for: ¯ Y¯ R = K¯
1+δ α
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Step 4: Solve for the Steady State TFP equation implies: ¯ =Z ¯ Z Production function yields: " Y¯ ¯ ¯ = Z N
Y¯ K¯
α
#
1 1 α
Solve labor/leisure tradeo¤ for: C¯ = (1
α)
1 Y¯ ¯ AN
Solve feasibility constraint for: ¯ = N
¯ C
(1
¯
¯
Y δ KY¯ ) N ¯
Remaining steady states trivial: Y¯ =
Y¯ ¯ ¯ N, N
K¯ =
K¯ ¯ Y Y¯
etc.
Analysis
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Step 5: Log-Linearization
Want to solve for dynamics around steady state Equilibrium equations nonlinear - hard to solve Key steps: replace nonlinear equations with log-linearized equations thereafter use method of undetermined coe¢ cients (Uhlig 1999) to solve system of linear equations
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Step 5: Log-Linearization In general, for x
0,
ex
1+x
Log deviation of xt from x¯ : xˆ t = log
xt x¯
100*ˆxt is approximately the % deviation of xt from x¯ Key relation: xt = x¯ exˆ t x¯ (1 + xˆ t ) Note: results identical to a 1st order Taylor series approximation
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Log-Linearization - 2 Examples Take the labor-leisure trade o¤ equation: A Ct = ( 1
α)
Yt Nt
¯ cˆt , Yt = Ye ¯ yˆ t , Nt = Ne ¯ nˆ t : Substitute Ct = Ce ¯ cˆt Ne ¯ nˆ t = (1 α) Ye ¯ yˆ t A Ce ¯N ¯ = (1 α) Y¯ in steady state: Note that A C ecˆt +nˆ t = eyˆ t So that: 1 + cˆ t + nˆ t cˆ t + nˆ t
1 + yˆ t yˆ t
Dynamics
Analysis
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Log-Linearization - 2 Examples Take the feasibility constraint equation: Ct + Kt = Yt + ( 1
δ ) Kt
1
¯ cˆt , Yt = Ye ¯ yˆ t , Kt = Ke ¯ kˆ t : Substitute Ct = Ce ¯ yˆ t + (1 ¯ cˆt + Ke ¯ kˆ t = Ye Ce
¯ kˆ t δ)Ke
1
So that ¯ (1 + cˆ t ) + K¯ (1 + kˆ t ) C Note that C¯ + K¯ = Y¯ + (1 ¯ ct + K¯ kˆ t Cˆ
Y¯ (1 + yˆ t ) + (1
δ)K¯ (1 + kˆ t
¯ δ)K: ¯ yt + ( 1 Yˆ
δ)K¯ kˆ t
1
1)
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Log-Linearized Equilibrium Equations
Labor/Leisure : cˆ t + nˆ t = yˆ t Euler Equation : 0 = Et cˆ t cˆ t+1 + Rˆ t+1 Production : yˆ t = zˆ t + αkˆ t 1 + (1 α) nˆ t ¯ ct + K¯ kˆ t = Yˆ ¯ yt + (1 δ)K¯ kˆ t Feasibility : Cˆ ¯ ¯R ˆ t = α Y yˆ t kˆ t 1 Real Return : R K¯ TFP : zˆ t = ρˆzt 1 + εt
1
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Comparison With Non-Linear Equations
Labor/Leisure :
A Ct = ( 1
Euler Equation : 1 = βEt
α)
Yt Nt
Ct Rt + 1 Ct + 1
Production : Yt = Zt Ktα 1 Nt1 α Feasibility : Ct + Kt = Yt + (1 δ)Kt 1 Yt Real Return : Rt = α + (1 δ ) Kt 1 TFP : log Zt = (1 ρ) log Z¯ + ρ log Zt
1
+ εt
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Step 6: Solve for the Dynamics
Use method of undetermined coe¢ cients (Uhlig 1999) to solve system of log-linear equations Key steps: repeated substitution of log-linear equilibrium equations until 3 equations in 3 unknows are obtained guess recursive law of motions (RLOM) compare coe¢ cients and solve
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Step 6: Solve for the Dynamics Combine the labor/leisure trade o¤, the production function, the real return and the Euler equation to obtain: 0 = Et [cˆ t
α1 cˆ t+1 + α2 zˆ t+1 ]
(1)
¯
¯
where α1 = 1 + KY¯ 1 R¯ α and α2 = KY¯ R1¯ . Combine feasibility constraint, production function and labor/leisure trade o¤ to obtain: h i ˆ ˆ 0 = Et α3 cˆ t + α4 kt α5 zˆ t α6 kt 1
¯ α5 = ¯ + Y¯ 1 α , α4 = K, where α3 = C α ¯ α6 = Y¯ + (1 δ)K.
Y¯ α
(2)
and
TFP equation: zˆ t = ρˆzt
1
+ εt
(3)
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Step 6: Solve for the Dynamics Guess recursive law of motion (RLOM) for kˆ t and cˆ t : kˆ t = η kk kˆ t cˆ t = η kˆ t ck
+ η kz zˆ t ˆt 1 + η cz z 1
(Brain teaser: why is this a good guess?) For zˆ t we have: zˆ t = ρˆzt 1 + εt Substitute RLOM into equations (1) and (2) and use also Et [zˆ t+1 ] = ρˆzt to obtain...
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Step 6: Solve for the Dynamics 2 equations in the date t states of the model: 0 = [(1
α1 η kk )η ck ] kˆ t
0 = [α3 η ck + α4 η kk
1
+ [η cz (1
α6 ] kˆ t
1
α1 ρ ) + α2 ρ
+ [α3 η cz + α4 η kz
α1 η ck η kz ] zˆ t α5 ] zˆ t
Both equations must hold with equality for all realizations of kˆ t 1 and zˆ t Compare coe¢ cients on kˆ t 1 (i.e. set zˆ t = 0): 0 = (1 α1 η kk )η ck 0 = α3 η ck + α4 η kk α6
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Step 6: Solve for the Dynamics Solve for η kk : η kk =
1 α1
+ 2
α6 α4
v u u t
1 α1
+
α6 α4
2
Choose stable root, i.e. kη kk k < 1. Solve for η ck : α6 α4 η ck = η α3 α3 kk
!2
α6 α1 α4
Analysis
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Step 6: Another solution? Note that there is another candidate solution that solves: 0 = (1 α1 η kk )η ck 0 = α3 η ck + α4 η kk α6 Candidate solution: η ck = 0, η kk =
α6 α4
However, note that in this case Y¯ + (1 δ) K¯ α6 = η kk = α4 K¯ ¯ 1+δ R = +1 δ α R¯ 1 + (1 α) δ = 1+ >1 α Solution implies no stable root.
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Step 6: Solve for the Dynamics Compare coe¢ cients on zˆ t (i.e. set kˆ t
1
= 0):
0 = η cz (1 α1 ρ) + α2 ρ 0 = α3 η cz + α4 η kz α5 Solve for η cz : η cz =
α1 η ck αα54 1
α2 ρ
α1 ρ + α1 η ck αα34
Finally, solve for η kz : η kz =
α1 η ck η kz
α5 α4
α3 η α4 cz
Analysis
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Step 7: Analysis Calibration/Parameterization, see Hansen (1985), Cooley (1995) etc: Parameter β δ α A Z¯ ρ σ
Value 0.99 0.025 0.36 2.5 1 0.95 0.71%
Description Discount factor (quarterly) Depreciation rate (quarterly) Capital share Disutility of labor parameter Steady state TFP (normalization) AR(1) parameter TFP Standard deviation of TFP shock
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Step 7: Analysis Using these parameters we can calculate the steady state numerically: Variable Model US Data Description K¯ Y¯ I¯ Y¯ ¯ C Y¯
N
2.56 0.26 0.74 0.34
2.38 0.25 0.61 0.25
Capital–output ratio (annual) Investment-output ratio Consumption-output ratio Labor
Note that the model abstracts from government spending ¯ which would imply lower YC¯ . Also, a higher A would imply a ¯ if desired. lower N,
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Step 7: Analysis Using parameters we can calculate the RLOM numerically: kˆ t = 0.94kˆ t cˆ t = 0.53kˆ t
+ 0.16ˆzt zt 1 + 0.47ˆ 1
For zˆ t we have: zˆ t = 0.95ˆzt
1
+ εt with εt
N (0, 0.00712 ) iid
We are now ready to do impulse responses, simulations etc
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Step 7: Analysis Driving force in RBC model is exogenous TFP: zˆ t = ρˆzt
1
+ εt
Impulse Responses: Analyze the dynamics in response to a one-time technology shock I.e., εt = 1 for t = 0 and εt = 0 for t 1 and simulate the endogenous model response
Simulations: Either draw εt N (0, σ2 ) iid and simulate Or construct time series for zˆ t by using data together with Yt = Zt Ktα 1 Nt1 α and simulate
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Impulse Responses to TFP Shock
Dynamics
Analysis
Data
Hansen RBC Model
FONCs
Equilibrium
Steady State
Log-Linearization
Dynamics
Analysis
Data vs. Simulation Results (all hp-…ltered) Draw εt
N (0, σ2 ) iid and simulate model many times: Crosscorrelation with GDP Standard Deviation
t-2
t-1
t
t+1
t+2
1.68%
0.60
0.84
1.00
0.84
0.60
GDP
Data Model
1.80%
0.47
0.71
1.00
0.71
0.47
Consumption
Data
0.98%
0.64
0.77
0.80
0.63
0.41
Model
0.52%
0.24
0.52
0.87
0.77
0.66
Data
4.70%
0.59
0.73
0.77
0.60
0.35
Model
5.75%
0.51
0.73
0.99
0.67
0.40
Data
1.35%
0.50
0.73
0.87
0.83
0.65
Model
1.37%
0.53
0.74
0.98
0.64
0.37
Investment
Hours