Replace globals by inputs in make_ex_.m and make_y_.m
parent
127637ffd6
commit
bb08853784
|
@ -5,6 +5,9 @@ function [forecast,info] = dyn_forecast(var_list,M,options,oo,task)
|
||||||
%
|
%
|
||||||
% INPUTS
|
% INPUTS
|
||||||
% var_list: list of variables (character matrix)
|
% 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
|
% task: indicates how to initialize the forecast
|
||||||
% either 'simul' or 'smoother'
|
% either 'simul' or 'smoother'
|
||||||
% OUTPUTS
|
% OUTPUTS
|
||||||
|
@ -16,7 +19,7 @@ function [forecast,info] = dyn_forecast(var_list,M,options,oo,task)
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% none
|
% none
|
||||||
|
|
||||||
% Copyright (C) 2003-2015 Dynare Team
|
% Copyright (C) 2003-2016 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -35,7 +38,7 @@ function [forecast,info] = dyn_forecast(var_list,M,options,oo,task)
|
||||||
|
|
||||||
info = 0;
|
info = 0;
|
||||||
|
|
||||||
make_ex_;
|
oo=make_ex_(M,options,oo);
|
||||||
|
|
||||||
maximum_lag = M.maximum_lag;
|
maximum_lag = M.maximum_lag;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ function [yf,int_width]=forcst(dr,y0,horizon,var_list)
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% none
|
% none
|
||||||
|
|
||||||
% Copyright (C) 2003-2012 Dynare Team
|
% Copyright (C) 2003-2016 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% 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
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% 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);
|
yf = simult_(y0,dr,zeros(horizon,M_.exo_nbr),1);
|
||||||
nstatic = M_.nstatic;
|
nstatic = M_.nstatic;
|
||||||
nspred = M_.nspred;
|
nspred = M_.nspred;
|
||||||
|
|
|
@ -21,7 +21,7 @@ function osr_res = osr(var_list,params,i_var,W)
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% none.
|
% none.
|
||||||
%
|
%
|
||||||
% Copyright (C) 2001-2012 Dynare Team
|
% Copyright (C) 2001-2016 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -46,7 +46,7 @@ if isempty(options_.qz_criterium)
|
||||||
options_.qz_criterium = 1+1e-6;
|
options_.qz_criterium = 1+1e-6;
|
||||||
end
|
end
|
||||||
|
|
||||||
make_ex_;
|
oo_=make_ex_(M_,options_,oo_);
|
||||||
|
|
||||||
np = size(params,1);
|
np = size(params,1);
|
||||||
i_params = zeros(np,1);
|
i_params = zeros(np,1);
|
||||||
|
|
|
@ -12,7 +12,7 @@ function data_set = det_cond_forecast(varargin)
|
||||||
% dataset [dseries] Returns a dseries containing the forecasted endgenous variables and shocks
|
% 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.
|
% 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;
|
indx_endo(col_count : col_count + constrained_periods - 1) = constrained_vars(j) + (time_index_constraint - 1) * ny;
|
||||||
col_count = col_count + constrained_periods;
|
col_count = col_count + constrained_periods;
|
||||||
end;
|
end;
|
||||||
make_ex_;
|
oo_=make_ex_(M_,options_,oo_);
|
||||||
make_y_;
|
oo_=make_y_(M_,options_,oo_);
|
||||||
it = 1;
|
it = 1;
|
||||||
convg = 0;
|
convg = 0;
|
||||||
normra = 1e+50;
|
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(['t=' int2str(t) ' conditional (surprise=' int2str(surprise) ' perfect foresight=' int2str(pf) ') unconditional (surprise=' int2str(b_surprise) ' perfect foresight=' int2str(b_pf) ')']);
|
||||||
disp('===============================================================================================');
|
disp('===============================================================================================');
|
||||||
if t == 1
|
if t == 1
|
||||||
make_ex_;
|
oo_=make_ex_(M_,options_,oo_);
|
||||||
if maximum_lag > 0
|
if maximum_lag > 0
|
||||||
exo_init = oo_.exo_simul;
|
exo_init = oo_.exo_simul;
|
||||||
else
|
else
|
||||||
exo_init = zeros(size(oo_.exo_simul));
|
exo_init = zeros(size(oo_.exo_simul));
|
||||||
end
|
end
|
||||||
make_y_;
|
oo_=make_y_(M_,options_,oo_);
|
||||||
end;
|
end;
|
||||||
%exo_init
|
%exo_init
|
||||||
oo_.exo_simul = exo_init;
|
oo_.exo_simul = exo_init;
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
function make_ex_()
|
function oo_=make_ex_(M_,options_,oo_)
|
||||||
% forms oo_.exo_simul and oo_.exo_det_simul
|
% forms oo_.exo_simul and oo_.exo_det_simul
|
||||||
%
|
%
|
||||||
% INPUTS
|
% INPUTS
|
||||||
% none
|
% M_: Dynare model structure
|
||||||
|
% options_: Dynare options structure
|
||||||
|
% oo_: Dynare results structure
|
||||||
%
|
%
|
||||||
% OUTPUTS
|
% OUTPUTS
|
||||||
% none
|
% oo_: Dynare results structure
|
||||||
%
|
%
|
||||||
% ALGORITHM
|
% ALGORITHM
|
||||||
%
|
%
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
%
|
%
|
||||||
|
|
||||||
% Copyright (C) 1996-2014 Dynare Team
|
% Copyright (C) 1996-2016 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% 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
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
global M_ options_ oo_ ex0_
|
global ex0_
|
||||||
|
|
||||||
if isempty(oo_.exo_steady_state)
|
if isempty(oo_.exo_steady_state)
|
||||||
oo_.exo_steady_state = zeros(M_.exo_nbr,1);
|
oo_.exo_steady_state = zeros(M_.exo_nbr,1);
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
function make_y_()
|
function oo_=make_y_(M_,options_,oo_)
|
||||||
% function make_y_
|
% function oo_=make_y_(M_,options_,oo_)
|
||||||
% forms oo_.endo_simul as guess values for deterministic simulations
|
% forms oo_.endo_simul as guess values for deterministic simulations
|
||||||
%
|
%
|
||||||
% INPUTS
|
% INPUTS
|
||||||
% ...
|
% M_: Dynare model structure
|
||||||
|
% options_: Dynare options structure
|
||||||
|
% oo_: Dynare results structure
|
||||||
|
%
|
||||||
% OUTPUTS
|
% OUTPUTS
|
||||||
% ...
|
% oo_: Dynare results structure
|
||||||
|
%
|
||||||
% ALGORITHM
|
% ALGORITHM
|
||||||
% ...
|
% ...
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% none
|
% none
|
||||||
%
|
%
|
||||||
|
|
||||||
% Copyright (C) 1996-2014 Dynare Team
|
% Copyright (C) 1996-2016 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% 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
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
global M_ options_ oo_ ys0_
|
global ys0_
|
||||||
|
|
||||||
if options_.steadystate_flag
|
if options_.steadystate_flag
|
||||||
[oo_.steady_state,M_.params,check] = ...
|
[oo_.steady_state,M_.params,check] = ...
|
||||||
|
|
|
@ -12,7 +12,7 @@ function perfect_foresight_setup()
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% none
|
% none
|
||||||
|
|
||||||
% Copyright (C) 1996-2014 Dynare Team
|
% Copyright (C) 1996-2016 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -53,8 +53,8 @@ end
|
||||||
|
|
||||||
if ~options_.initval_file
|
if ~options_.initval_file
|
||||||
if isempty(options_.datafile)
|
if isempty(options_.datafile)
|
||||||
make_ex_;
|
oo_=make_ex_(M_,options_,oo_);
|
||||||
make_y_;
|
oo_=make_y_(M_,options_,oo_);
|
||||||
else
|
else
|
||||||
read_data_;
|
read_data_;
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ function innovation_paths = reversed_extended_path(controlled_variable_names, co
|
||||||
%
|
%
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
|
|
||||||
% Copyright (C) 2010-2011 Dynare Team.
|
% Copyright (C) 2010-2016 Dynare Team.
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -56,10 +56,10 @@ options_.order = old_options_order;
|
||||||
options_.periods = 100;
|
options_.periods = 100;
|
||||||
|
|
||||||
% Set-up oo_.exo_simul.
|
% Set-up oo_.exo_simul.
|
||||||
make_ex_;
|
oo_=make_ex_(M_,options_,oo_);
|
||||||
|
|
||||||
% Set-up oo_.endo_simul.
|
% Set-up oo_.endo_simul.
|
||||||
make_y_;
|
oo_=make_y_(M_,options_,oo_);
|
||||||
|
|
||||||
% Get indices of the controlled endogenous variables in endo_simul.
|
% Get indices of the controlled endogenous variables in endo_simul.
|
||||||
n = length(controlled_variable_names);
|
n = length(controlled_variable_names);
|
||||||
|
|
Loading…
Reference in New Issue