Fix bug in dyn_ramsey_static.m with steady state file that resulted in incorrect steady state when running twice

The x returned by a steady state file includes Lagrange multipliers. When starting with 0 multipliers, the steady state of the multipliers is computed correctly. But when running it a second time like in a subsequent call to stoch_simul, the algorithm thinks that elements of xx are 0 which they aren't. As a result, it finds minus the multiplier as the solution, resulting in an output of 0 for all multipliers.
time-shift
Johannes Pfeifer 2014-07-18 12:35:52 +02:00
parent 3f72f394aa
commit 7c09435e5e
1 changed files with 2 additions and 2 deletions

View File

@ -34,7 +34,7 @@ function [steady_state,params,check] = dyn_ramsey_static(x,M,options_,oo)
params = M.params;
check = 0;
options_.steadystate.nocheck = 1;
options_.steadystate.nocheck = 1; %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);
@ -100,7 +100,7 @@ if options_.steadystate_flag
end
xx = zeros(endo_nbr,1);
xx(1:length(x)) = x;
xx(1:M.orig_endo_nbr) = x(1:M.orig_endo_nbr); %take care of steady state file that will also return multipliers
% setting steady state of auxiliary variables
% that depends on original endogenous variables
if any([M.aux_vars.type] ~= 6)