Skip to content
Snippets Groups Projects
Commit d46a3b18 authored by michel's avatar michel
Browse files

4.0: merged r2275 changeset from trunk (update OSR for unit roots)

git-svn-id: https://www.dynare.org/svn/dynare/branches/4.0@2482 ac1d8469-bf42-47a9-8791-bf33cf982152
parent e6464b99
No related branches found
No related tags found
No related merge requests found
...@@ -40,18 +40,39 @@ function osr1(i_params,i_var,weights) ...@@ -40,18 +40,39 @@ function osr1(i_params,i_var,weights)
exe =zeros(M_.exo_nbr,1); exe =zeros(M_.exo_nbr,1);
oo_.dr = set_state_space(oo_.dr,M_); dr = set_state_space(oo_.dr,M_);
% check if ys is steady state % check if ys is steady state
fh = str2func([M_.fname '_static']); if exist([M_.fname '_steadystate'])
if max(abs(feval(fh, oo_.steady_state, exe, M_.params))) > options_.dynatol [dr.ys,check1] = feval([M_.fname '_steadystate'],oo_.steady_state,...
[oo_.dr.ys, check] = dynare_solve([M_.fname '_static'], oo_.steady_state, 1, exe, M_.params); [oo_.exo_steady_state; oo_.exo_det_steady_state]);
if check
error('OLR: convergence problem in DYNARE_SOLVE')
end
else else
oo_.dr.ys = oo_.steady_state; % testing if ys isn't a steady state or if we aren't computing Ramsey policy
fh = str2func([M_.fname '_static']);
if max(abs(feval(fh,oo_.steady_state,[oo_.exo_steady_state; oo_.exo_det_steady_state], M_.params))) ...
> options_.dynatol & options_.ramsey_policy == 0
if options_.linear == 0
% nonlinear models
[dr.ys,check1] = dynare_solve(fh,dr.ys,options_.jacobian_flag,...
[oo_.exo_steady_state; ...
oo_.exo_det_steady_state], M_.params);
else
% linear models
[fvec,jacob] = feval(fh,oo_.steady_state,[oo_.exo_steady_state;...
oo_.exo_det_steady_state], M_.params);
dr.ys = oo_.steady_state-jacob\fvec;
end
end
end end
oo_.dr = dr;
% $$$ if max(abs(feval(fh, oo_.steady_state, exe, M_.params))) > options_.dynatol
% $$$ [oo_.dr.ys, check] = dynare_solve([M_.fname '_static'], oo_.steady_state, 1, exe, M_.params);
% $$$ if check
% $$$ error('OLR: convergence problem in DYNARE_SOLVE')
% $$$ end
% $$$ else
% $$$ oo_.dr.ys = oo_.steady_state;
% $$$ end
np = size(i_params,1); np = size(i_params,1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment