bug fix: indexing must also contain smpl+1 (needed for 1 step ahead forecast in last period when filtering).
parent
8f73564634
commit
de152a3de3
|
@ -500,18 +500,18 @@ if options_.heteroskedastic_filter
|
|||
'for heteroskedastic_filter'])
|
||||
end
|
||||
|
||||
M_.heteroskedastic_shocks.Qvalue = NaN(M_.exo_nbr,options_.nobs);
|
||||
M_.heteroskedastic_shocks.Qscale = 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+1);
|
||||
|
||||
for k=1:length(M_.heteroskedastic_shocks.Qvalue_orig)
|
||||
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);
|
||||
M_.heteroskedastic_shocks.Qvalue(v.exo_id, temp_periods-(options_.first_obs-1)) = v.value^2;
|
||||
end
|
||||
for k=1:length(M_.heteroskedastic_shocks.Qscale_orig)
|
||||
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);
|
||||
M_.heteroskedastic_shocks.Qscale(v.exo_id, temp_periods-(options_.first_obs-1)) = v.scale^2;
|
||||
end
|
||||
|
|
|
@ -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...
|
||||
Qvec=repmat(Q,[1 1 smpl+1]);
|
||||
for k=1:smpl
|
||||
for k=1:smpl+1
|
||||
inx = ~isnan(M_.heteroskedastic_shocks.Qvalue(:,k));
|
||||
if any(inx)
|
||||
if isqdiag
|
||||
|
|
Loading…
Reference in New Issue