Replace globals by inputs in make_ex_.m and make_y_.m

time-shift
Johannes Pfeifer 2016-03-11 16:01:21 +01:00
parent 127637ffd6
commit bb08853784
8 changed files with 38 additions and 29 deletions

View File

@ -5,6 +5,9 @@ function [forecast,info] = dyn_forecast(var_list,M,options,oo,task)
%
% INPUTS
% var_list: list of variables (character matrix)
% M: Dynare model structure
% options: Dynare options structure
% oo: Dynare results structure
% task: indicates how to initialize the forecast
% either 'simul' or 'smoother'
% OUTPUTS
@ -16,7 +19,7 @@ function [forecast,info] = dyn_forecast(var_list,M,options,oo,task)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2003-2015 Dynare Team
% Copyright (C) 2003-2016 Dynare Team
%
% This file is part of Dynare.
%
@ -35,7 +38,7 @@ function [forecast,info] = dyn_forecast(var_list,M,options,oo,task)
info = 0;
make_ex_;
oo=make_ex_(M,options,oo);
maximum_lag = M.maximum_lag;

View File

@ -17,7 +17,7 @@ function [yf,int_width]=forcst(dr,y0,horizon,var_list)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2003-2012 Dynare Team
% Copyright (C) 2003-2016 Dynare Team
%
% This file is part of Dynare.
%
@ -34,9 +34,9 @@ function [yf,int_width]=forcst(dr,y0,horizon,var_list)
% 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_ oo_ options_
global M_ oo_ options_
make_ex_;
oo_=make_ex_(M_,options_,oo_);
yf = simult_(y0,dr,zeros(horizon,M_.exo_nbr),1);
nstatic = M_.nstatic;
nspred = M_.nspred;

View File

@ -21,7 +21,7 @@ function osr_res = osr(var_list,params,i_var,W)
% SPECIAL REQUIREMENTS
% none.
%
% Copyright (C) 2001-2012 Dynare Team
% Copyright (C) 2001-2016 Dynare Team
%
% This file is part of Dynare.
%
@ -46,7 +46,7 @@ if isempty(options_.qz_criterium)
options_.qz_criterium = 1+1e-6;
end
make_ex_;
oo_=make_ex_(M_,options_,oo_);
np = size(params,1);
i_params = zeros(np,1);

View File

@ -12,7 +12,7 @@ function data_set = det_cond_forecast(varargin)
% dataset [dseries] Returns a dseries containing the forecasted endgenous variables and shocks
%
%
% Copyright (C) 2013-2014 Dynare Team
% Copyright (C) 2013-2016 Dynare Team
%
% This file is part of Dynare.
%
@ -412,8 +412,8 @@ if pf && ~surprise
indx_endo(col_count : col_count + constrained_periods - 1) = constrained_vars(j) + (time_index_constraint - 1) * ny;
col_count = col_count + constrained_periods;
end;
make_ex_;
make_y_;
oo_=make_ex_(M_,options_,oo_);
oo_=make_y_(M_,options_,oo_);
it = 1;
convg = 0;
normra = 1e+50;
@ -613,13 +613,13 @@ else
disp(['t=' int2str(t) ' conditional (surprise=' int2str(surprise) ' perfect foresight=' int2str(pf) ') unconditional (surprise=' int2str(b_surprise) ' perfect foresight=' int2str(b_pf) ')']);
disp('===============================================================================================');
if t == 1
make_ex_;
oo_=make_ex_(M_,options_,oo_);
if maximum_lag > 0
exo_init = oo_.exo_simul;
else
exo_init = zeros(size(oo_.exo_simul));
end
make_y_;
oo_=make_y_(M_,options_,oo_);
end;
%exo_init
oo_.exo_simul = exo_init;

View File

@ -1,18 +1,20 @@
function make_ex_()
function oo_=make_ex_(M_,options_,oo_)
% forms oo_.exo_simul and oo_.exo_det_simul
%
% INPUTS
% none
% M_: Dynare model structure
% options_: Dynare options structure
% oo_: Dynare results structure
%
% OUTPUTS
% none
% oo_: Dynare results structure
%
% ALGORITHM
%
% SPECIAL REQUIREMENTS
%
% Copyright (C) 1996-2014 Dynare Team
% Copyright (C) 1996-2016 Dynare Team
%
% This file is part of Dynare.
%
@ -29,7 +31,7 @@ function make_ex_()
% 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_ ex0_
global ex0_
if isempty(oo_.exo_steady_state)
oo_.exo_steady_state = zeros(M_.exo_nbr,1);

View File

@ -1,18 +1,22 @@
function make_y_()
% function make_y_
function oo_=make_y_(M_,options_,oo_)
% function oo_=make_y_(M_,options_,oo_)
% forms oo_.endo_simul as guess values for deterministic simulations
%
% INPUTS
% ...
% M_: Dynare model structure
% options_: Dynare options structure
% oo_: Dynare results structure
%
% OUTPUTS
% ...
% oo_: Dynare results structure
%
% ALGORITHM
% ...
% SPECIAL REQUIREMENTS
% none
%
% Copyright (C) 1996-2014 Dynare Team
% Copyright (C) 1996-2016 Dynare Team
%
% This file is part of Dynare.
%
@ -29,7 +33,7 @@ function make_y_()
% 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_ ys0_
global ys0_
if options_.steadystate_flag
[oo_.steady_state,M_.params,check] = ...

View File

@ -12,7 +12,7 @@ function perfect_foresight_setup()
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 1996-2014 Dynare Team
% Copyright (C) 1996-2016 Dynare Team
%
% This file is part of Dynare.
%
@ -53,8 +53,8 @@ end
if ~options_.initval_file
if isempty(options_.datafile)
make_ex_;
make_y_;
oo_=make_ex_(M_,options_,oo_);
oo_=make_y_(M_,options_,oo_);
else
read_data_;
end

View File

@ -14,7 +14,7 @@ function innovation_paths = reversed_extended_path(controlled_variable_names, co
%
% SPECIAL REQUIREMENTS
% Copyright (C) 2010-2011 Dynare Team.
% Copyright (C) 2010-2016 Dynare Team.
%
% This file is part of Dynare.
%
@ -56,10 +56,10 @@ options_.order = old_options_order;
options_.periods = 100;
% Set-up oo_.exo_simul.
make_ex_;
oo_=make_ex_(M_,options_,oo_);
% Set-up oo_.endo_simul.
make_y_;
oo_=make_y_(M_,options_,oo_);
% Get indices of the controlled endogenous variables in endo_simul.
n = length(controlled_variable_names);