2020-09-17 14:53:32 +02:00
|
|
|
function oo_ = make_ex_(M_, options_, oo_)
|
|
|
|
|
|
|
|
% Forms oo_.exo_simul and oo_.exo_det_simul
|
2009-10-23 12:03:03 +02:00
|
|
|
%
|
2006-10-29 18:27:48 +01:00
|
|
|
% INPUTS
|
2020-12-07 18:39:11 +01:00
|
|
|
% - M_ [struct] Dynare model structure
|
|
|
|
% - options_ [struct] Dynare options structure
|
|
|
|
% - oo_ [struct] Dynare results structure
|
2017-05-16 15:10:20 +02:00
|
|
|
%
|
2006-10-29 18:27:48 +01:00
|
|
|
% OUTPUTS
|
2020-12-07 18:39:11 +01:00
|
|
|
% - oo_ [struct] Updated dynare results structure
|
2008-08-01 14:40:33 +02:00
|
|
|
|
2022-04-13 13:15:19 +02:00
|
|
|
% Copyright © 1996-2021 Dynare Team
|
2008-08-01 14:40:33 +02:00
|
|
|
%
|
|
|
|
% 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
|
2021-06-09 17:33:48 +02:00
|
|
|
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
2009-12-16 18:17:34 +01:00
|
|
|
|
2016-03-11 16:01:21 +01:00
|
|
|
global ex0_
|
2009-12-16 18:17:34 +01:00
|
|
|
|
|
|
|
if isempty(oo_.exo_steady_state)
|
2005-02-18 20:54:39 +01:00
|
|
|
oo_.exo_steady_state = zeros(M_.exo_nbr,1);
|
2009-12-16 18:17:34 +01:00
|
|
|
end
|
2011-02-10 15:54:23 +01:00
|
|
|
if M_.exo_det_nbr > 1 && isempty(oo_.exo_det_steady_state)
|
2006-06-02 09:42:00 +02:00
|
|
|
oo_.exo_det_steady_state = zeros(M_.exo_det_nbr,1);
|
2009-12-16 18:17:34 +01:00
|
|
|
end
|
2014-04-08 17:43:58 +02:00
|
|
|
|
|
|
|
% Initialize oo_.exo_simul
|
2019-12-27 18:58:32 +01:00
|
|
|
if isempty(oo_.initval_series)
|
|
|
|
if isempty(M_.exo_histval)
|
|
|
|
if isempty(ex0_)
|
|
|
|
oo_.exo_simul = repmat(oo_.exo_steady_state',M_.maximum_lag+options_.periods+M_.maximum_lead,1);
|
|
|
|
else
|
|
|
|
oo_.exo_simul = [ repmat(ex0_',M_.maximum_lag,1) ; repmat(oo_.exo_steady_state',options_.periods+M_.maximum_lead,1) ];
|
|
|
|
end
|
2015-07-29 15:41:17 +02:00
|
|
|
else
|
2019-12-27 18:58:32 +01:00
|
|
|
if isempty(ex0_)
|
|
|
|
oo_.exo_simul = [M_.exo_histval'; repmat(oo_.exo_steady_state',options_.periods+M_.maximum_lead,1)];
|
|
|
|
else
|
|
|
|
error('histval and endval cannot be used simultaneously')
|
|
|
|
end
|
2015-07-29 15:41:17 +02:00
|
|
|
end
|
2019-12-27 18:58:32 +01:00
|
|
|
elseif M_.exo_nbr > 0
|
|
|
|
x = oo_.initval_series{M_.exo_names{:}}.data;
|
2020-11-05 16:08:29 +01:00
|
|
|
oo_.exo_simul = x(M_.orig_maximum_lag-M_.maximum_lag+1:M_.orig_maximum_lag + options_.periods + M_.maximum_lead,:);
|
2019-12-27 18:58:32 +01:00
|
|
|
if ~isempty(M_.exo_histval)
|
|
|
|
oo_.exo_simul(1:M_.maximum_lag, :) ...
|
|
|
|
= M_.exo_histval(:, 1:M_.maximum_lag)';
|
|
|
|
end
|
|
|
|
elseif M_.exo_det_nbr > 0
|
|
|
|
x_det = oo_.initval_series{M_.exo_det_names{:}}.data;
|
2020-11-05 16:08:29 +01:00
|
|
|
oo_.exo_det_simul = x_det(M_.orig_maximum_lag-M_.maximum_lag+1:M_.orig_maximum_lag + options_.periods + M_.maximum_lead,:);
|
2019-12-27 18:58:32 +01:00
|
|
|
if ~isempty(M_.exo_det_histval)
|
|
|
|
oo_.exo_det_simul(1:M_.maximum_lag, :) ...
|
|
|
|
= M_.exo_det_histval(:, 1:M_.maximum_lag)';
|
2015-07-29 15:41:17 +02:00
|
|
|
end
|
2017-05-16 15:10:20 +02:00
|
|
|
end
|
2006-10-29 18:27:48 +01:00
|
|
|
|
2014-04-08 17:43:58 +02:00
|
|
|
% Initialize oo_.exo_det_simul
|
2009-12-16 18:17:34 +01:00
|
|
|
if M_.exo_det_nbr > 0
|
2015-07-29 15:41:17 +02:00
|
|
|
if isempty(M_.exo_det_histval)
|
|
|
|
oo_.exo_det_simul = repmat(oo_.exo_det_steady_state',M_.maximum_lag+options_.periods+M_.maximum_lead,1);
|
|
|
|
else
|
|
|
|
oo_.exo_det_simul = [M_.exo_det_histval'; repmat(oo_.exo_det_steady_state',options_.periods+M_.maximum_lead,1)];
|
|
|
|
end
|
2014-04-08 17:43:58 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
% Add temporary shocks
|
|
|
|
if isfield(M_, 'det_shocks')
|
2021-12-06 11:15:20 +01:00
|
|
|
if ~isempty(M_.det_shocks) && any([M_.det_shocks.periods]==0) && ~M_.maximum_lag
|
|
|
|
error('make_ex_: The model does not have lags, so you cannot set values for period 0'); %leads are taken care of by preprocessor
|
|
|
|
end
|
2014-04-08 17:43:58 +02:00
|
|
|
for i = 1:length(M_.det_shocks)
|
|
|
|
k = M_.det_shocks(i).periods + M_.maximum_lag;
|
|
|
|
ivar = M_.det_shocks(i).exo_id;
|
|
|
|
v = M_.det_shocks(i).value;
|
|
|
|
if ~M_.det_shocks(i).exo_det
|
|
|
|
if ~M_.det_shocks(i).multiplicative
|
|
|
|
oo_.exo_simul(k,ivar) = v;
|
|
|
|
else
|
2020-11-24 15:04:41 +01:00
|
|
|
oo_.exo_simul(k,ivar) = oo_.exo_simul(k,ivar) .* v;
|
2014-04-08 17:43:58 +02:00
|
|
|
end
|
|
|
|
else
|
|
|
|
if ~M_.det_shocks(i).multiplicative
|
|
|
|
oo_.exo_det_simul(k,ivar) = v;
|
|
|
|
else
|
2020-12-07 18:38:30 +01:00
|
|
|
oo_.exo_det_simul(k,ivar) = oo_.exo_det_simul(k,ivar) .* v;
|
2014-04-08 17:43:58 +02:00
|
|
|
end
|
|
|
|
end
|
2005-09-11 11:39:21 +02:00
|
|
|
end
|
2014-04-08 17:43:58 +02:00
|
|
|
end
|