diff --git a/matlab/evaluate_planner_objective.m b/matlab/evaluate_planner_objective.m index d912c9cd171b7cf389b6f646c59515fc28be86b4..cbaf1b4d090f1c73b24db8b393aa19d011d1ce55 100644 --- a/matlab/evaluate_planner_objective.m +++ b/matlab/evaluate_planner_objective.m @@ -1,13 +1,22 @@ function planner_objective_value = evaluate_planner_objective(M_,options_,oo_) - +% function planner_objective_value = evaluate_planner_objective(M_,options_,oo_) +% INPUTS +% M_: (structure) model description +% options_: (structure) options +% oo_: (structure) output results % OUTPUT -% Returns a vector containing first order or second-order approximations of +% planner_objective_value (double) +% +%Returns a vector containing first order or second-order approximations of % - the unconditional expectation of the planner's objective function % - the conditional expectation of the planner's objective function starting from the non-stochastic steady state and allowing for future shocks % depending on the value of options_.order. +% +% SPECIAL REQUIREMENTS +% none % ALGORITHM -% Welfare verifies +% Welfare satifies % W(y_{t-1}, u_t, sigma) = U(h(y_{t-1}, u_t, sigma)) + beta E_t W(g(y_{t-1}, u_t, sigma), u_t, sigma) % where % - W is the welfare function @@ -20,7 +29,7 @@ function planner_objective_value = evaluate_planner_objective(M_,options_,oo_) % - beta is the planner's discount factor % - E_t is the expectation operator given information at time t i.e. (y_{t-1}, u_t, sigma) -% The unconditional expectation of the planner's objective function verifies +% The unconditional expectation of the planner's objective function satisfies % E(W) = E(U)/(1-beta) % The conditional expectation of the planner's objective function given (y_{t-1}, u_t, sigma) coincides with the welfare function delineated above. @@ -51,14 +60,6 @@ function planner_objective_value = evaluate_planner_objective(M_,options_,oo_) % In the deterministic case, resorting to approximations for welfare is no longer required as it is possible to simulate the model given initial conditions for pre-determined variables and terminal conditions for forward-looking variables, whether these initial and terminal conditions are explicitly or implicitly specified. Assuming that the number of simulated periods is high enough for the new steady-state to be reached, the new unconditional welfare is thus the last period's welfare. As for the conditional welfare, it can be derived using backward recursions on the equation W = U + beta*W(+1) starting from the final unconditional steady-state welfare. -% INPUTS -% M_: (structure) model description -% options_: (structure) options -% oo_: (structure) output results -% -% SPECIAL REQUIREMENTS -% none - % Copyright (C) 2007-2021 Dynare Team % % This file is part of Dynare. @@ -77,6 +78,9 @@ function planner_objective_value = evaluate_planner_objective(M_,options_,oo_) % along with Dynare. If not, see . dr = oo_.dr; +if isempty(options_.qz_criterium) + options_.qz_criterium = 1+1e-6; +end exo_nbr = M_.exo_nbr; nstatic = M_.nstatic; @@ -132,7 +136,10 @@ if options_.ramsey_policy options_.noprint = 1; end var_list = M_.endo_names(dr.order_var(nstatic+(1:nspred))); - [info, oo_, options_] = stoch_simul(M_, options_, oo_, var_list); %get decision rules and moments + if options_.pruning + fprintf('evaluate_planner_objective: pruning option is not supported and will be ignored\n') + end + oo_=disp_th_moments(dr,var_list,M_,options_,oo_); if ~old_noprint options_.noprint = 0; end @@ -198,7 +205,7 @@ elseif options_.discretionary_policy options_.noprint = 1; end var_list = M_.endo_names(dr.order_var(nstatic+(1:nspred))); - [info, oo_, options_] = stoch_simul(M_, options_, oo_, var_list); %get decision rules and moments + oo_=disp_th_moments(dr,var_list,M_,options_,oo_); if ~old_noprint options_.noprint = 0; end diff --git a/mex/sources/k_order_welfare/k_order_welfare.cc b/mex/sources/k_order_welfare/k_order_welfare.cc index 8a41b91d3cb89ea8117346c7bdb881dd92ac5bce..266d133383553a75bbe70e1bd095e3de4acc07f7 100644 --- a/mex/sources/k_order_welfare/k_order_welfare.cc +++ b/mex/sources/k_order_welfare/k_order_welfare.cc @@ -89,8 +89,6 @@ extern "C" { int nrhs, const mxArray *prhs[]) { - mexPrintf("k_order_welfare\n"); - const mxArray *dr_mx = prhs[0]; const mxArray *M_mx = prhs[1]; const mxArray *options_mx = prhs[2]; diff --git a/tests/optimal_policy/neo_growth_ramsey_k_order.mod b/tests/optimal_policy/neo_growth_ramsey_k_order.mod index e34db561368a93a3ad9ea86fedf3aed1999336f7..658ed715178c51794b13ac044dfc7fe3ff3a8732 100644 --- a/tests/optimal_policy/neo_growth_ramsey_k_order.mod +++ b/tests/optimal_policy/neo_growth_ramsey_k_order.mod @@ -31,8 +31,13 @@ end; stoch_simul(order=6, irf=0); +evaluate_planner_objective; + [condWelfare, U_dynpp, W_dynpp, U_dyn, W_dyn] = k_order_welfare(oo_.dr, M_, options_); +if condWelfare~=oo_.planner_objective_value(1) + error('Values do not match'); +end if ~exist('neo_growth_k_order_results.mat','file'); error('neo_growth_k_order must be run first'); end;