estimation

estimation — computes estimation

Synopsis

estimation [(OPTION [, OPTION...])] [VARIABLE_NAME...];

Options

datafile = FILENAME

The datafile (a .m file, a .mat file or a .xls file)

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 = [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

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

Default value is 1.

lik_algo = INTEGER

...

conf_sig = DOUBLE

See there

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

Specifies the optimizer for the mode computation:

  • 0: the mode isn't computed. mode_file must be specified

  • 1: uses Matlab®'s fmincon

  • 2: value no longer used

  • 3: uses Matlab®'s fminunc

  • 4: uses Chris Sim's csminwel

  • 5: uses a routine by Marco Ratto

  • 6: uses a simulated annealing-like algorithm

  • 7: uses Matlab®'s fminsearch (a simplex based routine)

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

moments_varendo

Triggers the computation of the posterior distribution of the theoretical moments of the endogenous variables

filtered_vars

Triggers the computation of the posterior distribution of filtered endogenous variables and shocks

smoother

Triggers the computation of the posterior distribution of smoothered endogenous variables and shocks

forecast = INTEGER

Computes the posterior distribution of a forecast on INTEGER periods after the end of the sample used in estimation

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 = INTEGER

...

filter_step_ahead = [INTEGER_1:INTEGER_2]

...

constant

...

noconstant

...

diffuse_filter

...

solve_algo = INTEGER

See there

order = INTEGER

See there

irf = INTEGER

See there

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.

Results

  • results from posterior optimization (also for maximum likelihood)

  • marginal log density

  • mean and shortest confidence interval from posterior simulation

  • Metropolis-Hastings convergence graphs that still need to be documented

  • graphs with prior, posterior and mode

  • graphs of smoothed shocks, smoothed observation errors, smoothed and historical variables

Output

After running estimation, the parameters and the variance matrix 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 and the variance matrix of the shocks are set to the posterior mean.

Depending on the options, estimation stores results in the following fields of structure oo_:

Table 4.1. Content of oo_

Field 1Field 2Field 3Field 4Field 5Required options
ForecastSee Moments of forecastsVariable name  forecast
MarginalDensityLaplaceApproximation   Always provided
ModifiedHarmonicMean   

mh_replic> 0 or load_mh_file

PosteriorFilteredVariablesSee Moments NamesVariable name  

filtered_vars

PosteriorIRFDsgeSee Moments Names

IRF name: name of endogenous variable '_' name of shock

 bayesian_irf
PosteriorSmoothedObservationErrorsSee Moments NamesVariable name  

smoother

PosteriorSmoothedShocksSee Moments NamesVariable name  

smoother

PosteriorSmoothedVariablesSee Moments NamesVariable name  

smoother

PosteriorTheoreticalMomentsSee Theoretical MomentsSee Estimated ObjectsSee Moments NamesVariable namemoments_varendo
posterior_densityParameter name   

mh_replic> 0 or load_mh_file

posterior_hpdinfSee Estimated ObjectsVariable name  

mh_replic> 0 or load_mh_file

posterior_hpdsupSee Estimated ObjectsVariable name  

mh_replic> 0 or load_mh_file

posterior_meanSee Estimated ObjectsVariable name  

mh_replic> 0 or load_mh_file

posterior_modeSee Estimated ObjectsVariable name  

mh_replic> 0 or load_mh_file

posterior_stdSee Estimated ObjectsVariable name  

mh_replic> 0 or load_mh_file


Table 4.2. Moments of forecasts

Field nameDescription
HPDinfLower bound of a 90% HPD interval[a] of forecast due to parameter uncertainty
HPDsupLower bound of a 90% HPD interval [a] due to parameter uncertainty
HPDTotalinfLower bound of a 90% HPD interval of forecast [a] due to parameter uncertainty and future shocks
HPDTotalsupLower bound of a 90% HPD interval [a] due to parameter uncertainty and future shocks
MeanMean of the posterior distribution of forecasts
MedianMedian of the posterior distribution of forecasts
StdStandard deviation of the posterior distribution of forecasts

[a] See option conf_sig to change the size of the HPD interval


Table 4.3. Moments Names

Field nameDescription
HPDinfLower bound of a 90% HPD interval[a]
HPDsupUpper bound of a 90% HPD interval [a]
MeanMean of the posterior distribution
MedianMedian of the posterior distribution
StdStandard deviation of the posterior distribution

[a] See option conf_sig to change the size of the HPD interval


Table 4.4. Theoretical Moments

Field nameDescription
AutocorrelationAutocorrelation of endogenous variables[a]
CorrelationCorrelation between two endogenous variables
DecompDecomposition of variance[b]
ExpectationExpectation of endogenous variables
Variance(co-)variance of endogenous variables

[a] The autocorrlation coefficients are computed for the number of periods specified in option ar.

[b] When the shocks are correlated, it is the decomposition of orthogonalized shocks via Cholesky decompostion according to the order of declaration of shocks (see varexo).


Table 4.5. Estimated objects

Field nameDescription
measurement_errors_corrCorrelation between two measurement errors
measurement_errors_stdStandard deviation of measurement errors
parametersParameters
shocks_corrCorrelation between two structural shocks
shocks_stdStandard deviation of structural shocks


Examples

oo_.posterior_mode.parameters.alp
oo_.posterior_mean.shocks_std.ex
oo_.posterior_hpdsup.measurement_errors_corr.gdp_conso

Note on steady state computation

If you know how to compute the steady state for your model, you can provide a Matlab® function doing the computation instead of using steady. The function should be called with the name of the .mod file followed by _steadystate. See fs2000a_steadystate.m in examples/fs2000 directory.