fixing bug for computation of expectation auxiliary variables

steadystate value when *_steadystate.m is provided without setting
auxiliary variables
time-shift
Michel Juillard 2011-09-29 21:22:27 +02:00
parent 1825d26649
commit f51a8edf50
1 changed files with 14 additions and 30 deletions

View File

@ -20,35 +20,19 @@ function ys1 = add_auxiliary_variables_to_steadystate(ys,aux_vars,fname, ...
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
n = length(aux_vars);
ys1 = [ys;zeros(n,1)];
k = size(ys,1)+1;
aux_lead_nbr = 0;
for i=1:n
if aux_vars(i).type == 1
% lagged variables
ys1(k) = ys(aux_vars(i).orig_index);
elseif aux_vars(i).type == 0
% lead variables
aux_lead_nbr = aux_lead_nbr + 1;
end
k = k+1;
end
if aux_lead_nbr
for i=1:aux_lead_nbr+1;
if byte_code
[info, res] = bytecode('static','evaluate',ys1,...
[exo_steady_state; ...
exo_det_steady_state],params);
else
res = feval([fname '_static'],ys1,...
[exo_steady_state; ...
exo_det_steady_state],params);
end;
for j=1:n
if aux_vars(j).type == 0
el = aux_vars(j).endo_index;
ys1(el) = ys1(el)-res(el);
end
end
for i=1:n+1;
if byte_code
[info, res] = bytecode('static','evaluate',ys1,...
[exo_steady_state; ...
exo_det_steady_state],params);
else
res = feval([fname '_static'],ys1,...
[exo_steady_state; ...
exo_det_steady_state],params);
end;
for j=1:n
el = aux_vars(j).endo_index;
ys1(el) = ys1(el)-res(el);
end
end
end