Make evaluate_steady_state.m honor nocheck flag

Closes #1054
time-shift
Johannes Pfeifer 2016-03-25 20:16:43 +01:00
parent b688cbe5b2
commit a93d68fb35
4 changed files with 22 additions and 18 deletions

View File

@ -1,20 +1,24 @@
function [steady_state,params,check] = dyn_ramsey_static(ys_init,M,options_,oo)
% function [steady_state,params,check] = dyn_ramsey_static_(x)
% Computes the static first order conditions for optimal policy
% function [steady_state,params,check] = dyn_ramsey_static_(ys_init,M,options_,oo)
% Computes the steady state for optimal policy
%
% INPUTS
% x: vector of endogenous variables or instruments
%
% ys_init: vector of endogenous variables or instruments
% M: Dynare model structure
% options: Dynare options structure
% oo: Dynare results structure
%
% OUTPUTS
% resids: residuals of non linear equations
% rJ: Jacobian
% mult: Lagrangian multipliers
% steady_state: steady state value
% params: parameters at steady state, potentially updated by
% steady_state file
% check: Lagrangian multipliers
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2003-2015 Dynare Team
% Copyright (C) 2003-2016 Dynare Team
%
% This file is part of Dynare.
%
@ -34,7 +38,7 @@ function [steady_state,params,check] = dyn_ramsey_static(ys_init,M,options_,oo)
params = M.params;
check = 0;
options_.steadystate.nocheck = 1; %disable checking because Lagrange multipliers are not accounted for in evaluate_steady_state_file
options_.steadystate.nocheck = 1; %locally disable checking because Lagrange multipliers are not accounted for in evaluate_steady_state_file
% dyn_ramsey_static_1 is a subfunction
nl_func = @(x) dyn_ramsey_static_1(x,M,options_,oo);
@ -62,7 +66,7 @@ elseif options_.steadystate_flag
end
ys_init(k_inst) = inst_val;
exo_ss = [oo.exo_steady_state oo.exo_det_steady_state];
[xx,params,check] = evaluate_steady_state_file(ys_init,exo_ss,M,options_); %run steady state file again to update parameters
[xx,params,check] = evaluate_steady_state_file(ys_init,exo_ss,M,options_,~options_.steadystate.nocheck); %run steady state file again to update parameters
[junk,junk,steady_state] = nl_func(inst_val); %compute and return steady state
else
n_var = M.orig_endo_nbr;
@ -105,7 +109,7 @@ if options_.steadystate_flag
[x,params,check] = evaluate_steady_state_file(ys_init,... %returned x now has size endo_nbr as opposed to input size of n_instruments
[oo.exo_steady_state; ...
oo.exo_det_steady_state], ...
M,options_);
M,options_,~options_.steadystate.nocheck);
end
xx = zeros(endo_nbr,1); %initialize steady state vector

View File

@ -57,7 +57,7 @@ function [ys,params,info] = evaluate_steady_state(ys_init,M,options,oo,steadysta
if steadystate_flag
% explicit steady state file
[ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M, ...
options);
options,steadystate_check_flag);
%test whether it solves model conditional on the instruments
resids = evaluate_static_model(ys,exo_ss,params,M,options);
n_multipliers=M.ramsey_eq_nbr;
@ -186,7 +186,7 @@ function [ys,params,info] = evaluate_steady_state(ys_init,M,options,oo,steadysta
elseif steadystate_flag
% explicit steady state file
[ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M, ...
options);
options,steadystate_check_flag);
if size(ys,2)>size(ys,1)
error('STEADY: steady_state-file must return a column vector, not a row vector.')
end

View File

@ -1,5 +1,5 @@
function [ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M,options)
% function [ys,params1,info] = evaluate_steady_state_file(ys_init,exo_ss,M,options)
function [ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M,options,steady_state_checkflag)
% function [ys,params1,info] = evaluate_steady_state_file(ys_init,exo_ss,M,options,steady_state_checkflag)
% Evaluates steady state files
%
% INPUTS
@ -8,7 +8,7 @@ function [ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M,options)
% exo_ss vector exogenous steady state
% M struct model parameters
% options struct options
%
% steady_state_checkflag boolean indicator whether to check steady state returned
% OUTPUTS
% ys vector steady state
% params1 vector model parameters possibly
@ -128,7 +128,7 @@ function [ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M,options)
end
check1 = 0;
if ~options.steadystate.nocheck
if steady_state_checkflag
% Check whether the steady state obtained from the _steadystate file is a steady state.
[residuals, check] = evaluate_static_model(ys, exo_ss, params, M, options);
if check

View File

@ -38,7 +38,7 @@ global ys0_
if options_.steadystate_flag
[oo_.steady_state,M_.params,check] = ...
evaluate_steady_state_file(oo_.steady_state,oo_.exo_steady_state,M_, ...
options_);
options_,~options_.steadystate.nocheck);
end
if isempty(oo_.steady_state)