Skip to content
Snippets Groups Projects
Commit 3c7e60b7 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Bug related to the steady state of aux. variables.

Appears in CMR's model where the steady state of the auxiliary variables
is not correct if set_auxiliary_variables routine is only called once.

Added a debug mode (false by default) to check that the mapping defined
by set_auxiliary_variables routine is invariant.
parent 34bc1ab9
Branches
No related tags found
No related merge requests found
...@@ -36,11 +36,14 @@ function [ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M,options) ...@@ -36,11 +36,14 @@ function [ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M,options)
% 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/>.
debug = false;
ys = []; ys = [];
params = [];
info = 0;
params = M.params; params = M.params;
info = 0;
fname = M.fname; fname = M.fname;
if options.steadystate_flag == 1 if options.steadystate_flag == 1
% old format % old format
assignin('base','tmp_00_',params); assignin('base','tmp_00_',params);
...@@ -88,13 +91,46 @@ function [ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M,options) ...@@ -88,13 +91,46 @@ function [ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M,options)
% adding values for auxiliary variables % adding values for auxiliary variables
if length(M.aux_vars) > 0 && ~options.ramsey_policy if length(M.aux_vars) > 0 && ~options.ramsey_policy
if debug
ys0 = ys;
end
ys = h_set_auxiliary_variables(ys,exo_ss,params); ys = h_set_auxiliary_variables(ys,exo_ss,params);
if debug
ys1 = ys;
end
ys = h_set_auxiliary_variables(ys,exo_ss,params);
if debug
ys2 = ys;
end
if debug
ys = h_set_auxiliary_variables(ys,exo_ss,params);
ys3 = ys;
idx = find(abs(ys0-ys1)>0);
if ~isempty(idx)
M.endo_names(idx,:)
else
disp('1-invariant')
end
idx = find(abs(ys2-ys1)>0);
if ~isempty(idx)
M.endo_names(idx,:)
else
disp('2-invariant')
end
idx = find(abs(ys3-ys3)>0);
if ~isempty(idx)
M.endo_names(idx,:)
else
disp('3-invariant')
end
pause
end
end end
check1 = 0; check1 = 0;
if ~options.steadystate.nocheck if ~options.steadystate.nocheck
% Check whether the steady state obtained from the _steadystate file is a steady state. % 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); [residuals, check] = evaluate_static_model(ys, exo_ss, params, M, options);
if check if check
info(1) = 19; info(1) = 19;
info(2) = check; % to be improved info(2) = check; % to be improved
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment