Added (exogenous) homotopic steps in reversed extended path.
parent
0889df6161
commit
7d94b012dd
|
@ -42,14 +42,19 @@ if isempty(k1)
|
|||
k1 = [maximum_lag:-1:1];
|
||||
k2 = dr.kstate(find(dr.kstate(:,2) <= maximum_lag+1),[1 2]);
|
||||
k2 = k2(:,1)+(maximum_lag+1-k2(:,2))*endo_nbr;
|
||||
weight = 0.99;
|
||||
weight = 0.0;
|
||||
end
|
||||
|
||||
verbose = 0;
|
||||
|
||||
% Copy the shocks in exo_simul.
|
||||
oo_.exo_simul(maximum_lag+1,ix) = exp(transpose(x));
|
||||
exo_simul = log(oo_.exo_simul);
|
||||
|
||||
% Compute the initial solution path for the endogenous variables using a first order approximation.
|
||||
if verbose
|
||||
disp('ep_residuals:: Set initial condition for endogenous variable paths.')
|
||||
end
|
||||
initial_path = oo_.endo_simul;
|
||||
for i = maximum_lag+1:size(oo_.exo_simul)
|
||||
tempx1 = oo_.endo_simul(dr.order_var,k1);
|
||||
|
@ -61,6 +66,11 @@ end
|
|||
oo_.endo_simul = weight*initial_path + (1-weight)*oo_.endo_simul;
|
||||
|
||||
info = perfect_foresight_simulation(dr,steadystate);
|
||||
if verbose>1
|
||||
info
|
||||
info.iterations.errors
|
||||
end
|
||||
|
||||
r = y-transpose(oo_.endo_simul(maximum_lag+1,iy));
|
||||
|
||||
%(re)Set k1 (indices for the initial conditions)
|
||||
|
|
|
@ -73,7 +73,6 @@ for k=1:n
|
|||
iy_(k) = strmatch(controlled_variable_names{k},dataset.variables,'exact');
|
||||
end
|
||||
|
||||
|
||||
% Get indices of the control innovations in exo_simul.
|
||||
ix = NaN(n,1);
|
||||
for k=1:n
|
||||
|
@ -89,12 +88,19 @@ innovation_paths = zeros(n,T);
|
|||
% Initialization of the perfect foresight model solver.
|
||||
perfect_foresight_simulation();
|
||||
|
||||
% Set options for fsolve.
|
||||
options = optimset('MaxIter',10000,'Display','Iter');
|
||||
|
||||
%% Call fsolve recursively
|
||||
for t=1:T
|
||||
x0 = zeros(n,1);
|
||||
y = transpose(data(t,iy_));
|
||||
[tmp,fval,exitflag] = fsolve('ep_residuals', x0, [], y, ix, iy, oo_.steady_state, oo_.dr, M_.maximum_lag, M_.endo_nbr);
|
||||
y_target = transpose(data(t,iy_));
|
||||
total_variation = y_target-transpose(oo_.endo_simul(t+M_.maximum_lag,iy));
|
||||
for i=1:100
|
||||
[t,i]
|
||||
y = transpose(oo_.endo_simul(t+M_.maximum_lag,iy)) + (i/100)*y_target
|
||||
[tmp,fval,exitflag] = fsolve('ep_residuals', x0, options, y, ix, iy, oo_.steady_state, oo_.dr, M_.maximum_lag, M_.endo_nbr);
|
||||
end
|
||||
if exitflag==1
|
||||
innovation_paths(:,t) = tmp;
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue