Skip to content
Snippets Groups Projects
Commit de152a3d authored by Marco Ratto's avatar Marco Ratto
Browse files

bug fix: indexing must also contain smpl+1 (needed for 1 step ahead forecast...

bug fix: indexing must also contain smpl+1 (needed for 1 step ahead forecast in last period when filtering).
parent 8f735646
No related branches found
No related tags found
No related merge requests found
...@@ -500,18 +500,18 @@ if options_.heteroskedastic_filter ...@@ -500,18 +500,18 @@ if options_.heteroskedastic_filter
'for heteroskedastic_filter']) 'for heteroskedastic_filter'])
end end
M_.heteroskedastic_shocks.Qvalue = NaN(M_.exo_nbr,options_.nobs); M_.heteroskedastic_shocks.Qvalue = NaN(M_.exo_nbr,options_.nobs+1);
M_.heteroskedastic_shocks.Qscale = NaN(M_.exo_nbr,options_.nobs); M_.heteroskedastic_shocks.Qscale = NaN(M_.exo_nbr,options_.nobs+1);
for k=1:length(M_.heteroskedastic_shocks.Qvalue_orig) for k=1:length(M_.heteroskedastic_shocks.Qvalue_orig)
v = M_.heteroskedastic_shocks.Qvalue_orig(k); v = M_.heteroskedastic_shocks.Qvalue_orig(k);
temp_periods=v.periods(v.periods<options_.nobs+options_.first_obs); temp_periods=v.periods(v.periods<options_.nobs+options_.first_obs+1);
temp_periods=temp_periods(temp_periods>=options_.first_obs); temp_periods=temp_periods(temp_periods>=options_.first_obs);
M_.heteroskedastic_shocks.Qvalue(v.exo_id, temp_periods-(options_.first_obs-1)) = v.value^2; M_.heteroskedastic_shocks.Qvalue(v.exo_id, temp_periods-(options_.first_obs-1)) = v.value^2;
end end
for k=1:length(M_.heteroskedastic_shocks.Qscale_orig) for k=1:length(M_.heteroskedastic_shocks.Qscale_orig)
v = M_.heteroskedastic_shocks.Qscale_orig(k); v = M_.heteroskedastic_shocks.Qscale_orig(k);
temp_periods=v.periods(v.periods<options_.nobs+options_.first_obs); temp_periods=v.periods(v.periods<options_.nobs+options_.first_obs+1);
temp_periods=temp_periods(temp_periods>=options_.first_obs); temp_periods=temp_periods(temp_periods>=options_.first_obs);
M_.heteroskedastic_shocks.Qscale(v.exo_id, temp_periods-(options_.first_obs-1)) = v.scale^2; M_.heteroskedastic_shocks.Qscale(v.exo_id, temp_periods-(options_.first_obs-1)) = v.scale^2;
end end
......
...@@ -27,7 +27,7 @@ function Qvec=get_Qvec_heteroskedastic_filter(Q,smpl,M_) ...@@ -27,7 +27,7 @@ function Qvec=get_Qvec_heteroskedastic_filter(Q,smpl,M_)
isqdiag = all(all(abs(Q-diag(diag(Q)))<1e-14)); % ie, the covariance matrix is diagonal... isqdiag = all(all(abs(Q-diag(diag(Q)))<1e-14)); % ie, the covariance matrix is diagonal...
Qvec=repmat(Q,[1 1 smpl+1]); Qvec=repmat(Q,[1 1 smpl+1]);
for k=1:smpl for k=1:smpl+1
inx = ~isnan(M_.heteroskedastic_shocks.Qvalue(:,k)); inx = ~isnan(M_.heteroskedastic_shocks.Qvalue(:,k));
if any(inx) if any(inx)
if isqdiag if isqdiag
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment