Skip to content
Snippets Groups Projects
Commit cb5d3df6 authored by Johannes Pfeifer's avatar Johannes Pfeifer
Browse files

Computation of the loss function in the presence of unit root variables was incorrect

Some elements were simply left out. This commit now mimics the computations as in th_autocovariances.m and makes sure the loss function coincides with the one that is obtained by reading out the covariance from oo_.var
parent 66901616
Branches
Tags
No related merge requests found
...@@ -48,16 +48,13 @@ n = length(i_var); ...@@ -48,16 +48,13 @@ n = length(i_var);
[vx,u] = lyapunov_symm(A,B*Sigma_e*B',options_.qz_criterium,options_.lyapunov_complex_threshold, [], [], options_.debug); [vx,u] = lyapunov_symm(A,B*Sigma_e*B',options_.qz_criterium,options_.lyapunov_complex_threshold, [], [], options_.debug);
if size(u,2) > 0 if size(u,2) > 0
i_stat_0 = find(any(abs(A*u) < options_.Schur_vec_tol,2)); i_stat = find(any(abs(ghx*u) < options_.Schur_vec_tol,2)); %only set those variances of objective function for which variance is finite
i_stat = find(any(abs(ghx*u) < options_.Schur_vec_tol,2));
ghx = ghx(i_stat,:); ghx = ghx(i_stat,:);
ghu = ghu(i_stat,:); ghu = ghu(i_stat,:);
else else
i_stat_0 = 1:size(ghx,2);
i_stat = (1:n)'; i_stat = (1:n)';
end end
vx1 = Inf*ones(n,n); vx1 = Inf*ones(n,n);
vx1(i_stat,i_stat) = ghx(:,i_stat_0)*vx(i_stat_0,i_stat_0)*ghx(:,i_stat_0)'+ghu*Sigma_e*ghu'; vx1(i_stat,i_stat) = ghx*vx*ghx'+ghu*Sigma_e*ghu';
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment