2009-10-06 16:37:23 +02:00
|
|
|
function ys1 = add_auxiliary_variables_to_steadystate(ys,aux_vars,fname, ...
|
|
|
|
exo_steady_state, exo_det_steady_state,params)
|
2009-10-14 12:04:06 +02:00
|
|
|
% Add auxiliary variables to the steady state vector
|
|
|
|
|
|
|
|
% Copyright (C) 2009 Dynare Team
|
|
|
|
%
|
|
|
|
% 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
|
|
|
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2009-10-02 14:10:50 +02:00
|
|
|
n = length(aux_vars);
|
|
|
|
ys1 = [ys;zeros(n,1)];
|
|
|
|
k = size(ys,1)+1;
|
2009-10-06 16:37:23 +02:00
|
|
|
aux_lead_nbr = 0;
|
2009-10-02 14:10:50 +02:00
|
|
|
for i=1:n
|
2009-10-06 16:37:23 +02:00
|
|
|
if aux_vars(i).type == 1
|
Fixes for ticket #57
preprocessor:
* add a field "M_.orig_endo_nbr" containing the nbr of endogenous before adding aux vars
* always provide "M_.aux_vars" (define it to "[]" when there is no aux var)
* rename "M_.aux_vars().orig_endo_index" to "M_.aux_vars().orig_index"
M-files:
* for commands which accept a list of variables (stoch_simul, osr, estimation, dynasave, dynatype, datatomfile), when no variable is given, use only the set of original endogenous (without aux vars) as the default
* when displaying the decision rule, when there is aux vars in the state variables, replace them by their original name (with the right lag)
* in "steady", don't display aux vars
* special exception for ramsey policy: all vars (including aux vars) are displayed, because the system of aux vars from ramsey policy is not compatible with the aux vars from the preprocessor
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3166 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-11-25 11:22:39 +01:00
|
|
|
ys1(k) = ys(aux_vars(i).orig_index);
|
2009-10-06 16:37:23 +02:00
|
|
|
elseif aux_vars(i).type == 0
|
|
|
|
aux_lead_nbr = aux_lead_nbr + 1;
|
|
|
|
end
|
2009-10-02 14:10:50 +02:00
|
|
|
k = k+1;
|
|
|
|
end
|
2009-10-06 16:37:23 +02:00
|
|
|
|
2009-10-29 18:16:10 +01:00
|
|
|
for i=1:aux_lead_nbr+1;
|
2009-10-06 16:37:23 +02:00
|
|
|
res = feval([fname '_static'],ys1,...
|
|
|
|
[exo_steady_state; ...
|
|
|
|
exo_det_steady_state],params);
|
|
|
|
for j=1:n
|
|
|
|
if aux_vars(j).type == 0
|
|
|
|
el = aux_vars(j).endo_index;
|
2009-10-29 18:16:10 +01:00
|
|
|
ys1(el) = ys1(el)-res(el);
|
2009-10-06 16:37:23 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|