Ascertain that only correct steady states for linear models are accepted

Without the check, incorrect steady states were accepted. This happened for example if the model was not linear in the first place and solving a wrongly presumed linear equation system did not work.
time-shift
Johannes Pfeifer 2014-09-13 11:10:14 +02:00 committed by Johannes Pfeifer
parent 8bc946c148
commit a5e60834ca
2 changed files with 18 additions and 5 deletions

View File

@ -207,9 +207,16 @@ function [ys,params,info] = evaluate_steady_state(ys_init,M,options,oo,steadysta
disp(['STEADY: numerical initial values or parameters incompatible with the following' ...
' equations'])
disp(ii')
disp('Check whether your model in truly linear')
disp('Check whether your model is truly linear. Put "resid(1);" before "steady;" to see the problematic equations.\n')
elseif isempty(ii) && max(abs(fvec)) > 1e-12
ys = ys_init-jacob\fvec;
resid = evaluate_static_model(ys,exo_ss,params,M,options);
if max(abs(resid)) > 1e-6
check=1;
fprintf('STEADY: No steady state for your model could be found\n')
fprintf('STEADY: Check whether your model is truly linear. Put "resid(1);" before "steady;" to see the problematic equations.\n')
end
else
ys = ys_init;
end
@ -225,7 +232,7 @@ function [ys,params,info] = evaluate_steady_state(ys_init,M,options,oo,steadysta
fprintf('STEADY: Derivative of Equation %d with respect to Variable %s (initial value of %s: %g) \n',infrow(ii),deblank(M.endo_names(orig_var_index,:)),deblank(M.endo_names(orig_var_index,:)),ys_init(infcol(ii)))
end
end
disp('STEADY: Check whether your model in truly linear\n')
fprintf('Check whether your model is truly linear. Put "resid(1);" before "steady;" to see the problematic equations.\n')
end
end
end

View File

@ -75,9 +75,15 @@ if ~noprint
case 19
error('The steadystate file did not compute the steady state')
case 20
error(['Impossible to find the steady state. Either the model' ...
' doesn''t have a steady state, there are an infinity of steady states, ' ...
' or the guess values are too far from the solution'])
if DynareOptions.linear
error(['Impossible to find the steady state. Either the model' ...
' doesn''t have a steady state or there are an infinity of steady states.' ...
' Check whether your model is truly linear or whether there is a mistake in linearization.'])
else
error(['Impossible to find the steady state. Either the model' ...
' doesn''t have a steady state, there are an infinity of steady states,' ...
' or the guess values are too far from the solution'])
end
case 21
error('The steady state is complex')
case 22