docstr: 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 would not know
  which individual is missing.
  
  TODO: do I want the full equivalent of lagmat in tsa?
  maxlag or lag or lags.
  
  not tested yet
docstr_tok: ["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","would","not","know","which","individual","is","missing",".","TODO",":","do","I","want","the","full","equivalent","of","lagmat","in","tsa","?","maxlag","or","lag","or","lags",".","not","tested","yet"]
code: def lag_indices(self, lag):
      """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 would not know
      which individual is missing.
  
      TODO: do I want the full equivalent of lagmat in tsa?
      maxlag or lag or lags.
  
      not tested yet
      """
      lag_idx = (
          np.asarray(self.groupidx)[:, 1] - lag
      )  # asarray or already?
      mask_ok = lag <= lag_idx
      # still an observation that belongs to the same individual
  
      return lag_idx[mask_ok]
  
imports: from statsmodels.compat.python import lrange, lzip
  import numpy
  import pandas
  import statsmodels.tools.data
  from pandas import Index, MultiIndex
label_desc: Use image node_id 3 for calling the GroupSorted obj's underlying member method code with example usage: obj.lag_indices(lag) and returns: lag_idx