Lecture 7 Dynare
Lecture 7 Dynare
Lecture 7 Dynare
Aurélien Poissonnier1
1 Insee-European Commission
1 / 43
Plan
Elementary outputs
Simulating models
Estimation of models
Optimal policy
Wrapping-up
2 / 43
Plan
Elementary outputs
Simulating models
Estimation of models
Optimal policy
Wrapping-up
3 / 43
Dynare
4 / 43
Plan
Elementary outputs
Simulating models
Estimation of models
Optimal policy
Wrapping-up
5 / 43
Main blocks
How to declare a standard DSGE model in Dynare.
6 / 43
Main blocks
More options
Dynare allows for a lot of useful options. Variables and parameters
can be assigned long names or Latex names. So can equations.
You can use calibrated parameters to calibrate new ones (e.g.
beta = 0.99; gamma = beta^ 2;) The model can be declared
linear (to avoid the computation of its linearization)...
Check the reference manual for more (Adjemian et al., 2011).
7 / 43
Timing convention
t −1 t t +1
8 / 43
Plan
Elementary outputs
Simulating models
Estimation of models
Optimal policy
Wrapping-up
9 / 43
Steady state
steady;
Test
In lecture 4 we exemplified this command on a small
neo-Keynesian model.
Let’s try on a small RBC model (Collard, 2001). (example2.mod)
11 / 43
Simulated and theoretical moments
shocks;
var an exovar name = a value for the variance ;
...
end;
12 / 43
Simulated and theoretical moments
stoch simul(irf=0);
Test
smallneoK.mod or example2.mod
13 / 43
Variance decomposition
stoch simul(irf=0);
14 / 43
Policy function
stoch simul(irf=0);
This takes the form of a linear model (matrices) for a first order
approximation of the model. Check the reference manual
(Adjemian et al., 2011, chap.4.13.3, 4 & 5) to see under what
form Dynare returns the solution to a second and third order
approximation.
15 / 43
Plan
Elementary outputs
Simulating models
Stochastic simulations
Deterministic simulations
Estimation of models
Optimal policy
Wrapping-up
16 / 43
Plan
Simulating models
Stochastic simulations
Deterministic simulations
17 / 43
IRF
stoch simul;
18 / 43
Plan
Simulating models
Stochastic simulations
Deterministic simulations
19 / 43
Deterministic simulations
20 / 43
Deterministic simulations
20 / 43
Declaring shocks differently
21 / 43
Declaring shocks differently
22 / 43
Deterministic simulations
Test
Let’s try on ramst.mod.
Exercise
On NK baseline.mod, code a simulation for an economy where
the central banker would change the inflation target (e.g. to move
away from the risk of ZLB).
NB: You may want to change a parameter into an exovar (e.g. to
simulate a transition between two steady states linked to two
calibrations). There is a special command for this (change type)
23 / 43
Plan
Elementary outputs
Simulating models
Estimation of models
Observed variables
Estimation
Prior distribution
Posterior distribution
Shock decomposition
Replication code for (Smets and Wouters, 2007)
Model Comparison 24 / 43
Plan
Estimation of models
Observed variables
Estimation
Prior distribution
Posterior distribution
Shock decomposition
Replication code for (Smets and Wouters, 2007)
Model Comparison
25 / 43
Observed variables
varobs;
26 / 43
Plan
Estimation of models
Observed variables
Estimation
Prior distribution
Posterior distribution
Shock decomposition
Replication code for (Smets and Wouters, 2007)
Model Comparison
27 / 43
Estimation
estimation(...);
28 / 43
Plan
Estimation of models
Observed variables
Estimation
Prior distribution
Posterior distribution
Shock decomposition
Replication code for (Smets and Wouters, 2007)
Model Comparison
29 / 43
Prior distribution
estimated params;
30 / 43
Plan
Estimation of models
Observed variables
Estimation
Prior distribution
Posterior distribution
Shock decomposition
Replication code for (Smets and Wouters, 2007)
Model Comparison
31 / 43
Posterior distribution
Metropolis-Hastings
32 / 43
Posterior distribution
Metropolis-Hastings
32 / 43
Plan
Estimation of models
Observed variables
Estimation
Prior distribution
Posterior distribution
Shock decomposition
Replication code for (Smets and Wouters, 2007)
Model Comparison
33 / 43
Shock decomposition
Test
Let’s run fd2000.mod with a shock decomposition command.
34 / 43
Plan
Estimation of models
Observed variables
Estimation
Prior distribution
Posterior distribution
Shock decomposition
Replication code for (Smets and Wouters, 2007)
Model Comparison
35 / 43
Smets and Wouters, 2007
Test
Let’s run the Smets and Wouters model estimation for the US.
36 / 43
Plan
Estimation of models
Observed variables
Estimation
Prior distribution
Posterior distribution
Shock decomposition
Replication code for (Smets and Wouters, 2007)
Model Comparison
37 / 43
Model Comparison
model comparison
38 / 43
Plan
Elementary outputs
Simulating models
Estimation of models
Optimal policy
Wrapping-up
39 / 43
Optimal simple rule
osr;
You can search for the optimal values of (policy) parameters such
that they minimize a quadradic function of the endogenous
variables.
(Galı́, 2015, Chapter 6) shows that the welfare loss function in our
smallneoK.mod example is a function of the variances of output
gap, price inflation and wage inflation.
Test
Let’s use GaliChap6.mod to find the coefficients of the Taylor rule
such that the loss function is minimized.
Elementary outputs
Simulating models
Estimation of models
Optimal policy
Wrapping-up
41 / 43
Applications with Dynare
Also available
Sensitivity analysis, forecasting, Ramsey policy, markov switching
SBVAR, DSGE-VAR, macro-processing language, time-series
manipulation, Dynare and Latex, Dynare and Matlab, Dynare++
42 / 43
References I
43 / 43
References II
44 / 43