estimation — computes estimation.
estimation
[(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 = 1: the estimation procedure demeans the data (default=0, 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 (default) approximation. The data must correspond to the definition of the variables used in the modelx.
nograph: no graphs should be plotted
lik_init: INTEGER
: type of initialization of Kalman filter.
1 (default): 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.
conf_sig = {INTEGER | DOUBLE}
: the level for the confidence intervals reported in the results (default = 0.90)
mh_replic = INTEGER
: number of replication for Metropolis Hasting algorithm. For the time being, mh_replic should be larger than 1200 (default = 20000.)
mh_nblocks = INTEGER
: number of paralletl chains for Metropolis Hasting 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 MH algorithm. The default value is rarely satisfactory. This option must be tune to obtain, ideally, an accpetation 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 simulation that crashed prematurely. Shouldn't be used together with load_mh_file
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 NAME
_mode
mode_compute=INTEGER
: specifies the optimizer for the mode computation.
0: the mode isn't computed. mode_file must be specified
1: uses Matlab® fmincon.
2: uses Lester Ingber's Adaptive Simulated Annealing.
3: uses Matlab® fminunc.
4 (default): uses Chris Sim's csminwel.
mode_check: when mode_check is set, Dynare plots 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: when load_mh_file is declared, Dynare adds 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® 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 (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)
All options for stoch_simul
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 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
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 1 | Field 2 | Field 3 | Field 4 | Field 5 | Required options |
---|---|---|---|---|---|
Forecast | See Moments of forecasts | Variable name | forecast | ||
MarginalDensity | LaplaceApproximation | Always provided | |||
ModifiedHarmonicMean | mh_replic> 0 or load_mh_file | ||||
PosteriorFilteredVariables | See Moments Names | Variable name | |||
PosteriorIRF | Dsge | See Moments Names | IRF name: name of endogenous variable '_' name of shock | bayesian_irf | |
PosteriorSmoothedObservationErrors | See Moments Names | Variable name | |||
PosteriorSmoothedShocks | See Moments Names | Variable name | |||
PosteriorSmoothedVariables | See Moments Names | Variable name | |||
PosteriorTheoreticalMoments | See Theoretical Moments | See Estimated Objects | See Moments Names | Variable name | moments_varendo |
posterior_density | Parameter name | mh_replic> 0 or load_mh_file | |||
posterior_hpdinf | See Estimated Objects | Variable name | mh_replic> 0 or load_mh_file | ||
posterior_hpdsup | See Estimated Objects | Variable name | mh_replic> 0 or load_mh_file | ||
posterior_mean | See Estimated Objects | Variable name | mh_replic> 0 or load_mh_file | ||
posterior_mode | See Estimated Objects | Variable name | mh_replic> 0 or load_mh_file | ||
posterior_std | See Estimated Objects | Variable name | mh_replic> 0 or load_mh_file |
Table 4.2. Moments of forecasts
Field name | Description |
---|---|
HPDinf | Lower bound of a 90% HPD interval[a] of forecast due to parameter uncertainty |
HPDsup | Lower bound of a 90% HPD interval [a] due to parameter uncertainty |
HPDTotalinf | Lower bound of a 90% HPD interval of forecast [a] due to parameter uncertainty and future shocks |
HPDTotalsup | Lower bound of a 90% HPD interval [a] due to parameter uncertainty and future shocks |
Mean | Mean of the posterior distribution of forecasts |
Median | Median of the posterior distribution of forecasts |
Std | Standard deviation of the posterior distribution of forecasts |
Table 4.3. Moments Names
Table 4.4. Theoretical Moments
Table 4.5. Estimated objects
Field name | Description |
---|---|
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 |
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.