[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.14 Estimation

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.

The estimation using a first order approximation can benefit from the block decomposition of the model (see block).

Command: varobs VARIABLE_NAME…;

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_cmd).

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 macro-processor 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
;
Block: observation_trends ;

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;

Block: estimated_params ;

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/measurement errors associated with endogenous observed variable VARIABLE_NAME, is to be estimated

corr VARIABLE_NAME1, VARIABLE_NAME2

Indicates that the correlation between the exogenous variables VARIABLE_NAME1 and VARIABLE_NAME2, or the correlation of the observation errors/measurement errors associated with endogenous observed variables VARIABLE_NAME1 and VARIABLE_NAME2, is to be estimated. Note that correlations set by previous shocks-blocks or estimation-commands are kept at their value set prior to estimation if they are not estimated again subsequently. Thus, the treatment is the same as in the case of deep parameters set during model calibration and not 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 the posterior mode optimizer or the maximum likelihood estimation. If unset, defaults to the prior mean.

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

A parameter specific scale parameter for the jumping distribution’s covariance matrix 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.

Example

The following line:

 
corr eps_1, eps_2, 0.5,  ,  , beta_pdf, 0, 0.3, -1, 1;

sets a generalized beta prior for the correlation between eps_1 and eps_2 with mean 0 and variance 0.3. By setting PRIOR_3RD_PARAMETER to -1 and PRIOR_4TH_PARAMETER to 1 the standard beta distribution with support [0,1] is changed to a generalized beta with support [-1,1]. Note that LOWER_BOUND and UPPER_BOUND are left empty and thus default to -1 and 1, respectively. The initial value is set to 0.5.

Similarly, the following line:

 
corr eps_1, eps_2, 0.5,  -0.5,  1, beta_pdf, 0, 0.3, -1, 1;

sets the same generalized beta distribution as before, but now truncates this distribution to [-0.5,1] through the use of LOWER_BOUND and UPPER_BOUND. Hence, the prior does not integrate to 1 anymore.

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;
Block: estimated_params_init ;
Block: estimated_params_init (OPTIONS…);

This block declares numerical initial values for the optimizer when these ones are different from the prior mean. It should be specified after the estimated_params-block as otherwise the specified starting values are overwritten by the latter.

Each line has the following syntax:

 
stderr VARIABLE_NAME | corr VARIABLE_NAME_1, VARIABLE_NAME_2 | PARAMETER_NAME
, INITIAL_VALUE;

Options

use_calibration

For not specifically initialized parameters, use the deep parameters and the elements of the covariance matrix specified in the shocks block from calibration as starting values for estimation. For components of the shocks block that were not explicitly specified during calibration or which violate the prior, the prior mean is used.

See estimated_params, for the meaning and syntax of the various components.

Block: estimated_params_bounds ;

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.

Command: estimation [VARIABLE_NAME…];
Command: estimation (OPTIONS…) [VARIABLE_NAME…];

Description

This command runs Bayesian or maximum likelihood estimation.

The following information will be displayed by the command:

Also, during the MCMC (Bayesian estimation with mh_replic>0) a (graphical or text) waiting bar is displayed showing the progress of the Monte-Carlo and the current value of the acceptance ratio. Note that if the load_mh_file option is used (see below) the reported acceptance ratio does not take into account the draws from the previous MCMC. In the literature there is a general agreement for saying that the acceptance ratio should be close to one third or one quarter. If this not the case, you can stop the MCMC (Ctrl-C) and change the value of option mh_jscale (see below).

Note that by default Dynare generates random numbers using the algorithm mt199937ar (ie Mersenne Twister method) with a seed set equal to 0. Consequently the MCMCs in Dynare are deterministic: one will get exactly the same results across different Dynare runs (ceteris paribus). For instance, the posterior moments or posterior densities will be exactly the same. This behaviour allows to easily identify the consequences of a change on the model, the priors or the estimation options. But one may also want to check that across multiple runs, with different sequences of proposals, the returned results are almost identical. This should be true if the number of iterations (ie the value of mh_replic) is important enough to ensure the convergence of the MCMC to its ergodic distribution. In this case the default behaviour of the random number generators in not wanted, and the user should set the seed according to the system clock before the estimation command using the following command:

 
set_dynare_seed('clock');

so that the sequence of proposals will be different across different runs.

Algorithms

The Monte Carlo Markov Chain (MCMC) diagnostics are generated by the estimation command if mh_replic is larger than 2000 and if option nodiagnostic is not used. If mh_nblocks is equal to one, the convergence diagnostics of Geweke (1992,1999) is computed. It uses a chi square test to compare the means of the first and last draws specified by geweke_interval after discarding the burnin of mh_drop. The test is computed using variance estimates under the assumption of no serial correlation as well as using tapering windows specified in taper_steps. If mh_nblocks is larger than 1, the convergence diagnostics of Brooks and Gelman (1998) are used instead. As described in section 3 of Brooks and Gelman (1998) the univariate convergence diagnostics are based on comparing pooled and within MCMC moments (Dynare displays the second and third order moments, and the length of the Highest Probability Density interval covering 80% of the posterior distribution). Due to computational reasons, the multivariate convergence diagnostic does not follow Brooks and Gelman (1998) strictly, but rather applies their idea for univariate convergence diagnostics to the range of the posterior likelihood function instead of the individual parameters. The posterior kernel is used to aggregate the parameters into a scalar statistic whose convergence is then checked using the Brooks and Gelman (1998) univariate convergence diagnostic.

Options

datafile = FILENAME

The datafile: a ‘.m’ file, a ‘.mat’ file, a ‘.csv’ file, or a ‘.xls’/‘.xlsx’ file (under Octave, the io from Octave-Forge is required for the ‘.csv’, ‘.xls’ and ‘.xlsx’ formats; in addition, for the ‘.xls’ and ‘.xlsx’ formats, the java package is required, along with a Java Runtime Environment)

xls_sheet = NAME

The name of the sheet with the data in an Excel file

xls_range = RANGE

The range with the data in an Excel file

nobs = INTEGER

The number of observations to be used. Default: all observations in the file

nobs = [INTEGER1:INTEGER2]

Runs a recursive estimation and forecast for samples of size ranging of INTEGER1 to INTEGER2. Option forecast must also be specified. The forecasts are stored in the RecursiveForecast field of the results structure (see RecursiveForecast).

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 each data series by its empirical mean. Default: 0, i.e. no prefiltering

presample = INTEGER

The number of observations to be skipped before evaluating the likelihood. These first observations are used as a training sample. Default: 0

loglinear

Computes a log-linear approximation of the model instead of a linear approximation. As always in the context of estimation, the data must correspond to the definition of the variables used in the model (see Pfeifer 2013 for more details on how to correctly specify observation equations linking model variables and the data). If you specify the loglinear option, Dynare will take the logarithm of both your model variables and of your data as it assumes the data to correspond to the original non-logged model variables. The displayed posterior results like impulse responses, smoothed variables, and moments will be for the logged variables, not the original un-logged ones. 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-chosen values for the prior standard density can result in absurd prior densities.

Default value is 1.

nograph

See nograph.

nodisplay

See nodisplay.

graph_format = FORMAT
graph_format = ( FORMAT, FORMAT… )

See graph_format.

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: use a diffuse filter (use rather the diffuse_filter option)

4

The filter is initialized with the fixed point of the Riccati equation

Default value is 1. For advanced use only.

lik_algo = INTEGER

For internal use and testing only.

conf_sig = DOUBLE

Confidence interval used for classical forecasting after estimation. See See conf_sig.

mh_conf_sig = DOUBLE

Confidence/HPD interval used for the computation of prior and posterior statistics like: parameter distributions, prior/posterior moments, conditional variance decomposition, impulse response functions, Bayesian forecasting. Default: 0.9

mh_replic = INTEGER

Number of replications for Metropolis-Hastings algorithm. For the time being, mh_replic should be larger than 1200. Default: 20000

sub_draws = INTEGER

number of draws from the Metropolis iterations that are used to compute posterior distribution of various objects (smoothed variable, smoothed shocks, forecast, moments, IRF). sub_draws should be smaller than the total number of Metropolis draws available. Default: min(1200,0.25*Total number of draws)

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 as a burnin before using posterior simulations. Default: 0.5

mh_jscale = DOUBLE

The scale parameter of the jumping distribution’s covariance matrix (Metropolis-Hastings algorithm). The default value is rarely satisfactory. This option must be tuned to obtain, ideally, an acceptance ratio of 25%-33% in the Metropolis-Hastings algorithm. Basically, the idea is to increase the variance of the jumping distribution if the acceptance ratio is too high, and decrease the same variance if the acceptance ratio is too low. In some situations in may help to consider parameter specific values for this scale parameter, this can be done in the estimated_params block. 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, only if cova_compute=1) 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. When mode_file option is specified, the mode is simply read from that file.

When mode_file option is not specified, Dynare reports the value of the log posterior (log likelihood) evaluated at the initial value of the parameters.

When mode_file option is not specified and there is no estimated_params block, but the smoother option is used, it is a roundabout way to compute the smoothed value of the variables of a model with calibrated parameters.

1

Uses fmincon optimization routine (available under MATLAB if the optimization toolbox is installed; not available under Octave)

2

Value no longer used

3

Uses fminunc optimization routine (available under MATLAB if the optimization toolbox is installed; available under Octave if the optim package from Octave-Forge is installed)

4

Uses Chris Sims’s csminwel

5

Uses Marco Ratto’s newrat. This value is not compatible with non linear filters or DSGE-VAR models

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)

8

Uses Dynare implementation of the Nelder-Mead simplex based optimization routine (generally more efficient than the MATLAB or Octave implementation available with mode_compute=7)

9

Uses the CMA-ES (Covariance Matrix Adaptation Evolution Strategy) algorithm, an evolutionary algorithm for difficult non-linear non-convex optimization

10

Uses the simpsa algorithm, based on the combination of the non-linear simplex and simulated annealing algorithms and proposed by Cardoso, Salcedo and Feyo de Azevedo (1996).

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.

mcmc_jumping_covariance = hessian|prior_variance|identity_matrix|FILENAME

Tells Dynare which covariance to use for the proposal density of the MCMC sampler. mcmc_jumping_covariance can be one of the following:

hessian

Uses the Hessian matrix computed at the mode.

prior_variance

Uses the prior variances. No infinite prior variances are allowed in this case.

identity_matrix

Uses an identity matrix.

FILENAME

Loads an arbitrary user-specified covariance matrix from FILENAME.mat. The covariance matrix must be saved in a variable named jumping_covariance, must be square, positive definite, and have the same dimension as the number of estimated parameters.

Note that the covariance matrices are still scaled with mh_jscale. Default value is hessian.

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

mode_check_neighbourhood_size = DOUBLE

Used in conjunction with option mode_check, gives the width of the window around the posterior mode to be displayed on the diagnostic plots. This width is expressed in percentage deviation. The Inf value is allowed, and will trigger a plot over the entire domain (see also mode_check_symmetric_plots). Default: 0.5.

mode_check_symmetric_plots = INTEGER

Used in conjunction with option mode_check, if set to 1, tells Dynare to ensure that the check plots are symmetric around the posterior mode. A value of 0 allows to have asymmetric plots, which can be useful if the posterior mode is close to a domain boundary, or in conjunction with mode_check_neighbourhood_size = Inf when the domain in not the entire real line. Default: 1.

mode_check_number_of_points = INTEGER

Number of points around the posterior mode where the posterior kernel is evaluated (for each parameter). Default is 20

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 = (NAME, VALUE, ...)

A list of NAME and VALUE pairs. Can be used to set options for the optimization routines. The set of available options depends on the selected optimization routine (ie on the value of option mode_compute):

1, 3, 7

Available options are given in the documentation of the MATLAB optimization toolbox or in Octave’s documentation.

4

Available options are:

'MaxIter'

Maximum number of iterations. Default: 1000

'NumgradAlgorithm'

Possible values are 2, 3 and 5 respectively corresponding to the two, three and five points formula used to compute the gradient of the objective function (see Abramowitz and Stegun (1964)). Values 13 and 15 are more experimental. If perturbations on the right and the left increase the value of the objective function (we minimize this function) then we force the corresponding element of the gradient to be zero. The idea is to temporarily reduce the size of the optimization problem. Default: 2.

'NumgradEpsilon'

Size of the perturbation used to compute numerically the gradient of the objective function. Default: 1e-6

'TolFun'

Stopping criteria. Default: 1e-7

'InitialInverseHessian'

Initial approximation for the inverse of the Hessian matrix of the posterior kernel (or likelihood). Obviously this approximation has to be a square, positive definite and symmetric matrix. Default: '1e-4*eye(nx)', where nx is the number of parameters to be estimated.

6

Available options are:

'NumberOfMh'

Number of MCMC run sequentially. Default: 3

'ncov-mh'

Number of iterations used for updating the covariance matrix of the jumping distribution. Default: 20000

'nscale-mh'

Maximum number of iterations used for adjusting the scale parameter of the jumping distribution. 200000

'nclimb'

Number of iterations in the last MCMC (climbing mode).

'InitialCovarianceMatrix'

Initial covariance matrix of the jumping distribution. Default is 'previous' if option mode_file is used, 'prior' otherwise.

'AcceptanceRateTarget'

A real number between zero and one. The scale parameter of the jumping distribution is adjusted so that the effective acceptance rate matches the value of option 'AcceptanceRateTarget'. Default: 1.0/3.0

8

Available options are:

'MaxIter'

Maximum number of iterations. Default: 5000

'MaxFunEvals'

Maximum number of objective function evaluations. No default.

'MaxFunvEvalFactor'

Set MaxFunvEvals equal to MaxFunvEvalFactor times the number of estimated parameters. Default: 500.

'TolFun'

Tolerance parameter (w.r.t the objective function). Default: 1e-4

'TolX'

Tolerance parameter (w.r.t the instruments). Default: 1e-4

'InitialSimplexSize'

Initial size of the simplex, expressed as percentage deviation from the provided initial guess in each direction. Default: .05

9

Available options are:

'MaxIter'

Maximum number of iterations.

'MaxFunEvals'

Maximum number of objective function evaluations. Default: Inf.

'TolFun'

Tolerance parameter (w.r.t the objective function). Default: 1e-7

'TolX'

Tolerance parameter (w.r.t the instruments). Default: 1e-7

10

Available options are:

'MaxIter'

Maximum number of iterations. Default: 5000

'MaxFunvEvals'

Maximum number of objective function evaluations. No default.

'TolFun'

Tolerance parameter (w.r.t the objective function). Default: 1e-4

'TolX'

Tolerance parameter (w.r.t the instruments). Default: 1e-4

'EndTemperature'

Terminal condition w.r.t the temperature. When the temperature reaches EndTemperature, the temperature is set to zero and the algorithm falls back into a standard simplex algorithm. Default: .1

Example 1 To change the defaults of csminwel (mode_compute=4):

estimation(..., mode_compute=4, optim=('NumgradAlgorithm',3,'TolFun',1e-5), ...);

nodiagnostic

Does not 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 = 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 (see Del Negro and Schorfheide (2004)). It represents ratio of dummy over actual observations. To assure that the prior is proper, the value must be bigger than $(k+n)/T$, where $k$ is the number of estimated parameters, $n$ is the number of observables, and $T$ is the number of observations. 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_var

Triggers the estimation of a DSGE-VAR model, where the weight of the DSGE prior of the VAR model will be estimated (as in Adjemian et alii (2008)). 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_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 oo_.PosteriorTheoreticalMoments). The number of lags in the autocorrelation function is controlled by the ar option.

conditional_variance_decomposition = INTEGER

See below.

conditional_variance_decomposition = [INTEGER1:INTEGER2]

See below.

conditional_variance_decomposition = [INTEGER1 INTEGER2 …]

Computes the posterior distribution of the conditional variance decomposition for the specified period(s). The periods must be strictly positive. Conditional variances are given by $var(y_{t+k}\vert t)$. For period 1, the conditional variance decomposition provides the decomposition of the effects of shocks upon impact. The results are stored in oo_.PosteriorTheoreticalMoments.dsge.ConditionalVarianceDecomposition, but currently there is no displayed output. Note that this option requires the option moments_varendo to be specified.

filtered_vars

Triggers the computation of the posterior distribution of filtered endogenous variables/one-step ahead forecasts, i.e. $E_{t}{y_{t+1}}$. Results are stored in oo_.FilteredVariables (see below for a description of this variable)

smoother

Triggers the computation of the posterior distribution of smoothed endogenous variables and shocks, i.e. the expected value of variables and shocks given the information available in all observations up to the final date ($E_{T}{y_t}$). Results are stored in oo_.SmoothedVariables, oo_.SmoothedShocks and oo_.SmoothedMeasurementErrors. Also triggers the computation of oo_.UpdatedVariables, which contains the estimation of the expected value of variables given the information available at the current date ($E_{t}{y_t}$). See below for a description of all these variables.

forecast = INTEGER

Computes the posterior distribution of a forecast on INTEGER periods after the end of the sample used in estimation. If no Metropolis-Hastings is computed, the result is stored in variable oo_.forecast and corresponds to the forecast at the posterior mode. If a Metropolis-Hastings is computed, the distribution of forecasts is stored in variables oo_.PointForecast and oo_.MeanForecast. See section Forecasting, for a description of these variables.

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

0

Automatically use the Multivariate Kalman Filter for stationary models and the Multivariate Diffuse Kalman Filter for non-stationary models

1

Use the Multivariate Kalman Filter

2

Use the Univariate Kalman Filter

3

Use the Multivariate Diffuse Kalman Filter

4

Use the Univariate Diffuse Kalman Filter

Default value is 0. In case of missing observations of single or all series, Dynare treats those missing values as unobserved states and uses the Kalman filter to infer their value (see e.g. Durbin and Koopman (2012), Ch. 4.10)

kalman_tol = DOUBLE

Numerical tolerance for determining the singularity of the covariance matrix of the prediction errors during the Kalman filter (minimum allowed reciprocal of the matrix condition number). Default value is 1e-10

filter_covariance

Saves the series of one step ahead error of forecast covariance matrices.

filter_step_ahead = [INTEGER1:INTEGER2]

See below.

filter_step_ahead = [INTEGER1 INTEGER2 …]

Triggers the computation k-step ahead filtered values. Stores results in oo_.FilteredVariablesKStepAhead and oo_.FilteredVariablesKStepAheadVariances.

filter_decomposition

Triggers the computation of the shock decomposition of the above k-step ahead filtered values.

diffuse_filter

Uses the diffuse Kalman filter (as described in Durbin and Koopman (2012) and Koopman and Durbin (2003)) to estimate models with non-stationary observed variables.

When diffuse_filter is used the lik_init option of estimation has no effect.

When there are nonstationary exogenous variables in a model, there is no unique deterministic steady state. For instance, if productivity is a pure random walk:

$a_t = a_{t-1} + e_t$

any value of $\bar a$ of $a$ is a deterministic steady state for productivity. Consequently, the model admits an infinity of steady states. In this situation, the user must help Dynare in selecting one steady state, except if zero is a trivial model’s steady state, which happens when the linear option is used in the model declaration. The user can either provide the steady state to Dynare using a steady_state_model block (or writing a steady state file) if a closed form solution is available, see steady_state_model, or specify some constraints on the steady state, see equation_tag_for_conditional_steady_state, so that Dynare computes the steady state conditionally on some predefined levels for the non stationary variables. In both cases, the idea is to use dummy values for the steady state level of the exogenous non stationary variables.

Note that the nonstationary variables in the model must be integrated processes (their first difference or k-difference must be stationary).

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. Otherwise, if this option is equal to 1, the covariance matrix is computed and stored in variable hh of ‘MODEL_FILENAME_mode.mat’. Default is 1.

solve_algo = INTEGER

See solve_algo.

order = INTEGER

Order of approximation, either 1 or 2. When equal to 2, the likelihood is evaluated with a particle filter based on a second order approximation of the model (see Fernandez-Villaverde and Rubio-Ramirez (2005)). Default is 1, ie the likelihood of the linearized model is evaluated using a standard Kalman filter.

irf = INTEGER

See irf. Only used if bayesian_irf is passed.

irf_shocks = ( VARIABLE_NAME [[,] VARIABLE_NAME …] )

See irf_shocks. Only used if bayesian_irf is passed. Cannot be used with dsge_var.

irf_plot_threshold = DOUBLE

See irf_plot_threshold. Only used if bayesian_irf is passed.

aim_solver

See aim_solver.

sylvester = OPTION

See sylvester.

sylvester_fixed_point_tol = DOUBLE

See sylvester_fixed_point_tol.

lyapunov = OPTION

Determines the algorithm used to solve the Lyapunov equation to initialized the variance-covariance matrix of the Kalman filter using the steady-state value of state variables. Possible values for OPTION are:

default

Uses the default solver for Lyapunov equations based on Bartels-Stewart algorithm.

fixed_point

Uses a fixed point algorithm to solve the Lyapunov equation. This method is faster than the default one for large scale models, but it could require a large amount of iterations.

doubling

Uses a doubling algorithm to solve the Lyapunov equation (disclyap_fast). This method is faster than the two previous one for large scale models.

square_root_solver

Uses a square-root solver for Lyapunov equations (dlyapchol). This method is fast for large scale models (available under MATLAB if the control system toolbox is installed; available under Octave if the control package from Octave-Forge is installed)

Default value is default

lyapunov_fixed_point_tol = DOUBLE

This is the convergence criterion used in the fixed point Lyapunov solver. Its default value is 1e-10.

lyapunov_doubling_tol = DOUBLE

This is the convergence criterion used in the doubling algorithm to solve the Lyapunov equation. Its default value is 1e-16.

analytic_derivation

Triggers estimation with analytic gradient. The final hessian is also computed analytically. Only works for stationary models without missing observations.

ar = INTEGER

See ar. Only useful in conjunction with option moments_varendo.

endogenous_prior

Use endogenous priors as in Christiano, Trabandt and Walentin (2011).

use_univariate_filters_if_singularity_is_detected = INTEGER

Decide whether Dynare should automatically switch to univariate filter if a singularity is encountered in the likelihood computation (this is the behaviour if the option is equal to 1). Alternatively, if the option is equal to 0, Dynare will not automatically change the filter, but rather use a penalty value for the likelihood when such a singularity is encountered. Default: 1.

qz_zero_threshold = DOUBLE

See qz_zero_threshold.

taper_steps = [INTEGER1 INTEGER2 …]

Percent tapering used for the spectral window in the Geweke (1992,1999) convergence diagnostics (requires mh_nblocks=1). The tapering is used to take the serial correlation of the posterior draws into account. Default: [4 8 15].

geweke_interval = [DOUBLE DOUBLE]

Percentage of MCMC draws at the beginning and end of the MCMC chain taken to compute the Geweke (1992,1999) convergence diagnostics (requires mh_nblocks=1) after discarding the first mh_drop percent of draws as a burnin. Default: [0.2 0.5].

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.

In the following variables, we will adopt the following shortcuts for specific field names:

MOMENT_NAME

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

Variance

Variance of the posterior distribution

deciles

Deciles of the distribution.

density

Non parametric estimate of the posterior density. First and second columns are respectively abscissa and ordinate coordinates.

ESTIMATED_OBJECT

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

MATLAB/Octave variable: oo_.MarginalDensity.LaplaceApproximation

Variable set by the estimation command.

MATLAB/Octave variable: oo_.MarginalDensity.ModifiedHarmonicMean

Variable set by the estimation command, if it is used with mh_replic > 0 or load_mh_file option.

MATLAB/Octave variable: oo_.FilteredVariables

Variable set by the estimation command, if it is used with the filtered_vars option.

After an estimation without Metropolis, fields are of the form:

 
oo_.FilteredVariables.VARIABLE_NAME

After an estimation with Metropolis, fields are of the form:

 
oo_.FilteredVariables.MOMENT_NAME.VARIABLE_NAME
MATLAB/Octave variable: oo_.FilteredVariablesKStepAhead

Variable set by the estimation command, if it is used with the filter_step_ahead option. The k-steps are stored along the rows while the columns indicate the respective variables. The third dimension of the array provides the observation for which the forecast has been made. For example, if filter_step_ahead=[1 2 4] and nobs=200, the element (3,5,204) stores the four period ahead filtered value of variable 5 computed at time t=200 for time t=204. The periods at the beginning and end of the sample for which no forecasts can be made, e.g. entries (1,5,1) and (1,5,204) in the example, are set to zero.

MATLAB/Octave variable: oo_.FilteredVariablesKStepAheadVariances

Variable set by the estimation command, if it is used with the filter_step_ahead option.

MATLAB/Octave variable: oo_.Filtered_Variables_X_step_ahead

Variable set by the estimation command, if it is used with the filter_step_ahead option in the context of Bayesian estimation. Fields are of the form:

 
oo_.Filtered_Variables_X_step_ahead.VARIABLE_NAME

The nth entry stores the k-step ahead filtered variable computed at time n for time n+k.

MATLAB/Octave variable: oo_.PosteriorIRF.dsge

Variable set by the estimation command, if it is used with the bayesian_irf option. Fields are of the form:

 
oo_.PosteriorIRF.dsge.MOMENT_NAME.VARIABLE_NAME_SHOCK_NAME
MATLAB/Octave variable: oo_.SmoothedMeasurementErrors

Variable set by the estimation command, if it is used with the smoother option. Fields are of the form:

 
oo_.SmoothedMeasurementErrors.VARIABLE_NAME
MATLAB/Octave variable: oo_.SmoothedShocks

Variable set by the estimation command (if used with the smoother option), or by the calib_smoother command.

After an estimation without Metropolis, or if computed by calib_smoother, fields are of the form:

 
oo_.SmoothedShocks.VARIABLE_NAME

After an estimation with Metropolis, fields are of the form:

 
oo_.SmoothedShocks.MOMENT_NAME.VARIABLE_NAME
MATLAB/Octave variable: oo_.SmoothedVariables

Variable set by the estimation command (if used with the smoother option), or by the calib_smoother command.

After an estimation without Metropolis, or if computed by calib_smoother, fields are of the form:

 
oo_.SmoothedVariables.VARIABLE_NAME

After an estimation with Metropolis, fields are of the form:

 
oo_.SmoothedVariables.MOMENT_NAME.VARIABLE_NAME
MATLAB/Octave variable: oo_.UpdatedVariables

Variable set by the estimation command (if used with the smoother option), or by the calib_smoother command. Contains the estimation of the expected value of variables given the information available at the current date.

After an estimation without Metropolis, or if computed by calib_smoother, fields are of the form:

 
oo_.UpdatedVariables.VARIABLE_NAME

After an estimation with Metropolis, fields are of the form:

 
oo_.UpdatedVariables.MOMENT_NAME.VARIABLE_NAME
MATLAB/Octave variable: oo_.PosteriorTheoreticalMoments

Variable set by the estimation command, if it is used with the moments_varendo option. Fields are of the form:

 
oo_.PosteriorTheoreticalMoments.dsge.THEORETICAL_MOMENT.ESTIMATED_OBJECT.MOMENT_NAME.VARIABLE_NAME

where THEORETICAL_MOMENT is one of the following:

covariance

Variance-covariance of endogenous variables

correlation

Auto- and cross-correlation of endogenous variables. Fields are vectors with correlations from 1 up to order options_.ar

VarianceDecomposition

Decomposition of variance (unconditional variance, i.e. at horizon infinity)(4)

ConditionalVarianceDecomposition

Only if the conditional_variance_decomposition option has been specified

MATLAB/Octave variable: oo_.posterior_density

Variable set by the estimation command, if it is used with mh_replic > 0 or load_mh_file option. Fields are of the form:

 
oo_.posterior_density.PARAMETER_NAME
MATLAB/Octave variable: oo_.posterior_hpdinf

Variable set by the estimation command, if it is used with mh_replic > 0 or load_mh_file option. Fields are of the form:

 
oo_.posterior_hpdinf.ESTIMATED_OBJECT.VARIABLE_NAME
MATLAB/Octave variable: oo_.posterior_hpdsup

Variable set by the estimation command, if it is used with mh_replic > 0 or load_mh_file option. Fields are of the form:

 
oo_.posterior_hpdsup.ESTIMATED_OBJECT.VARIABLE_NAME
MATLAB/Octave variable: oo_.posterior_mean

Variable set by the estimation command, if it is used with mh_replic > 0 or load_mh_file option. Fields are of the form:

 
oo_.posterior_mean.ESTIMATED_OBJECT.VARIABLE_NAME
MATLAB/Octave variable: oo_.posterior_mode

Variable set by the estimation command, if it is used with mh_replic > 0 or load_mh_file option. Fields are of the form:

 
oo_.posterior_mode.ESTIMATED_OBJECT.VARIABLE_NAME
MATLAB/Octave variable: oo_.posterior_std

Variable set by the estimation command, if it is used with mh_replic > 0 or load_mh_file option. Fields are of the form:

 
oo_.posterior_std.ESTIMATED_OBJECT.VARIABLE_NAME

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
MATLAB/Octave variable: oo_.RecursiveForecast

Variable set by the forecast option of the estimation command when used with the nobs = [INTEGER1:INTEGER2] option (see nobs).

Fields are of the form:

 
oo_.RecursiveForecast.FORECAST_OBJECT.VARIABLE_NAME

where FORECAST_OBJECT is one of the following(5):

Mean

Mean of the posterior forecast distribution

HPDinf/HPDsup

Upper/lower bound of the 90% HPD interval taking into account only parameter uncertainty

HPDTotalinf/HPDTotalsup

Upper/lower bound of the 90% HPD interval taking into account both parameter and future shock uncertainty

VARIABLE_NAME contains a matrix of the following size: number of time periods for which forecasts are requested using the nobs = [INTEGER1:INTEGER2] option times the number of forecast horizons requested by the forecast option. I.e., the row indicates the period at which the forecast is performed and the column the respective k-step ahead forecast. The starting periods are sorted in ascending order, not in declaration order.

MATLAB/Octave variable: oo_.convergence.geweke

Variable set by the convergence diagnostics of the estimation command when used with mh_nblocks=1 option (see mh_nblocks).

Fields are of the form:

 
oo_.convergence.geweke.VARIABLE_NAME.DIAGNOSTIC_OBJECT

where DIAGNOSTIC_OBJECT is one of the following:

posteriormean

Mean of the posterior parameter distribution

posteriorstd

Standard deviation of the posterior parameter distribution

nse_iid

Numerical standard error (NSE) under the assumption of iid draws

rne_iid

Relative numerical efficiency (RNE) under the assumption of iid draws

nse_x

Numerical standard error (NSE) when using an x% taper

rne_x

Relative numerical efficiency (RNE) when using an x% taper

pooled_mean

Mean of the parameter when pooling the beginning and end parts of the chain specified in geweke_interval and weighting them with their relative precision. It is a vector containing the results under the iid assumption followed by the ones using the taper_steps (see taper_steps).

pooled_nse

NSE of the parameter when pooling the beginning and end parts of the chain and weighting them with their relative precision. See pooled_mean

prob_chi2_test

p-value of a chi squared test for equality of means in the beginning and the end of the MCMC chain. See pooled_mean. A value above 0.05 indicates that the null hypothesis of equal means and thus convergence cannot be rejected at the 5 percent level. Differing values along the taper_steps signal the presence of significant autocorrelation in draws. In this case, the estimates using a higher tapering are usually more reliable.

Command: model_comparison FILENAME[(DOUBLE)]…;
Command: model_comparison (marginal_density = laplace | modifiedharmonicmean) FILENAME[(DOUBLE)]…;

Description

This command computes odds ratios and estimate a posterior density over a collection of models (see e.g. Koop (2003), Ch. 1). The priors over models can be specified as the DOUBLE values, otherwise a uniform prior over all models is assumed. In contrast to frequentist econometrics, the models to be compared do not need to be nested. However, as the computation of posterior odds ratios is a Bayesian technique, the comparison of models estimated with maximum likelihood is not supported.

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.

Command: shock_decomposition [VARIABLE_NAME]…;
Command: shock_decomposition (OPTIONS…) [VARIABLE_NAME]…;

Description

This command computes and displays shock decomposition according to the model for a given sample.

Note that this command must come after either estimation (in case of an estimated model) or stoch_simul (in case of a calibrated model).

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: calibration, prior_mode, prior_mean, posterior_mode, posterior_mean, posterior_median. Default value: posterior_mean if Metropolis has been run, else posterior_mode.

datafile = FILENAME

See datafile. Useful when computing the shock decomposition on a calibrated model.

The results are stored in the field oo_.shock_decomposition, which is a three dimensional array. The first dimension contains the endogenous variables for which the shock decomposition has been requested. The second dimension stores in the first M_.exo_nbr columns the contribution of the respective shocks. Column M_.exo_nbr+1 stores the contribution of the initial conditions, while column M_.exo_nbr+2 stores the smoothed value of the respective endogenous variable. The third dimension stores the time periods.

Command: unit_root_vars VARIABLE_NAME…;

This command is deprecated. Use estimation option diffuse_filter instead for estimating a model with non-stationary observed variables or steady option nocheck to prevent steady to check the steady state returned by your steady state file.

Dynare also has the ability to estimate Bayesian VARs:

Command: bvar_density ;

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.

Dynare can also run the smoother on a calibrated model:

Command: calib_smoother [VARIABLE_NAME]…;
Command: calib_smoother (OPTIONS…) [VARIABLE_NAME]…;

Description

This command computes the smoothed variables (and possible the filtered variables) on a calibrated model.

A datafile must be provided, and the observable variables declared with varobs. The smoother is based on a first-order approximation of the model.

By default, the command computes the smoothed variables and shocks and stores the results in oo_.SmoothedVariables and oo_.SmoothedShocks. It also fills oo_.UpdatedVariables.

Options

datafile = FILENAME

See datafile.

filtered_vars

Triggers the computation of filtered variables. See filtered_vars, for more details.

filter_step_ahead = [INTEGER1:INTEGER2]

See filter_step_ahead.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Build Daemon user on December 6, 2015 using texi2html 1.82.