dyn_ols: fix bugs

time-shift
Houtan Bastani 2017-11-09 16:27:54 +01:00
parent f0b2fd3d34
commit d4574f6c0e
1 changed files with 7 additions and 3 deletions

View File

@ -143,6 +143,8 @@ for i = 1:length(lhs)
if ~isempty(startidx)
if startidx > 1 && rhs_{j}(startidx) == '-'
str = ['-' getStrMoveRight(rhs_{j}(startidx+1:end))];
elseif startidx > 1 && rhs_{j}(startidx) == '+'
str = getStrMoveRight(rhs_{j}(startidx+1:end));
else
str = getStrMoveRight(rhs_{j}(startidx:end));
end
@ -194,13 +196,15 @@ for i = 1:length(lhs)
% Yhat
oo_.ols.(tagv).Yhat = dseries(X*oo_.ols.(tagv).beta, fp, [lhs{i} '_hat']);
for j = 1:lhssub.vobs
oo_.ols.(tagv).Yhat = oo_.ols.(tagv).Yhat + lhssub{j}(fp:lp);
end
% Residuals
oo_.ols.(tagv).resid = Y - oo_.ols.(tagv).Yhat;
% Correct Yhat reported back to user for given
for j = 1:lhssub.vobs
oo_.ols.(tagv).Yhat = oo_.ols.(tagv).Yhat + lhssub{j}(fp:lp);
end
%% Calculate statistics
% Estimate for sigma^2
SS_res = oo_.ols.(tagv).resid.data'*oo_.ols.(tagv).resid.data;