Verified Commit b38d6f81 authored by Johannes Pfeifer 's avatar Johannes Pfeifer Committed by Stéphane Adjemian

compute_moments_varendo: use pruned state space at higher order

parent 314948ce
...@@ -71,6 +71,13 @@ if ~posterior ...@@ -71,6 +71,13 @@ if ~posterior
end end
nvar = length(ivar); nvar = length(ivar);
if options_.pruning
obs_var=NaN(nvar,1);
for i=1:nvar
obs_var(i,1) = find(strcmp(M_.endo_names(ivar(i),:), M_.endo_names(oo_.dr.order_var)));
end
end
% Set the size of the auto-correlation function to nar. % Set the size of the auto-correlation function to nar.
oldnar = options_.ar; oldnar = options_.ar;
options_.ar = nar; options_.ar = nar;
...@@ -109,7 +116,14 @@ for file = 1:NumberOfDrawsFiles ...@@ -109,7 +116,14 @@ for file = 1:NumberOfDrawsFiles
M_=set_parameters_locally(M_,temp.pdraws{linee,1}); M_=set_parameters_locally(M_,temp.pdraws{linee,1});
[dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); [dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
end end
tmp = th_autocovariances(dr,ivar,M_,options_,nodecomposition); if ~options_.pruning
tmp = th_autocovariances(dr,ivar,M_,options_,nodecomposition);
else
pruned_state_space = pruned_state_space_system(M_, options_, dr, obs_var, options_.ar, 1, 0);
for i=1:nar
tmp{i+1} = pruned_state_space.Corr_yi(:,:,i);
end
end
for i=1:nar for i=1:nar
Correlation_array(linea,:,:,i) = tmp{i+1}; Correlation_array(linea,:,:,i) = tmp{i+1};
end end
......
...@@ -70,6 +70,12 @@ if ~posterior ...@@ -70,6 +70,12 @@ if ~posterior
end end
nvar = length(ivar); nvar = length(ivar);
if options_.pruning
obs_var=NaN(nvar,1);
for i=1:nvar
obs_var(i,1) = find(strcmp(M_.endo_names(ivar(i),:), M_.endo_names(oo_.dr.order_var)));
end
end
% Set the size of the auto-correlation function to zero. % Set the size of the auto-correlation function to zero.
nar = options_.ar; nar = options_.ar;
options_.ar = 0; options_.ar = 0;
...@@ -108,7 +114,12 @@ for file = 1:NumberOfDrawsFiles ...@@ -108,7 +114,12 @@ for file = 1:NumberOfDrawsFiles
M_=set_parameters_locally(M_,temp.pdraws{linee,1}); M_=set_parameters_locally(M_,temp.pdraws{linee,1});
[dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); [dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
end end
tmp = th_autocovariances(dr,ivar,M_,options_,nodecomposition); if ~options_.pruning
tmp = th_autocovariances(dr,ivar,M_,options_,nodecomposition);
else
pruned_state_space = pruned_state_space_system(M_, options_, dr, obs_var, options_.ar, 1, 0);
tmp{1} = pruned_state_space.Var_y;
end
for i=1:nvar for i=1:nvar
for j=i:nvar for j=i:nvar
Covariance_matrix(linea,symmetric_matrix_index(i,j,nvar)) = tmp{1}(i,j); Covariance_matrix(linea,symmetric_matrix_index(i,j,nvar)) = tmp{1}(i,j);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment