4.7.7.1.2.2.1.9. statsmodels.tools.grouputils.GroupSorted.lag_indices

GroupSorted.lag_indices(lag)[source]

return the index array for lagged values

Warning: if k is larger then the number of observations for an individual, then no values for that individual are returned.

TODO: for the unbalanced case, I should get the same truncation for the array with lag=0. From the return of lag_idx we wouldn’t know which individual is missing.

TODO: do I want the full equivalent of lagmat in tsa? maxlag or lag or lags.

not tested yet