Factorize call to solver routines under optimal policy and without
Related to https://git.dynare.org/Dynare/dynare/issues/1173time-shift
parent
b07adee2d9
commit
8b4fa7c2d6
|
@ -145,11 +145,7 @@ while fpar<B
|
||||||
end
|
end
|
||||||
stock_param(irun2,:) = deep;
|
stock_param(irun2,:) = deep;
|
||||||
set_parameters(deep);
|
set_parameters(deep);
|
||||||
if options_.discretionary_policy
|
[dr,info,M_,options_,oo_] =compute_decision_rules(M_,options_,oo_);
|
||||||
[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;
|
oo_.dr = dr;
|
||||||
if info(1)
|
if info(1)
|
||||||
nosaddle = nosaddle + 1;
|
nosaddle = nosaddle + 1;
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
function [dr,info,M_,options_,oo_] =compute_decision_rules(M_,options_,oo_)
|
||||||
|
% function [dr,info,M_,options_,oo_] =compute_decision_rules(M_,options_,oo_)
|
||||||
|
% INPUTS
|
||||||
|
% - 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) 2020 Dynare Team
|
||||||
|
%
|
||||||
|
% This file is part of Dynare.
|
||||||
|
%
|
||||||
|
% Dynare is free software: you can redistribute it and/or modify
|
||||||
|
% it under the terms of the GNU General Public License as published by
|
||||||
|
% the Free Software Foundation, either version 3 of the License, or
|
||||||
|
% (at your option) any later version.
|
||||||
|
%
|
||||||
|
% Dynare is distributed in the hope that it will be useful,
|
||||||
|
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
% GNU General Public License for more details.
|
||||||
|
%
|
||||||
|
% You should have received a copy of the GNU General Public License
|
||||||
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
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
|
|
@ -66,11 +66,7 @@ function [A,B,ys,info,Model,DynareOptions,DynareResults] = dynare_resolve(Model,
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
if DynareOptions.discretionary_policy
|
[dr,info,Model,DynareOptions,DynareResults] =compute_decision_rules(Model,DynareOptions,DynareResults);
|
||||||
[dr,info,Model,DynareOptions,DynareResults] = discretionary_policy_1(DynareOptions.instruments,Model,DynareOptions,DynareResults);
|
|
||||||
else
|
|
||||||
[dr,info,Model,DynareOptions,DynareResults] = resol(0,Model,DynareOptions,DynareResults);
|
|
||||||
end
|
|
||||||
|
|
||||||
if info(1) > 0
|
if info(1) > 0
|
||||||
A = [];
|
A = [];
|
||||||
|
|
|
@ -203,11 +203,7 @@ for b=fpar:B
|
||||||
M_ = set_all_parameters(deep,estim_params_,M_);
|
M_ = set_all_parameters(deep,estim_params_,M_);
|
||||||
|
|
||||||
if run_smoother
|
if run_smoother
|
||||||
if options_.discretionary_policy
|
[dr,info,M_,options_,oo_] =compute_decision_rules(M_,options_,oo_);
|
||||||
[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
|
|
||||||
[alphahat,etahat,epsilonhat,alphatilde,SteadyState,trend_coeff,aK,~,~,P,~,~,trend_addition,state_uncertainty,M_,oo_,options_,bayestopt_] = ...
|
[alphahat,etahat,epsilonhat,alphatilde,SteadyState,trend_coeff,aK,~,~,P,~,~,trend_addition,state_uncertainty,M_,oo_,options_,bayestopt_] = ...
|
||||||
DsgeSmoother(deep,gend,Y,data_index,missing_value,M_,oo_,options_,bayestopt_,estim_params_);
|
DsgeSmoother(deep,gend,Y,data_index,missing_value,M_,oo_,options_,bayestopt_,estim_params_);
|
||||||
|
|
||||||
|
|
|
@ -115,11 +115,7 @@ if info
|
||||||
pdraws(i,1) = {x2(SampleAddress(i,4),:)};
|
pdraws(i,1) = {x2(SampleAddress(i,4),:)};
|
||||||
if info-1
|
if info-1
|
||||||
set_parameters(pdraws{i,1});
|
set_parameters(pdraws{i,1});
|
||||||
if options_.discretionary_policy
|
[dr,info,M_,options_,oo_] =compute_decision_rules(M_,options_,oo_);
|
||||||
[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 };
|
pdraws(i,2) = { dr };
|
||||||
end
|
end
|
||||||
old_mhfile = mhfile;
|
old_mhfile = mhfile;
|
||||||
|
|
Loading…
Reference in New Issue