7.8.6.5. statsmodels.tsa.tsatools.lagmat2ds

statsmodels.tsa.tsatools.lagmat2ds(x, maxlag0, maxlagex=None, dropex=0, trim='forward')[source]

generate lagmatrix for 2d array, columns arranged by variables

Parameters:

x : array_like, 2d

2d data, observation in rows and variables in columns

maxlag0 : int

for first variable all lags from zero to maxlag are included

maxlagex : None or int

max lag for all other variables all lags from zero to maxlag are included

dropex : int (default is 0)

exclude first dropex lags from other variables for all variables, except the first, lags from dropex to maxlagex are included

trim : string

  • ‘forward’ : trim invalid observations in front
  • ‘backward’ : trim invalid initial observations
  • ‘both’ : trim invalid observations on both sides
  • ‘none’ : no trimming of observations
Returns:

lagmat : 2d array

array with lagged observations, columns ordered by variable

Notes

very inefficient for unequal lags, just done for convenience