essing the combined time series of historical variables on their lagged combined time series (up to lag p) 
% Variables for regression are redefined in terms of difference from long-term mean, with no constant vector, so that VAR is stationary around LTM 

X = [ones(N-lag,1)];
X_= [];
for tt=lagStep
  X = [X  Y(lag-tt+1:end-tt,:)];    %matrix of lagged combined time series for lags 1,...,p (with constant vector)
  X_= [X_ Y(lag-tt+1:end-tt,:)-LTM(ones(N-lag,1),:)];   %matrix in terms of difference from long