minor modifications + headers for new functions
parent
403ffdf8b1
commit
10c6978369
|
@ -1,4 +1,88 @@
|
|||
function [dr,info]=AIM_first_order_solver(jacobia,M,dr,qz_criterium,nd)
|
||||
function [dr,info]=AIM_first_order_solver(jacobia,M,dr,qz_criterium)
|
||||
|
||||
%@info:
|
||||
%! @deftypefn {Function File} {[@var{dr},@var{info}] =} AIM_first_order_solver (@var{jacobia},@var{M},@var{dr},@var{qz_criterium})
|
||||
%! @anchor{AIM_first_order_solver}
|
||||
%! @sp 1
|
||||
%! Computes the first order reduced form of the DSGE model using AIM.
|
||||
%! @sp 2
|
||||
%! @strong{Inputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item jacobia
|
||||
%! Matrix containing the Jacobian of the model
|
||||
%! @item M
|
||||
%! Matlab's structure describing the model (initialized by @code{dynare}).
|
||||
%! @item dr
|
||||
%! Matlab's structure describing the reduced form solution of the model.
|
||||
%! @item qz_criterium
|
||||
%! Double containing the criterium to separate explosive from stable eigenvalues
|
||||
%! @end table
|
||||
%! @sp 2
|
||||
%! @strong{Outputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item dr
|
||||
%! Matlab's structure describing the reduced form solution of the model.
|
||||
%! @item info
|
||||
%! Integer scalar, error code.
|
||||
%! @sp 1
|
||||
%! @table @ @code
|
||||
%! @item info==0
|
||||
%! No error.
|
||||
case 102
|
||||
error('Aim: roots not correctly computed by real_schur');
|
||||
case 103
|
||||
error('Aim: too many big roots');
|
||||
case 135
|
||||
error('Aim: too many big roots, and q(:,right) is singular');
|
||||
case 104
|
||||
error('Aim: too few big roots');
|
||||
case 145
|
||||
error('Aim: too few big roots, and q(:,right) is singular');
|
||||
case 105
|
||||
error('Aim: q(:,right) is singular');
|
||||
case 161
|
||||
error('Aim: too many exact shiftrights');
|
||||
case 162
|
||||
error('Aim: too many numeric shiftrights');
|
||||
|
||||
%! @item info==102
|
||||
%! roots not correctly computed by real_schur
|
||||
%! @item info==103
|
||||
%! Blanchard & Kahn conditions are not satisfied: no stable equilibrium.
|
||||
%! @item info==104
|
||||
%! Blanchard & Kahn conditions are not satisfied: indeterminacy.
|
||||
%! @item info==135
|
||||
%! too many explosive roots and q(:,right) is singular
|
||||
%! @item info==145
|
||||
%! too few big roots, and q(:,right) is singular
|
||||
%! @item info==105
|
||||
%! q(:,right) is singular
|
||||
%! @item info==161
|
||||
%! too many exact siftrights
|
||||
%! @item info==162
|
||||
%! too many numeric shiftrights
|
||||
%! @end table
|
||||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2001-2011 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/>.
|
||||
|
||||
info = 0;
|
||||
|
||||
|
|
|
@ -1,5 +1,85 @@
|
|||
function [dr,info] = dyn_risky_steadystate_solver(ys0,M, ...
|
||||
dr,options,oo)
|
||||
|
||||
%@info:
|
||||
%! @deftypefn {Function File} {[@var{dr},@var{info}] =} dyn_risky_steadystate_solver (@var{ys0},@var{M},@var{dr},@var{options},@var{oo})
|
||||
%! @anchor{dyn_risky_steadystate_solver}
|
||||
%! @sp 1
|
||||
%! Computes the second order risky steady state and first and second order reduced form of the DSGE model.
|
||||
%! @sp 2
|
||||
%! @strong{Inputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item ys0
|
||||
%! Vector containing a guess value for the risky steady state
|
||||
%! @item M
|
||||
%! Matlab's structure describing the model (initialized by @code{dynare}).
|
||||
%! @item dr
|
||||
%! Matlab's structure describing the reduced form solution of the model.
|
||||
%! @item options
|
||||
%! Matlab's structure describing the options (initialized by @code{dynare}).
|
||||
%! @item oo
|
||||
%! Matlab's structure gathering the results (initialized by @code{dynare}).
|
||||
%! @end table
|
||||
%! @sp 2
|
||||
%! @strong{Outputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item dr
|
||||
%! Matlab's structure describing the reduced form solution of the model.
|
||||
%! @item info
|
||||
%! Integer scalar, error code.
|
||||
%! @sp 1
|
||||
%! @table @ @code
|
||||
%! @item info==0
|
||||
%! No error.
|
||||
%! @item info==1
|
||||
%! The model doesn't determine the current variables uniquely.
|
||||
%! @item info==2
|
||||
%! MJDGGES returned an error code.
|
||||
%! @item info==3
|
||||
%! Blanchard & Kahn conditions are not satisfied: no stable equilibrium.
|
||||
%! @item info==4
|
||||
%! Blanchard & Kahn conditions are not satisfied: indeterminacy.
|
||||
%! @item info==5
|
||||
%! Blanchard & Kahn conditions are not satisfied: indeterminacy due to rank failure.
|
||||
%! @item info==6
|
||||
%! The jacobian evaluated at the deterministic steady state is complex.
|
||||
%! @item info==19
|
||||
%! The steadystate routine thrown an exception (inconsistent deep parameters).
|
||||
%! @item info==20
|
||||
%! Cannot find the steady state, info(2) contains the sum of square residuals (of the static equations).
|
||||
%! @item info==21
|
||||
%! The steady state is complex, info(2) contains the sum of square of imaginary parts of the steady state.
|
||||
%! @item info==22
|
||||
%! The steady has NaNs.
|
||||
%! @item info==23
|
||||
%! M_.params has been updated in the steadystate routine and has complex valued scalars.
|
||||
%! @item info==24
|
||||
%! M_.params has been updated in the steadystate routine and has some NaNs.
|
||||
%! @item info==30
|
||||
%! Ergodic variance can't be computed.
|
||||
%! @end table
|
||||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2001-2011 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/>.
|
||||
|
||||
|
||||
info = 0;
|
||||
lead_lag_incidence = M.lead_lag_incidence;
|
||||
|
|
|
@ -114,11 +114,7 @@ end
|
|||
if options.block
|
||||
[dr,info,M,options,oo] = dr_block(dr,check_flag,M,options,oo);
|
||||
else
|
||||
dr.fbias = zeros(M.endo_nbr,1);
|
||||
[dr,info,M,options,oo] = stochastic_solvers(dr,check_flag,M,options,oo);
|
||||
[dr,info,oo] = stochastic_solvers(dr,check_flag,M,options,oo);
|
||||
end
|
||||
|
||||
if info(1)
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -73,8 +73,7 @@ elseif options_.discretionary_policy
|
|||
end
|
||||
[oo_.dr,ys,info] = discretionary_policy_1(oo_,options_.instruments);
|
||||
else
|
||||
[dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
|
||||
oo_.dr = dr;
|
||||
[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
|
||||
end
|
||||
|
||||
if info(1)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function [dr,info,M_,options_,oo_] = stochastic_solvers(dr,task,M_,options_,oo_)
|
||||
function [dr,info,oo_] = stochastic_solvers(dr,task,M_,options_,oo_)
|
||||
% function [dr,info,M_,options_,oo_] = stochastic_solvers(dr,task,M_,options_,oo_)
|
||||
% computes the reduced form solution of a rational expectation model (first or second order
|
||||
% approximation of the stochastic model around the deterministic steady state).
|
||||
|
@ -21,9 +21,7 @@ function [dr,info,M_,options_,oo_] = stochastic_solvers(dr,task,M_,options_,oo_)
|
|||
% indeterminacy.
|
||||
% info=5: BK rank condition not satisfied.
|
||||
% info=6: The jacobian matrix evaluated at the steady state is complex.
|
||||
% M_ [matlab structure]
|
||||
% options_ [matlab structure]
|
||||
% oo_ [matlab structure]
|
||||
% oo_ [matlab structure] Results
|
||||
%
|
||||
% ALGORITHM
|
||||
% ...
|
||||
|
@ -140,7 +138,6 @@ b(:,cols_b) = jacobia_(:,cols_j);
|
|||
|
||||
if M_.maximum_endo_lead == 0
|
||||
% backward models: simplified code exist only at order == 1
|
||||
% If required, use AIM solver if not check only
|
||||
if options_.order == 1
|
||||
[k1,junk,k2] = find(kstate(:,4));
|
||||
dr.ghx(:,k1) = -b\jacobia_(:,k2);
|
||||
|
@ -161,9 +158,9 @@ if M_.maximum_endo_lead == 0
|
|||
'backward models'])
|
||||
end
|
||||
elseif M_.maximum_endo_lag == 0
|
||||
% purely forward model
|
||||
dr.ghx = [];
|
||||
dr.ghu = -b\jacobia_(:,nz+1:end);
|
||||
% purely forward model
|
||||
dr.ghx = [];
|
||||
dr.ghu = -b\jacobia_(:,nz+1:end);
|
||||
elseif options_.risky_steadystate
|
||||
[dr,info] = dyn_risky_steadystate_solver(oo_.steady_state,M_,dr, ...
|
||||
options_,oo_);
|
||||
|
|
Loading…
Reference in New Issue