Estimating dynamic stochastic general equilibrium models in Stata - - PowerPoint PPT Presentation

estimating dynamic stochastic general equilibrium models
SMART_READER_LITE
LIVE PREVIEW

Estimating dynamic stochastic general equilibrium models in Stata - - PowerPoint PPT Presentation

Estimating dynamic stochastic general equilibrium models in Stata David Schenck Senior Econometrician Stata 2017 Canadian Stata User Group Meeting June 9, 2017 Schenck (Stata) DSGE June 9, 2017 1 / 21 Motivation Models used in


slide-1
SLIDE 1

Estimating dynamic stochastic general equilibrium models in Stata

David Schenck

Senior Econometrician Stata

2017 Canadian Stata User Group Meeting June 9, 2017

Schenck (Stata) DSGE June 9, 2017 1 / 21

slide-2
SLIDE 2

Motivation

Models used in macroeconomics for policy analysis

Schenck (Stata) DSGE June 9, 2017 2 / 21

slide-3
SLIDE 3

Motivation

Models used in macroeconomics for policy analysis Dynamic

Schenck (Stata) DSGE June 9, 2017 2 / 21

slide-4
SLIDE 4

Motivation

Models used in macroeconomics for policy analysis Dynamic Stochastic

Schenck (Stata) DSGE June 9, 2017 2 / 21

slide-5
SLIDE 5

Motivation

Models used in macroeconomics for policy analysis Dynamic Stochastic General equilibrium

Schenck (Stata) DSGE June 9, 2017 2 / 21

slide-6
SLIDE 6

Here’s a model in words

Households

Consume and save output Take inflation and interest rate as given

Schenck (Stata) DSGE June 9, 2017 3 / 21

slide-7
SLIDE 7

Here’s a model in words

Households

Consume and save output Take inflation and interest rate as given

Firms

Produce output and set prices Take demand as given

Schenck (Stata) DSGE June 9, 2017 3 / 21

slide-8
SLIDE 8

Here’s a model in words

Households

Consume and save output Take inflation and interest rate as given

Firms

Produce output and set prices Take demand as given

Central bank

Sets interest rate Adjusts interest rate in response to inflation

Schenck (Stata) DSGE June 9, 2017 3 / 21

slide-9
SLIDE 9

Here’s a model in words

Households

Consume and save output Take inflation and interest rate as given

Firms

Produce output and set prices Take demand as given

Central bank

Sets interest rate Adjusts interest rate in response to inflation

In equilibrium, this is a model that simultaneously determines output, inflation, and the interest rate

Schenck (Stata) DSGE June 9, 2017 3 / 21

slide-10
SLIDE 10

Here’s a model in equations I

Households demand output, given inflation and interest rates: xt = Et(xt+1) − (rt − Et(πt+1) − zt)

Schenck (Stata) DSGE June 9, 2017 4 / 21

slide-11
SLIDE 11

Here’s a model in equations I

Households demand output, given inflation and interest rates: xt = Et(xt+1) − (rt − Et(πt+1) − zt) Firms set prices, given output demand: πt = βEt(πt+1) + κxt

Schenck (Stata) DSGE June 9, 2017 4 / 21

slide-12
SLIDE 12

Here’s a model in equations I

Households demand output, given inflation and interest rates: xt = Et(xt+1) − (rt − Et(πt+1) − zt) Firms set prices, given output demand: πt = βEt(πt+1) + κxt Central bank sets interest rate, given inflation rt = 1 β πt + ut

Schenck (Stata) DSGE June 9, 2017 4 / 21

slide-13
SLIDE 13

Here’s a model in equations II

The model’s endogenous variables are characterized by equations: xt = Et(xt+1) − (rt − Et(πt+1) − zt) πt = βEt(πt+1) + κxt rt = 1 β πt + ut

Schenck (Stata) DSGE June 9, 2017 5 / 21

slide-14
SLIDE 14

Here’s a model in equations II

The model’s endogenous variables are characterized by equations: xt = Et(xt+1) − (rt − Et(πt+1) − zt) πt = βEt(πt+1) + κxt rt = 1 β πt + ut The model is completed by adding equations for the state variables: zt+1 = ρzzt + ξt+1 ut+1 = ρuut + εt+1

Schenck (Stata) DSGE June 9, 2017 5 / 21

slide-15
SLIDE 15

Here’s a model in Stata I

The model equations: xt = Et(xt+1) − (rt − Et(πt+1) − zt) πt = βEt(πt+1) + κxt rt = 1 β πt + ut zt+1 = ρzzt + ξt+1 ut+1 = ρuut + εt+1

Schenck (Stata) DSGE June 9, 2017 6 / 21

slide-16
SLIDE 16

Here’s a model in Stata I

The model equations: xt = Et(xt+1) − (rt − Et(πt+1) − zt) πt = βEt(πt+1) + κxt rt = 1 β πt + ut zt+1 = ρzzt + ξt+1 ut+1 = ρuut + εt+1 In Stata:

. dsge (x = E(F.x) - (r - E(F.p) - z), unobserved) /// (p = {beta}*E(F.p) + {kappa}*x) /// (r = 1/{beta}*p + u) /// (F.z = {rhoz}*z, state) /// (F.u = {rhou}*u, state)

Schenck (Stata) DSGE June 9, 2017 6 / 21

slide-17
SLIDE 17

Here’s a model in Stata II

. dsge (x = E(F.x) - (r - E(F.p) - z), unobserved) /// (p = {beta}*E(F.p) + {kappa}*x) /// (r = 1/{beta}*p + u) /// (F.z = {rhoz}*z, state) /// (F.u = {rhou}*u, state)

Schenck (Stata) DSGE June 9, 2017 7 / 21

slide-18
SLIDE 18

Here’s a model in Stata II

. dsge (x = E(F.x) - (r - E(F.p) - z), unobserved) /// (p = {beta}*E(F.p) + {kappa}*x) /// (r = 1/{beta}*p + u) /// (F.z = {rhoz}*z, state) /// (F.u = {rhou}*u, state)

There are some rules

Equations are bound in parentheses. Parameters are bound in braces. Each variable appears on the left-hand side of one equation. State equations are written in terms of their one-period-ahead value.

Schenck (Stata) DSGE June 9, 2017 7 / 21

slide-19
SLIDE 19

Here’s a model in Stata II

. dsge (x = E(F.x) - (r - E(F.p) - z), unobserved) /// (p = {beta}*E(F.p) + {kappa}*x) /// (r = 1/{beta}*p + u) /// (F.z = {rhoz}*z, state) /// (F.u = {rhou}*u, state)

There are some rules

Equations are bound in parentheses. Parameters are bound in braces. Each variable appears on the left-hand side of one equation. State equations are written in terms of their one-period-ahead value.

Data: US inflation rate and nominal interest rate, quarterly

Schenck (Stata) DSGE June 9, 2017 7 / 21

slide-20
SLIDE 20

Parameter estimation

. dsge (x = E(F.x) - (r - E(F.p) - z), unobserved) /// > (p = {beta}*E(F.p) + {kappa}*x) /// > (r = 1/{beta}*p + u) /// > (F.z = {rhoz}*z, state) /// > (F.u = {rhou}*u, state), nolog DSGE model Sample: 1955q1 - 2015q4 Number of obs = 244 Log likelihood = -753.57131 OIM Coef.

  • Std. Err.

z P>|z| [95% Conf. Interval] /structural beta .5146675 .0783489 6.57 0.000 .3611065 .6682284 kappa .1659054 .0474072 3.50 0.000 .0729889 .2588218 rhoz .9545256 .0186424 51.20 0.000 .9179872 .991064 rhou .7005486 .0452604 15.48 0.000 .6118398 .7892573 sd(e.z) .6211211 .101508 .4221692 .8200731 sd(e.u) 2.318202 .3047436 1.720916 2.915489

Schenck (Stata) DSGE June 9, 2017 8 / 21

slide-21
SLIDE 21

Policy questions

What is the effect of an unexpected increase in interest rates? Estimated DSGE model provides an answer to this question. We can subject the model to a shock, then see how that shock feeds through the rest of the system.

Schenck (Stata) DSGE June 9, 2017 9 / 21

slide-22
SLIDE 22

Impulse response functions

Q: What is the effect of a shock to ut on the model variables? Recall our model: xt = Et(xt+1) − (rt − Et(πt+1) − zt) (Demand) πt = βEt(πt+1) + κxt (Pricing) rt = 1 β πt + ut (Interest rate) zt+1 = ρzzt + ξt+1 (Natural rate of interest) ut+1 = ρuut + εt+1 (Monetary policy)

Schenck (Stata) DSGE June 9, 2017 10 / 21

slide-23
SLIDE 23

Impulse responses from the estimated model

−1 −.5 .2 .4 .6 1 2 3 −6 −4 −2 2 4 6 8 2 4 6 8 model1, u, p model1, u, r model1, u, u model1, u, x

95% CI impulse−response function (irf) step

Graphs by irfname, impulse, and response Schenck (Stata) DSGE June 9, 2017 11 / 21

slide-24
SLIDE 24

Solving a DSGE Model I

Solution to a model is the key to estimation and generating impulse responses

Schenck (Stata) DSGE June 9, 2017 12 / 21

slide-25
SLIDE 25

Solving a DSGE Model I

Solution to a model is the key to estimation and generating impulse responses Solution expresses endogenous variables as a function of state variables alone

Schenck (Stata) DSGE June 9, 2017 12 / 21

slide-26
SLIDE 26

Solving a DSGE model II

Recall the structural equation for output: xt = Et(xt+1) − (rt − Et(πt+1) − zt)

Schenck (Stata) DSGE June 9, 2017 13 / 21

slide-27
SLIDE 27

Solving a DSGE model II

Recall the structural equation for output: xt = Et(xt+1) − (rt − Et(πt+1) − zt) The reduced form for output is: xt = g1zt + g2ut g1 and g2 are coefficients whose values are functions of the structural parameters

Schenck (Stata) DSGE June 9, 2017 13 / 21

slide-28
SLIDE 28

Solving a DSGE model III

What about expectations? Roll the solution forward one period, xt+1 = g1zt+1 + g2ut+1

Schenck (Stata) DSGE June 9, 2017 14 / 21

slide-29
SLIDE 29

Solving a DSGE model III

What about expectations? Roll the solution forward one period, xt+1 = g1zt+1 + g2ut+1 And take expectations, Et(xt+1) = g1Et(zt+1) + g2Et(ut+1)

Schenck (Stata) DSGE June 9, 2017 14 / 21

slide-30
SLIDE 30

Solving a DSGE model III

What about expectations? Roll the solution forward one period, xt+1 = g1zt+1 + g2ut+1 And take expectations, Et(xt+1) = g1Et(zt+1) + g2Et(ut+1) Then roll the state variables back one period Et(xt+1) = g1ρzzt + g2ρuut

Schenck (Stata) DSGE June 9, 2017 14 / 21

slide-31
SLIDE 31

Solving and Estimating a DSGE Model

Compactly, the solution to a model is yt = Gzt zt+1 = Hzt + Met+1 where yt is a vector of control variables, zt is a vector of state variables, and et is a vector of shocks.

Schenck (Stata) DSGE June 9, 2017 15 / 21

slide-32
SLIDE 32

Solving and Estimating a DSGE Model

Compactly, the solution to a model is yt = Gzt zt+1 = Hzt + Met+1 where yt is a vector of control variables, zt is a vector of state variables, and et is a vector of shocks. This is a state-space model whose parameters can be estimated by maximum likelihood.

Schenck (Stata) DSGE June 9, 2017 15 / 21

slide-33
SLIDE 33

Solving and Estimating a DSGE Model

Compactly, the solution to a model is yt = Gzt zt+1 = Hzt + Met+1 where yt is a vector of control variables, zt is a vector of state variables, and et is a vector of shocks. This is a state-space model whose parameters can be estimated by maximum likelihood. Each entry in G and H is a function of the model’s structural parameters.

Schenck (Stata) DSGE June 9, 2017 15 / 21

slide-34
SLIDE 34

Solving and Estimating a DSGE Model

Compactly, the solution to a model is yt = Gzt zt+1 = Hzt + Met+1 where yt is a vector of control variables, zt is a vector of state variables, and et is a vector of shocks. This is a state-space model whose parameters can be estimated by maximum likelihood. Each entry in G and H is a function of the model’s structural parameters. Diagonal elements of matrix M hold the standard deviations of the shocks.

Schenck (Stata) DSGE June 9, 2017 15 / 21

slide-35
SLIDE 35

Impulse Responses, again

yt = Gzt zt+1 = Hzt + Met+1 An impulse is a specific sequence of values (1, 0, 0, 0, . . . ) given to

  • ne shock.

Schenck (Stata) DSGE June 9, 2017 16 / 21

slide-36
SLIDE 36

Impulse Responses, again

yt = Gzt zt+1 = Hzt + Met+1 An impulse is a specific sequence of values (1, 0, 0, 0, . . . ) given to

  • ne shock.

From the sequence of shocks and the state transition equation, you can obtain the sequence of state variables.

Schenck (Stata) DSGE June 9, 2017 16 / 21

slide-37
SLIDE 37

Impulse Responses, again

yt = Gzt zt+1 = Hzt + Met+1 An impulse is a specific sequence of values (1, 0, 0, 0, . . . ) given to

  • ne shock.

From the sequence of shocks and the state transition equation, you can obtain the sequence of state variables. From the sequence of state variables and the policy matrix, you can

  • btain the sequence of control variables.

Schenck (Stata) DSGE June 9, 2017 16 / 21

slide-38
SLIDE 38

Using constraints to fix some parameters

You might want to fix some parameters and estimate others. xt = Et(xt+1) − (rt − Et(πt+1) − zt) (Demand) πt = βEt(πt+1) + κxt (Pricing) rt = ψπt + ut (Interest rate) zt+1 = ρzzt + ξt+1 (Natural rate of interest) ut+1 = ρuut + εt+1 (Monetary policy) New: the ψ parameter in the third equation. New: β no longer appears in multiple equations. Assume: you wish to fix β and estimate the remaining parameters conditional on your choice of β.

Schenck (Stata) DSGE June 9, 2017 17 / 21

slide-39
SLIDE 39

Constrained model in Stata

. constraint 1 _b[beta]=0.96 . dsge (x = E(F.x) - (r - E(F.p) - z), unobserved) /// (p = {beta}*E(F.p) + {kappa}*x) /// (r = {psi=1.5}*p + u) /// (F.z = {rhoz}*z, state) /// (F.u = {rhou}*u, state), constraint(1) nolog

Schenck (Stata) DSGE June 9, 2017 18 / 21

slide-40
SLIDE 40

Parameter estimation

DSGE model Sample: 1955q1 - 2015q4 Number of obs = 244 Log likelihood = -753.57131 ( 1) [/structural]beta = .96 OIM Coef.

  • Std. Err.

z P>|z| [95% Conf. Interval] /structural beta .96 (constrained) kappa .0849632 .0287693 2.95 0.003 .0285764 .1413501 psi 1.943004 .2957865 6.57 0.000 1.363273 2.522734 rhoz .9545257 .0186424 51.20 0.000 .9179873 .991064 rhou .7005482 .0452603 15.48 0.000 .6118396 .7892568 sd(e.z) .568989 .0982973 .3763299 .7616482 sd(e.u) 2.318204 .3047431 1.720918 2.915489

Schenck (Stata) DSGE June 9, 2017 19 / 21

slide-41
SLIDE 41

Conclusion

dsge estimates the parameters of DSGE models Impulse response functions trace the effect of a shock on the model Other features: estat commands to view the model’s state-space matrices, predictions of latent states, identification and stability diagnostics

Schenck (Stata) DSGE June 9, 2017 20 / 21

slide-42
SLIDE 42

Thank You!

Schenck (Stata) DSGE June 9, 2017 21 / 21