[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Provided that you have observations on some endogenous variables, it is possible to use Dynare to estimate some or all parameters. Both maximum likelihood (as in Ireland (2004)) and Bayesian techniques (as in Rabanal and Rubio-Ramirez (2003), Schorfheide (2000) or Smets and Wouters (2003)) are available. Using Bayesian methods, it is possible to estimate DSGE models, VAR models, or a combination of the two techniques called DSGE-VAR.
Note that in order to avoid stochastic singularity, you must have at least as many shocks or measurement errors in your model as you have observed variables.
Description
This command lists the name of observed endogenous variables for the estimation procedure. These variables must be available in the data file (see estimation).
Alternatively, this command is also used in conjunction with the
partial_information
option of stoch_simul
, for declaring
the set of observed variables when solving the model under partial
information.
Only one instance of varobs
is allowed in a model file. If one
needs to declare observed variables in a loop, the macroprocessor can
be used as shown in the second example below.
Simple example
varobs C y rr; |
Example with a loop
varobs @#for co in countries GDP_@{co} @#endfor ; |
Description
This block specifies linear trends for observed variables as functions of model parameters.
Each line inside of the block should be of the form:
VARIABLE_NAME(EXPRESSION); |
In most cases, variables shouldn’t be centered when
observation_trends
is used.
Example
observation_trends; Y (eta); P (mu/eta); end; |
Description
This block lists all parameters to be estimated and specifies bounds and priors as necessary.
Each line corresponds to an estimated parameter.
In a maximum likelihood estimation, each line follows this syntax:
stderr VARIABLE_NAME | corr VARIABLE_NAME_1, VARIABLE_NAME_2 | PARAMETER_NAME , INITIAL_VALUE [, LOWER_BOUND, UPPER_BOUND ]; |
In a Bayesian estimation, each line follows this syntax:
stderr VARIABLE_NAME | corr VARIABLE_NAME_1, VARIABLE_NAME_2 | PARAMETER_NAME | DSGE_PRIOR_WEIGHT [, INITIAL_VALUE [, LOWER_BOUND, UPPER_BOUND]], PRIOR_SHAPE, PRIOR_MEAN, PRIOR_STANDARD_ERROR [, PRIOR_3RD_PARAMETER [, PRIOR_4TH_PARAMETER [, SCALE_PARAMETER ] ] ]; |
The first part of the line consists of one of the three following alternatives:
stderr VARIABLE_NAME
Indicates that the standard error of the exogenous variable VARIABLE_NAME, or of the observation error associated with endogenous observed variable VARIABLE_NAME, is to be estimated
corr VARIABLE_NAME_1, VARIABLE_NAME_2
Indicates that the correlation between the exogenous variables VARIABLE_NAME_1 and VARIABLE_NAME_2, or the correlation of the observation errors associated with endogenous observed variables VARIABLE_NAME_1 and VARIABLE_NAME_2, is to be estimated
PARAMETER_NAME
The name of a model parameter to be estimated
DSGE_PRIOR_WEIGHT
…
The rest of the line consists of the following fields, some of them being optional:
INITIAL_VALUE
Specifies a starting value for maximum likelihood estimation
LOWER_BOUND
Specifies a lower bound for the parameter value in maximum likelihood estimation
UPPER_BOUND
Specifies an upper bound for the parameter value in maximum likelihood estimation
PRIOR_SHAPE
A keyword specifying the shape of the prior density.
The possible values are: beta_pdf
,
gamma_pdf
, normal_pdf
,
uniform_pdf
, inv_gamma_pdf
,
inv_gamma1_pdf
, inv_gamma2_pdf
. Note
that inv_gamma_pdf
is equivalent to
inv_gamma1_pdf
PRIOR_MEAN
The mean of the prior distribution
PRIOR_STANDARD_ERROR
The standard error of the prior distribution
PRIOR_3RD_PARAMETER
A third parameter of the prior used for generalized beta distribution,
generalized gamma and for the uniform distribution. Default: 0
PRIOR_4TH_PARAMETER
A fourth parameter of the prior used for generalized beta distribution
and for the uniform distribution. Default: 1
SCALE_PARAMETER
The scale parameter to be used for the jump distribution of the Metropolis-Hasting algorithm
Note that INITIAL_VALUE, LOWER_BOUND, UPPER_BOUND, PRIOR_MEAN, PRIOR_STANDARD_ERROR, PRIOR_3RD_PARAMETER, PRIOR_4TH_PARAMETER and SCALE_PARAMETER can be any valid EXPRESSION. Some of them can be empty, in which Dynare will select a default value depending on the context and the prior shape.
As one uses options more towards the end of the list, all previous options must be filled: for example, if you want to specify SCALE_PARAMETER, you must specify PRIOR_3RD_PARAMETER and PRIOR_4TH_PARAMETER. Use empty values, if these parameters don’t apply.
Parameter transformation
Sometimes, it is desirable to estimate a transformation of a parameter appearing in the model, rather than the parameter itself. It is of course possible to replace the original parameter by a function of the estimated parameter everywhere is the model, but it is often unpractical.
In such a case, it is possible to declare the parameter to be estimated
in the parameters
statement and to define the transformation,
using a pound sign (#) expression (see section Model declaration).
Example
parameters bet; model; # sig = 1/bet; c = sig*c(+1)*mpk; end; estimated_params; bet, normal_pdf, 1, 0.05; end; |
This block declares numerical initial values for the optimizer when these ones are different from the prior mean.
Each line has the following syntax:
stderr VARIABLE_NAME | corr VARIABLE_NAME_1, VARIABLE_NAME_2 | PARAMETER_NAME , INITIAL_VALUE; |
See estimated_params, for the meaning and syntax of the various components.
This block declares lower and upper bounds for parameters in maximum likelihood estimation.
Each line has the following syntax:
stderr VARIABLE_NAME | corr VARIABLE_NAME_1, VARIABLE_NAME_2 | PARAMETER_NAME , LOWER_BOUND, UPPER_BOUND; |
See estimated_params, for the meaning and syntax of the various components.
Description
This command runs Bayesian or maximum likelihood estimation.
The following information will be displayed by the command:
Options
datafile = FILENAME
The datafile (a ‘.m’ file, a ‘.mat’ file or, under MATLAB, a ‘.xls’ file)
xls_sheet = NAME
xls_range = RANGE
nobs = INTEGER
The number of observations to be used. Default: all observations in the file
nobs = [INTEGER_1:INTEGER_2]
Runs a recursive estimation and forecast for samples of size ranging
of INTEGER_1 to INTEGER_2. Option forecast
must
also be specified
first_obs = INTEGER
The number of the first observation to be used. Default: 1
prefilter = INTEGER
A value of 1
means that the estimation procedure will demean
the data. Default: 0
, i.e. no prefiltering
presample = INTEGER
The number of observations to be skipped before evaluating the
likelihood. Default: 0
loglinear
Computes a log-linear approximation of the model instead of a linear approximation. The data must correspond to the definition of the variables used in the model. Default: computes a linear approximation
plot_priors = INTEGER
Control the plotting of priors:
0
No prior plot
1
Prior density for each estimated parameter is plotted. It is important to check that the actual shape of prior densities matches what you have in mind. Ill choosen values for the prior standard density can result in absurd prior densities.
Default value is 1
.
nograph
No graphs should be plotted
lik_init = INTEGER
Type of initialization of Kalman filter:
1
For stationary models, the initial matrix of variance of the error of forecast is set equal to the unconditional variance of the state variables
2
For nonstationary models: a wide prior is used with an initial matrix of variance of the error of forecast diagonal with 10 on the diagonal
3
For nonstationary models: …
Default value is 1
.
lik_algo = INTEGER
…
conf_sig = DOUBLE
See conf_sig.
mh_replic = INTEGER
Number of replications for Metropolis-Hastings
algorithm. For the time being, mh_replic
should be larger than
1200
. Default: 20000
mh_nblocks = INTEGER
Number of parallel chains for Metropolis-Hastings algorithm. Default:
2
mh_drop = DOUBLE
The fraction of initially generated parameter vectors to be dropped
before using posterior simulations. Default: 0.5
mh_jscale = DOUBLE
The scale to be used for the jumping distribution in
Metropolis-Hastings algorithm. The default value is rarely
satisfactory. This option must be tuned to obtain, ideally, an
acceptation rate of 25% in the Metropolis-Hastings algorithm. Default:
0.2
mh_init_scale = DOUBLE
The scale to be used for drawing the initial value of the
Metropolis-Hastings chain. Default: 2*mh_scale
mh_recover
Attempts to recover a Metropolis-Hastings
simulation that crashed prematurely. Shouldn’t be used together with
load_mh_file
mh_mode = INTEGER
…
mode_file = FILENAME
Name of the file containing previous value for the mode. When
computing the mode, Dynare stores the mode (xparam1
) and the
hessian (hh
) in a file called
‘MODEL_FILENAME_mode.mat’
mode_compute = INTEGER | FUNCTION_NAME
Specifies the optimizer for the mode computation:
0
The mode isn’t computed. mode_file
option must be specified
1
Uses fmincon
optimization routine (not available under Octave)
2
Value no longer used
3
Uses fminunc
optimization routine
4
Uses Chris Sims’s csminwel
5
Uses Marco Ratto’s newrat
6
Uses a Monte-Carlo based optimization routine (see Dynare wiki for more details)
7
Uses fminsearch
, a simplex based optimization routine (available
under MATLAB if the optimization toolbox is installed; available under
Octave if the optim
package from Octave-Forge is installed)
FUNCTION_NAME
It is also possible to give a FUNCTION_NAME to this option, instead of an INTEGER. In that case, Dynare takes the return value of that function as the posterior mode.
Default value is 4
.
mode_check
Tells Dynare to plot the posterior density for values around the computed mode for each estimated parameter in turn. This is helpful to diagnose problems with the optimizer
prior_trunc = DOUBLE
Probability of extreme values of the prior
density that is ignored when computing bounds for the
parameters. Default: 1e-32
load_mh_file
Tells Dynare to add to previous
Metropolis-Hastings simulations instead of starting from
scratch. Shouldn’t be used together with mh_recover
optim = (fmincon options)
Can be used to set options for fmincon
, the optimizing function
of MATLAB Optimizaiton toolbox. Use MATLAB’s syntax for these
options. Default:
('display','iter','LargeScale','off','MaxFunEvals',100000,'TolFun',1e-8,'TolX',1e-6)
nodiagnostic
Doesn’t compute the convergence diagnostics for Metropolis-Hastings. Default: diagnostics are computed and displayed
bayesian_irf
Triggers the computation of the posterior
distribution of IRFs. The length of the IRFs are controlled by the
irf
option. Results are stored in oo_.PosteriorIRF.Dsge
(see below for a description of this variable)
dsge_var
Triggers the estimation of a DSGE-VAR model, where the weight of the
DSGE prior of the VAR model will be estimated. The prior on the
weight of the DSGE prior, dsge_prior_weight
, must be defined in
the estimated_params
section. NB: The previous method of
declaring dsge_prior_weight
as a parameter and then placing it
in estimated_params
is now deprecated and will be removed in a
future release of Dynare.
dsge_var = DOUBLE
Triggers the estimation of a DSGE-VAR model, where the weight of the
DSGE prior of the VAR model is calibrated to the value passed. NB: The
previous method of declaring dsge_prior_weight
as a parameter
and then calibrating it is now deprecated and will be removed in a
future release of Dynare.
dsge_varlag = INTEGER
The number of lags used to estimate a DSGE-VAR
model. Default: 4
.
moments_varendo
Triggers the computation of the posterior
distribution of the theoretical moments of the endogenous
variables. Results are stored in
oo_.PosteriorTheoreticalMoments
(see below for a description of
this variable)
filtered_vars
Triggers the computation of the posterior
distribution of filtered endogenous variables and shocks. Results are
stored in oo_.FilteredVariables
(see below for a description of
this variable)
smoother
Triggers the computation of the posterior
distribution of smoothered endogenous variables and shocks. Results
are stored in oo_.SmoothedVariables
, oo_.SmoothedShocks
and oo_.SmoothedMeasurementErrors
(see below for a description
of these variables)
forecast = INTEGER
Computes the posterior distribution of a forecast on
INTEGER periods after the end of the sample used in
estimation. The result is stored in variable oo_.forecast
(see section Forecasting)
tex
Requests the printing of results and graphs in TeX tables and graphics that can be later directly included in LaTeX files (not yet implemented)
kalman_algo = INTEGER
…
kalman_tol = DOUBLE
…
filter_covariance
Saves the series of one step ahead error of forecast covariance matrices.
filter_step_ahead = [INTEGER_1:INTEGER_2]
filter_decomposition
Triggers the computation of the shock decomposition of the above k-step ahead filtered values.
constant
…
noconstant
…
diffuse_filter
…
selected_variables_only
Only run the smoother on the variables listed just after the
estimation
command. Default: run the smoother on all the
declared endogenous variables.
cova_compute = INTEGER
When 0
, the covariance matrix of estimated parameters is not
computed after the computation of posterior mode (or maximum
likelihood). This increases speed of computation in large models
during development, when this information is not always necessary. Of
course, it will break all successive computations that would require
this covariance matrix. Default is 1
.
solve_algo = INTEGER
See solve_algo.
order = INTEGER
See order.
irf = INTEGER
See irf.
aim_solver
See aim_solver.
Note
If no mh_jscale
parameter is used in estimated_params, the
procedure uses mh_jscale
for all parameters. If
mh_jscale
option isn’t set, the procedure uses 0.2
for
all parameters.
Output
After running estimation
, the parameters M_.params
and
the variance matrix M_.Sigma_e
of the shocks are set to the
mode for maximum likelihood estimation or posterior mode computation
without Metropolis iterations.
After estimation
with Metropolis iterations (option
mh_replic
> 0 or option load_mh_file
set) the parameters
M_.params
and the variance matrix M_.Sigma_e
of the
shocks are set to the posterior mean.
Depending on the options, estimation
stores results in various
fields of the oo_
structure, described below.
Running the smoother with calibrated parameters
It is possible to compute smoothed value of the endogenous variables
and the shocks with calibrated parameters, without estimation
proper. For this usage, there should be no estimated_params
block. Observed variables must be declared. A dataset must be
specified in the estimation
instruction. In addition, use the
following options:
mode_compute=0,mh_replic=0,smoother
. Currently, there is no
specific output for this usage of the estimation
command. The
results are made available in fields of oo_
structure. An
example is available in ‘./tests/smoother/calibrated_model.mod’.
In the following variables, we will adopt the following shortcuts for specific field names:
This field can take the following values:
HPDinf
Lower bound of a 90% HPD interval(3)
HPDsup
Upper bound of a 90% HPD interval
Mean
Mean of the posterior distribution
Median
Median of the posterior distribution
Std
Standard deviation of the posterior distribution
This field can take the following values:
measurement_errors_corr
Correlation between two measurement errors
measurement_errors_std
Standard deviation of measurement errors
parameters
Parameters
shocks_corr
Correlation between two structural shocks
shocks_std
Standard deviation of structural shocks
Variable set by the estimation
command.
Variable set by the estimation
command, if it is used with
mh_replic > 0
or load_mh_file
option.
Variable set by the estimation
command, if it is used with the
filtered_vars
option. Fields are of the form:
|
Variable set by the estimation
command, if it is used with the
bayesian_irf
option. Fields are of the form:
|
Variable set by the estimation
command, if it is used with the
smoother
option. Fields are of the form:
|
Variable set by the estimation
command, if it is used with the
smoother
option. Fields are of the form:
|
Variable set by the estimation
command, if it is used with the
smoother
option. Fields are of the form:
|
Variable set by the estimation
command, if it is used with the
moments_varendo
option. Fields are of the form:
|
where THEORETICAL_MOMENT is one of the following:
Variable set by the estimation
command, if it is used with
mh_replic > 0
or load_mh_file
option. Fields are of the form:
|
Variable set by the estimation
command, if it is used with
mh_replic > 0
or load_mh_file
option. Fields are of the form:
|
Variable set by the estimation
command, if it is used with
mh_replic > 0
or load_mh_file
option. Fields are of the form:
|
Variable set by the estimation
command, if it is used with
mh_replic > 0
or load_mh_file
option. Fields are of the form:
|
Variable set by the estimation
command, if it is used with
mh_replic > 0
or load_mh_file
option. Fields are of the form:
|
Variable set by the estimation
command, if it is used with
mh_replic > 0
or load_mh_file
option. Fields are of the form:
|
Here are some examples of generated variables:
oo_.posterior_mode.parameters.alp oo_.posterior_mean.shocks_std.ex oo_.posterior_hpdsup.measurement_errors_corr.gdp_conso |
Description
This command computes odds ratios and estimate a posterior density over a collection of models. The priors over models can be specified as the DOUBLE values, otherwise a uniform prior is assumed.
Example
model_comparison my_model(0.7) alt_model(0.3); |
This example attributes a 70% prior over my_model
and 30% prior
over alt_model
.
Description
This command computes and displays shock decomposition according to the model for a given sample.
Options
parameter_set = PARAMETER_SET
Specify the parameter set to use for running the smoother. The
PARAMETER_SET can take one of the following five values:
prior_mode
, prior_mean
, posterior_mode
,
posterior_mean
, posterior_median
. Default value:
posterior_mean
if Metropolis has been run, else
posterior_mode
.
unit_root_vars
is used to declare a list of unit-root
endogenous variables of a model so that dynare won’t check the steady
state levels (defined in the steadystate file) file for these
variables. The information given by this command is no more used for
the initialization of the diffuse kalman filter (as described in
Durbin and Koopman (2001) and Koopman and Durbin
(2003)).
When unit_root_vars
is used the lik_init
option of
estimation
has no effect.
When there are nonstationary variables in a model, there is no unique deterministic steady state. The user must supply a MATLAB/Octave function that computes the steady state values of the stationary variables in the model and returns dummy values for the nonstationary ones. The function should be called with the name of the ‘.mod’ file followed by ‘_steadystate’. See ‘fs2000_steadystate.m’ in ‘examples’ directory for an example.
Note that the nonstationary variables in the model must be integrated processes (their first difference or k-difference must be stationary).
Dynare also has the ability to estimate Bayesian VARs:
Computes the marginal density of an estimated BVAR model, using Minnesota priors.
See ‘bvar-a-la-sims.pdf’, which comes with Dynare distribution, for more information on this command.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated by Build Daemon user on June 16, 2011 using texi2html 1.82.