dyn_ols: fix bug in correction of fitted values

time-shift
Houtan Bastani 2018-01-29 16:26:46 +01:00
parent 4bbfb35a6e
commit 01d416da45
1 changed files with 10 additions and 8 deletions

View File

@ -200,20 +200,22 @@ for i = 1:length(jsonmodel)
end
end
oo_.ols.(tag).Yhat = dseries(X*oo_.ols.(tag).beta, fp, yhatname);
% Residuals
oo_.ols.(tag).resid = Y - oo_.ols.(tag).Yhat;
% Correct Yhat reported back to user
for j = 1:lhssub.vobs
oo_.ols.(tag).Yhat = oo_.ols.(tag).Yhat + lhssub{j}(fp:lp);
end
% Apply correcting function for Yhat if it was passed
if any(idx) ...
&& length(fitted_names_dict(idx, :)) == 3 ...
&& ~isempty(fitted_names_dict{idx, 3})
oo_.ols.(tag).Yhat = ...
feval(fitted_names_dict{idx, 3}, oo_.ols.(tag).Yhat);
end
% Residuals
oo_.ols.(tag).resid = Y - oo_.ols.(tag).Yhat;
% Correct Yhat reported back to user for given
for j = 1:lhssub.vobs
oo_.ols.(tag).Yhat = oo_.ols.(tag).Yhat + lhssub{j}(fp:lp);
end
ds = [ds oo_.ols.(tag).Yhat];
%% Calculate statistics