fix common parsing function to impose same dates per equation

time-shift
Houtan Bastani 2019-01-14 14:56:55 +01:00
parent 3427d93c09
commit a7181a8151
No known key found for this signature in database
GPG Key ID: 000094FB955BE169
1 changed files with 8 additions and 6 deletions

View File

@ -1,5 +1,5 @@
function [Y, lhssub, X, startdates, enddates, startidxs, residnames, pbeta, vars] = common_parsing(ds, ast, jsonmodel, overlapping_dates)
%function [Y, lhssub, X, startdates, enddates, startidxs, residnames, pbeta, vars] = common_parsing(ds, ast, jsonmodel, overlapping_dates)
function [Y, lhssub, X, startdates, enddates] = common_parsing(ds, ast, jsonmodel, overlapping_dates)
%function [Y, lhssub, X, startdates, enddates] = common_parsing(ds, ast, jsonmodel, overlapping_dates)
%
% Code common to sur.m and pooled_ols.m
%
@ -7,8 +7,7 @@ function [Y, lhssub, X, startdates, enddates, startidxs, residnames, pbeta, vars
% ds [dseries] dataset
% ast [cell array] JSON representation of abstract syntax tree
% jsonmodel [cell array] JSON representation of model block
% overlapping_dates [boolean] if true, dates are same across
% equations
% overlapping_dates [boolean] if true, dates are same across equations
%
% OUTPUTS
% Y [cell array] dependent variables
@ -65,8 +64,11 @@ for i = 1:neqs
[Y{i}, lhssub{i}, X{i}] = parse_ols_style_equation(ds, ast{i});
%% Set start and end dates
if overlapping_dates
[startdates{i}, enddates{i}] = get_ols_start_end_dates(Y{i}, lhssub{i}, X{i}, jsonmodel{i});
[startdates{i}, enddates{i}] = get_ols_start_end_dates(Y{i}, lhssub{i}, X{i}, jsonmodel{i});
Y{i} = Y{i}(startdates{i}:enddates{i});
X{i} = X{i}(startdates{i}:enddates{i});
if ~isempty(lhssub{i})
lhssub{i} = lhssub{i}(startdates{i}:enddates{i});
end
end