Commit 0efcef8f authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Added the possibility to declare non linear prior restrictions over estimated parameters.

If a file <MOD_FILE_NAME>_prior_restrictions.m exists in current folder, the value returned by this routine is
substracted to fval (likelihood-lnprior) at the end of dsge_likelihood. The arguments of this routine are: M_,
oo_, options_, dataset_ and dataset_info. Routines for writing <MOD_FILE_NAME>_prior_restrictions.m will be
provided later.
parent c13738ee
......@@ -809,6 +809,7 @@ if analytic_derivation
else
lnprior = priordens(xparam1,BayesInfo.pshape,BayesInfo.p6,BayesInfo.p7,BayesInfo.p3,BayesInfo.p4);
end
if DynareOptions.endogenous_prior==1
if DynareOptions.lik_init==2 || DynareOptions.lik_init==3
error('Endogenous prior not supported with non-stationary models')
......@@ -820,6 +821,11 @@ else
fval = (likelihood-lnprior);
end
if DynareOptions.prior_restrictions.status
tmp = feval(DynareOptions.prior_restrictions.routine, Model, DynareResults, DynareOptions, DynareDataset, DatasetInfo);
fval = fval - tmp;
end
if isnan(fval)
info = 47;
fval = objective_function_penalty_base + 100;
......
......@@ -130,6 +130,12 @@ if ~isempty(estim_params_)
[xparam1,estim_params_,bayestopt_,lb,ub,M_] = set_prior(estim_params_,M_,options_);
end
% Check if a _prior_restrictions.m file exists
if exist([M_.fname '_prior_restrictions.m'])
options_.prior_restrictions.status = 1;
options_.prior_restrictions.routine = str2func([M_.fname '_prior_restrictions.m']);
end
% Check that the provided mode_file is compatible with the current estimation settings.
if ~isempty(estim_params_) && ~isempty(options_.mode_file) && ~options_.mh_posterior_mode_estimation
number_of_estimated_parameters = length(xparam1);
......
......@@ -394,6 +394,10 @@ options_.MCMC_jumping_covariance='hessian';
options_.use_calibration_initialization = 0;
options_.endo_vars_for_moment_computations_in_estimation=[];
% Prior restrictions
options_.prior_restrictions.status = 0;
options_.prior_restrictions.routine = [];
options_.mode_compute = 4;
options_.mode_file = '';
options_.moments_varendo = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment