Implement estimation under discretionary optimal policy

Also add a test case.

For the time being, estimating parameters that appear in the discount factor is
not supported.

Ref. #1173
parent 59e11615
......@@ -8470,6 +8470,10 @@ Optimal policy under discretion
quadratic. Also, you should set the ``linear`` option of the
``model`` block.
It is possible to use the :comm:`estimation` command after the
``discretionary_policy`` command, in order to estimate the model with
optimal policy under discretion.
*Options*
This command accepts the same options as ``ramsey_policy``, plus:
......
......@@ -49,7 +49,7 @@ function [A,B,ys,info,Model,DynareOptions,DynareResults] = dynare_resolve(Model,
%! @end deftypefn
%@eod:
% Copyright (C) 2001-2017 Dynare Team
% Copyright (C) 2001-2020 Dynare Team
%
% This file is part of Dynare.
%
......@@ -66,8 +66,11 @@ function [A,B,ys,info,Model,DynareOptions,DynareResults] = dynare_resolve(Model,
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
[dr,info,Model,DynareOptions,DynareResults] = resol(0,Model,DynareOptions,DynareResults);
DynareResults.dr = dr;
if DynareOptions.discretionary_policy
[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
A = [];
......
......@@ -30,7 +30,7 @@ function myoutput=prior_posterior_statistics_core(myinputs,fpar,B,whoiam, ThisMa
% SPECIAL REQUIREMENTS.
% None.
% Copyright (C) 2005-2017 Dynare Team
% Copyright (C) 2005-2020 Dynare Team
%
% This file is part of Dynare.
%
......@@ -203,7 +203,11 @@ for b=fpar:B
M_ = set_all_parameters(deep,estim_params_,M_);
if run_smoother
[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
[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_);
......
......@@ -100,6 +100,7 @@ MODFILES = \
optimal_policy/Ramsey/Gali_commitment.mod \
optimal_policy/RamseyConstraints/test1.mod \
discretionary_policy/dennis_1.mod \
discretionary_policy/dennis_1_estim.mod \
discretionary_policy/Gali_discretion.mod \
initval_file/ramst_initval_file.mod \
initval_file/ramst_datafile.mod \
......@@ -583,6 +584,10 @@ kalman/likelihood_from_dynare/fs2000ns_corr_ME_missing.o.trs: kalman/likelihood_
lmmcp/sw_newton.m.trs: lmmcp/sw_lmmcp.m.trs
lmmcp/sw_newton.o.trs: lmmcp/sw_lmmcp.o.trs
discretionary_policy/dennis_1_estim.m.trs: discretionary_policy/dennis_1.m.trs
discretionary_policy/dennis_1_estim.o.trs: discretionary_policy/dennis_1.o.trs
observation_trends_and_prefiltering/MCMC: m/observation_trends_and_prefiltering/MCMC o/observation_trends_and_prefiltering/MCMC
m/observation_trends_and_prefiltering/MCMC: $(patsubst %.mod, %.m.trs, $(filter observation_trends_and_prefiltering/MCMC/%.mod, $(MODFILES)))
o/observation_trends_and_prefiltering/MCMC: $(patsubst %.mod, %.o.trs, $(filter observation_trends_and_prefiltering/MCMC/%.mod, $(MODFILES)))
......@@ -1064,6 +1069,8 @@ clean-local:
k_order_perturbation/fs2000k++.jnl k_order_perturbation/fs2000k++_f.m \
k_order_perturbation/fs2000k++_ff.m
rm -f discretionary_policy/dennis_simul.m
find . -name "*.tex" -type f -delete
find . -name "*.aux" -type f -delete
find . -name "*.log" -type f -delete
......
......@@ -29,5 +29,7 @@ var e; stderr 1;
end;
planner_objective pi_c^2 + y^2;
discretionary_policy(instruments=(i),irf=0,planner_discount=beta);
discretionary_policy(instruments=(i),irf=0,planner_discount=beta, periods=200);
// Generate data used by dennis_1_estim.mod
datatomfile('dennis_simul', {'y'; 'i'; 'pi';});
/* Test for estimation under discretionary optimal policy.
Uses the data generated by dennis_1.mod */
var y i pi pi_c q;
varexo g u e;
parameters omega kappa sigma beta alpha;
alpha = 0.4;
beta = 0.99;
sigma = 1;
omega = 0.9;
kappa = 0.3;
model(linear);
y = y(+1) -(omega/sigma)*(i-pi(+1))+g;
pi = beta*pi(+1)+kappa*y+u;
pi_c = pi+(alpha/(1-alpha))*(q-q(-1));
q = q(+1)-(1-alpha)*(i-pi(+1))+(1-alpha)*e;
end;
shocks;
var g; stderr 1;
var u; stderr 1;
var e; stderr 1;
end;
planner_objective pi_c^2 + y^2;
discretionary_policy(instruments=(i),irf=0,planner_discount=beta);
varobs y i pi;
estimated_params;
omega, normal_pdf, 0.9, 0.1;
kappa, normal_pdf, 0.2, 0.1;
end;
estimation(order = 1, datafile = dennis_simul, mh_replic = 2000);
if max(abs(oo_.posterior.optimization.mode - [1; 0.3433])) > 0.025
error('Posterior mode too far from true parameter values');
end
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