Fixes related to estimation under discretion

time-shift
Johannes Pfeifer 2020-02-06 13:30:00 +01:00
parent 931ebece92
commit 30bfa16211
4 changed files with 24 additions and 4 deletions

View File

@ -145,7 +145,11 @@ while fpar<B
end
stock_param(irun2,:) = deep;
set_parameters(deep);
[dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
if options_.discretionary_policy
[dr,info,M_,options_,oo_] = discretionary_policy_1(options_.instruments,M_,options_,oo_);
else
[dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
end
oo_.dr = dr;
if info(1)
nosaddle = nosaddle + 1;

View File

@ -1,6 +1,17 @@
function [dr, info, M_, options_, oo_]=discretionary_policy_1(Instruments, M_, options_, oo_)
% Higher-level function for solving discretionary optimal policy
% Has the same interface as resol.m
% INPUTS
% - Instruments [cell] array containing instrument names
% - M_ [structure] Matlab's structure describing the model (M_).
% - options_ [structure] Matlab's structure describing the current options (options_).
% - oo_ [structure] Matlab's structure containing the results (oo_).
%
% OUTPUTS
% - dr [structure] Reduced form model.
% - info [integer] scalar or vector, error code.
% - M_ [structure] Matlab's structure describing the model (M_).
% - options_ [structure] Matlab's structure describing the current options (options_).
% - oo_ [structure] Matlab's structure containing the results (oo_).
% Copyright (C) 2007-2020 Dynare Team
%

View File

@ -115,7 +115,11 @@ if info
pdraws(i,1) = {x2(SampleAddress(i,4),:)};
if info-1
set_parameters(pdraws{i,1});
[dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
if options_.discretionary_policy
[dr,info,M_,options_,oo_] = discretionary_policy_1(options_.instruments,M_,options_,oo_);
else
[dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
end
pdraws(i,2) = { dr };
end
old_mhfile = mhfile;

View File

@ -35,7 +35,8 @@ estimated_params;
kappa, normal_pdf, 0.2, 0.1;
end;
estimation(order = 1, datafile = dennis_simul, mh_replic = 2000);
options_.plot_priors=0;
estimation(order = 1, datafile = dennis_simul, mh_replic = 2000, mh_nblocks=1,smoother,bayesian_irf,moments_varendo) y i pi pi_c q;
if max(abs(oo_.posterior.optimization.mode - [1; 0.3433])) > 0.025
error('Posterior mode too far from true parameter values');