2021-07-11 16:51:14 +02:00
|
|
|
|
function dummy = set(pacmodel, paceq, variable, nonzeromean)
|
2019-03-11 11:54:53 +01:00
|
|
|
|
|
2021-07-11 16:51:14 +02:00
|
|
|
|
% Provide information about long run levels of exogenous variables in PAC equation.
|
|
|
|
|
%
|
|
|
|
|
% INPUTS
|
|
|
|
|
% - pacmodel [char] 1×n array, name of the PAC model
|
|
|
|
|
% - paceq [char] 1×m array, name of the PAC equation
|
|
|
|
|
% - variable [char] 1×p array, name of the variable (exogenous variable in the PAC equation)
|
|
|
|
|
% - nonzeromean [double] scalar, mean of the exogenous variable
|
|
|
|
|
%
|
|
|
|
|
% OUPUTS
|
|
|
|
|
% - dummy [double] empty array.
|
|
|
|
|
|
|
|
|
|
% Copyright © 2019-2021 Dynare Team
|
2019-03-11 11:54:53 +01: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/>.
|
2019-03-11 11:54:53 +01:00
|
|
|
|
|
|
|
|
|
global M_
|
|
|
|
|
|
|
|
|
|
eqtag = M_.pac.(pacmodel).tag_map{strcmp(paceq, M_.pac.(pacmodel).tag_map(:,1)),2};
|
|
|
|
|
|
|
|
|
|
dummy = [];
|
2021-09-15 12:04:56 +02:00
|
|
|
|
|
2021-07-11 16:51:14 +02:00
|
|
|
|
ide = find(strcmp(variable, M_.endo_names));
|
2021-09-15 12:04:56 +02:00
|
|
|
|
xflag = false;
|
|
|
|
|
if isempty(ide)
|
|
|
|
|
% variable is not an endogenous variable
|
|
|
|
|
ide = find(strcmp(variable, M_.exo_names));
|
|
|
|
|
xflag = true;
|
|
|
|
|
end
|
|
|
|
|
|
2021-07-11 16:51:14 +02:00
|
|
|
|
if ~isempty(ide)
|
2021-09-15 13:42:16 +02:00
|
|
|
|
[M_, done] = writebgpfield('additive', pacmodel, eqtag, ide, xflag, nonzeromean, M_);
|
|
|
|
|
if done, return, end
|
|
|
|
|
[M_, done] = writebgpfield('optim_additive', pacmodel, eqtag, ide, xflag, nonzeromean, M_);
|
|
|
|
|
if done, return, end
|
|
|
|
|
[M_, done] = writebgpfield('non_optimizing_behaviour', pacmodel, eqtag, ide, xflag, nonzeromean, M_);
|
|
|
|
|
if done, return, end
|
2021-07-11 16:51:14 +02:00
|
|
|
|
warning('%s is not an exogenous variable in equation %s.', variable, paceq)
|
2019-03-11 11:54:53 +01:00
|
|
|
|
else
|
2021-09-15 12:04:56 +02:00
|
|
|
|
error('Endogenous/Exogenous variable %s is unknown.', variable)
|
2021-09-15 12:53:27 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
2021-09-15 13:42:16 +02:00
|
|
|
|
function [M_, done] = writebgpfield(type, pacmodel, eqtag, ide, xflag, nonzeromean, M_)
|
|
|
|
|
done = false;
|
|
|
|
|
if isfield(M_.pac.(pacmodel).equations.(eqtag), type)
|
|
|
|
|
if ~isfield(M_.pac.(pacmodel).equations.(eqtag).additive, 'bgp')
|
2021-10-14 11:46:09 +02:00
|
|
|
|
M_.pac.(pacmodel).equations.(eqtag).(type).bgp = repmat({false}, 1, length(M_.pac.(pacmodel).equations.(eqtag).(type).params));
|
2021-09-15 13:42:16 +02:00
|
|
|
|
end
|
|
|
|
|
[isvar, ie] = ismember(ide, M_.pac.(pacmodel).equations.(eqtag).(type).vars);
|
|
|
|
|
if isvar
|
|
|
|
|
if xflag
|
|
|
|
|
assert(~M_.pac.(pacmodel).equations.(eqtag).(type).isendo(ie), 'Variable type issue.')
|
|
|
|
|
else
|
|
|
|
|
assert(M_.pac.(pacmodel).equations.(eqtag).(type).isendo(ie), 'Variable type issue.')
|
|
|
|
|
end
|
2021-10-14 11:46:09 +02:00
|
|
|
|
M_.pac.(pacmodel).equations.(eqtag).(type).bgp{ie} = nonzeromean;
|
2021-09-15 13:42:16 +02:00
|
|
|
|
done = true;
|
|
|
|
|
end
|
|
|
|
|
end
|