small improvement to dyn_ols, pooled_sur_common: return summed rhs to subtract from lhs
parent
3a052f500c
commit
afecd9bebb
|
@ -143,8 +143,8 @@ for i = 1:length(jsonmodel)
|
|||
assert(length(residuals) == 1, ['More than one residual in equation ' num2str(i)]);
|
||||
|
||||
Y = eval(regexprep(jsonmodel{i}.lhs, regex, 'ds.$&'));
|
||||
for j = 1:lhssub.vobs
|
||||
Y = Y - lhssub{j};
|
||||
if ~isempty(lhssub)
|
||||
Y = Y - lhssub;
|
||||
end
|
||||
|
||||
fp = max(Y.firstobservedperiod, X.firstobservedperiod);
|
||||
|
@ -207,8 +207,8 @@ for i = 1:length(jsonmodel)
|
|||
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);
|
||||
if ~isempty(lhssub)
|
||||
oo_.ols.(tag).Yhat = oo_.ols.(tag).Yhat + lhssub(fp:lp);
|
||||
end
|
||||
|
||||
% Apply correcting function for Yhat if it was passed
|
||||
|
|
|
@ -10,7 +10,7 @@ function lhssub = getRhsToSubFromLhs(ds, rhs, regex, splits)
|
|||
% splits [cell array] strings to split out of equation on RHS
|
||||
%
|
||||
% OUTPUTS
|
||||
% lhssub [dseries] data to subtract from LHS
|
||||
% lhssub [dseries] summed data to subtract from LHS
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
@ -57,8 +57,7 @@ for j = 1:length(rhs_)
|
|||
str = getStrMoveRight(rhsj);
|
||||
if ~isempty(str)
|
||||
try
|
||||
lhssub = [lhssub eval(regexprep([minusstr str], regex, 'ds.$&'))];
|
||||
lhssub.rename_(lhssub{lhssub.vobs}.name{:}, [minusstr str]);
|
||||
lhssub = lhssub + eval(regexprep([minusstr str], regex, 'ds.$&'));
|
||||
catch
|
||||
if ~any(strcmp(M_.exo_names, str))
|
||||
error(['getRhsToSubFromLhs: problem evaluating ' minusstr str]);
|
||||
|
@ -68,4 +67,8 @@ for j = 1:length(rhs_)
|
|||
end
|
||||
end
|
||||
end
|
||||
if ~isempty(lhssub)
|
||||
assert(lhssub.vobs == 1, 'error in getRhsToSubFromLhs');
|
||||
lhssub.rename_(lhssub.name{:}, 'summed_rhs');
|
||||
end
|
||||
end
|
|
@ -154,8 +154,8 @@ for i = 1:length(jsonmodel)
|
|||
vars{i} = vnames;
|
||||
|
||||
ydata = eval(regexprep(jsonmodel{i}.lhs, regex, 'ds.$&'));
|
||||
for j = 1:lhssub.vobs
|
||||
ydata = ydata - lhssub{j};
|
||||
if ~isempty(lhssub)
|
||||
ydata = ydata - lhssub;
|
||||
end
|
||||
|
||||
if isempty(xjdata)
|
||||
|
|
Loading…
Reference in New Issue