Commit 5f8de6f1 authored by stepan's avatar stepan
Browse files

+ Added error messages related to the output of the steadystate file.
+ Removed options_ from print_info.m
+ Removed some useless initializations of options_'s fields.


git-svn-id: https://www.dynare.org/svn/dynare/trunk@2786 ac1d8469-bf42-47a9-8791-bf33cf982152
parent 0612cd8e
function result = check
% function result = check
% checks determinacy conditions by computing the eigenvalues
%
% INPUTS
% none
%
% OUTPUTS
% result
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2001-2008 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global M_ options_ oo_
global it_
temp_options = options_;
tempex = oo_.exo_simul;
if ~options_.initval_file & M_.exo_nbr > 1
oo_.exo_simul = ones(M_.maximum_lead+M_.maximum_lag+1,1)*oo_.exo_steady_state';
end
options_ = set_default_option(options_,'noprint',0);
options_ = set_default_option(options_,'linear',0);
options_ = set_default_option(options_,'steadystate_flag',0);
options_.order = 1;
if exist([M_.fname '_steadystate.m'])
options_.steadystate_flag = 1;
end
[dr, info] = resol(oo_.steady_state,1);
oo_.dr = dr;
if info(1) ~= 0 & info(1) ~= 3 & info(1) ~= 4
print_info(info);
end
oo_.exo_simul = tempex;
eigenvalues_ = dr.eigval;
if(options_.model_mode == 1)
nyf = dr.nyf;
else
nyf = nnz(dr.kstate(:,2)>M_.maximum_endo_lag+1);
end;
[m_lambda,i]=sort(abs(eigenvalues_));
n_explod = nnz(abs(eigenvalues_) > options_.qz_criterium);
if options_.noprint == 0
disp(' ')
disp('EIGENVALUES:')
disp(sprintf('%16s %16s %16s\n','Modulus','Real','Imaginary'))
z=[m_lambda real(eigenvalues_(i)) imag(eigenvalues_(i))]';
disp(sprintf('%16.4g %16.4g %16.4g\n',z))
options_ = set_default_option(options_,'qz_criterium',1.000001);
disp(sprintf('\nThere are %d eigenvalue(s) larger than 1 in modulus ', ...
n_explod));
disp(sprintf('for %d forward-looking variable(s)',nyf));
disp(' ')
if dr.rank == nyf & nyf == n_explod
disp('The rank condition is verified.')
else
disp('The rank conditions ISN''T verified!')
end
disp(' ')
end
% keep lambda_ for backward compatibility
lambda_ = eigenvalues_;
options_ = temp_options;
% 2/9/99 MJ: line 15, added test for absence of exogenous variable.
% 8/27/2000 MJ: change JACOB call. Added ...,1 to cumsum()
% 6/24/01 MJ: added count of abs(eigenvalues) > 1
% 2/21/02 MJ: count eigenvalues > 1[+1e-5]
% 01/22/03 MJ: warning(warning_state) needs parentheses for Matlab 6.5
% name conflicts with parameters
% 05/21/03 MJ: replace computation by dr1.m and add rank check
% 06/05/03 MJ: corrected bug when M_.maximum_lag > 0
function result = check
% function result = check
% checks determinacy conditions by computing the eigenvalues
%
% INPUTS
% none
%
% OUTPUTS
% result
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2001-2008 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global M_ options_ oo_
temp_options = options_;
tempex = oo_.exo_simul;
if ~options_.initval_file & M_.exo_nbr > 1
oo_.exo_simul = ones(M_.maximum_lead+M_.maximum_lag+1,1)*oo_.exo_steady_state';
end
options_.order = 1;
[dr, info] = resol(oo_.steady_state,1);
oo_.dr = dr;
if info(1) ~= 0 & info(1) ~= 3 & info(1) ~= 4
print_info(info, options_.noprint);
end
oo_.exo_simul = tempex;
eigenvalues_ = dr.eigval;
if(options_.model_mode == 1)
nyf = dr.nyf;
else
nyf = nnz(dr.kstate(:,2)>M_.maximum_endo_lag+1);
end;
[m_lambda,i]=sort(abs(eigenvalues_));
n_explod = nnz(abs(eigenvalues_) > options_.qz_criterium);
if options_.noprint == 0
disp(' ')
disp('EIGENVALUES:')
disp(sprintf('%16s %16s %16s\n','Modulus','Real','Imaginary'))
z=[m_lambda real(eigenvalues_(i)) imag(eigenvalues_(i))]';
disp(sprintf('%16.4g %16.4g %16.4g\n',z))
options_ = set_default_option(options_,'qz_criterium',1.000001);
disp(sprintf('\nThere are %d eigenvalue(s) larger than 1 in modulus ', ...
n_explod));
disp(sprintf('for %d forward-looking variable(s)',nyf));
disp(' ')
if dr.rank == nyf & nyf == n_explod
disp('The rank condition is verified.')
else
disp('The rank conditions ISN''T verified!')
end
disp(' ')
end
options_ = temp_options;
% 2/9/99 MJ: line 15, added test for absence of exogenous variable.
% 8/27/2000 MJ: change JACOB call. Added ...,1 to cumsum()
% 6/24/01 MJ: added count of abs(eigenvalues) > 1
% 2/21/02 MJ: count eigenvalues > 1[+1e-5]
% 01/22/03 MJ: warning(warning_state) needs parentheses for Matlab 6.5
% name conflicts with parameters
% 05/21/03 MJ: replace computation by dr1.m and add rank check
% 06/05/03 MJ: corrected bug when M_.maximum_lag > 0
......@@ -52,7 +52,7 @@ function global_initialization()
options_.deterministic_simulation_initialization = 0;
% steady state file
if exist([M_.fname '_steadystate'])
if exist([M_.fname '_steadystate.m'],'file')
options_.steadystate_flag = 1;
else
options_.steadystate_flag = 0;
......
......@@ -87,7 +87,7 @@ function initial_estimation_checks(xparam1,gend,data,data_index,number_of_observ
if info(1) > 0
disp('Error in computing likelihood for initial parameter values')
print_info(info)
print_info(info, options_.noprint)
end
if any(abs(oo_.steady_state(bayestopt_.mfys))>1e-9) & (options_.prefilter==1)
......
function print_info(info)
% function print_info(info)
function print_info(info,noprint)
% Prints error messages
%
% INPUTS
% info=1: the model doesn't determine the current variables '...' uniquely
% info=2: MJDGGES returns the following error code'
% info=3: Blanchard Kahn conditions are not satisfied: no stable '...' equilibrium
% info=4: Blanchard Kahn conditions are not satisfied:'...' indeterminacy
% info=5: Blanchard Kahn conditions are not satisfied:'...' indeterminacy due to rank failure
% info=20: Impossible to find the steady state. Either the model' ...' doesn't have
% a unique steady state of the guess values' ...' are too far from the solution
% info=30: Variance can't be computed
%
% info [double] vector returned by resol.m
% noprint [integer] equal to 0 if the error message has to be printed.
% OUTPUTS
% none
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2005-2007 Dynare Team
% Copyright (C) 2005-2009 Dynare Team
%
% This file is part of Dynare.
%
......@@ -36,35 +27,34 @@ function print_info(info)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global options_
options_ = set_default_option(options_,'noprint',0);
if ~options_.noprint
if ~noprint
switch info(1)
case 1
error(['The model doesn''t determine the current variables' ...
' uniquely'])
case 2
error(['MJDGGES returns the following error code' ...
int2str(info(2))])
case 3
error(['Blanchard Kahn conditions are not satisfied: no stable' ...
' equilibrium'])
case 4
error(['Blanchard Kahn conditions are not satisfied:' ...
' indeterminacy'])
case 5
error(['Blanchard Kahn conditions are not satisfied:' ...
' indeterminacy due to rank failure'])
case 20
error(['Impossible to find the steady state. Either the model' ...
' doesn''t have a unique steady state of the guess values' ...
' are too far from the solution'])
case 30
error('Variance can''t be computed')
otherwise
error('This case shouldn''t happen. Contact the authors of Dynare')
case 1
error(['The model doesn''t determine the current variables' ...
' uniquely'])
case 2
error(['MJDGGES returns the following error code' ...
int2str(info(2))])
case 3
error(['Blanchard Kahn conditions are not satisfied: no stable' ...
' equilibrium'])
case 4
error(['Blanchard Kahn conditions are not satisfied:' ...
' indeterminacy'])
case 5
error(['Blanchard Kahn conditions are not satisfied:' ...
' indeterminacy due to rank failure'])
case 19
error('The steadystate file did not compute the steady state (inconsistent deep parameters).')
case 20
error(['Impossible to find the steady state. Either the model' ...
' doesn''t have a unique steady state of the guess values' ...
' are too far from the solution'])
case 21
error('The steady state is complex.')
case 30
error('Variance can''t be computed')
otherwise
error('This case shouldn''t happen. Contact the authors of Dynare')
end
end
\ No newline at end of file
end
\ No newline at end of file
......@@ -41,7 +41,7 @@ function info=stoch_simul(var_list)
if info(1)
options_ = options_old;
print_info(info);
print_info(info, options_.noprint);
return
end
......
......@@ -41,7 +41,7 @@ function info=stoch_simul_sparse(var_list)
if info(1)
options_ = options_old;
print_info(info);
print_info(info, options_.noprint);
return
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment