code: def cat2dummy(y, nonseq=0):
      if nonseq or (y.ndim == 2 and y.shape[1] > 1):
          ycat, uniques, unitransl = convertlabels(
              y, lrange(y.shape[1])
          )
      else:
          ycat = y.copy()
          ymin = y.min()
          uniques = np.arange(ymin, y.max() + 1)
      if ycat.ndim == 1:
          ycat = ycat[:, np.newaxis]
      # this builds matrix nobs*ncat
      dummy = (ycat == uniques).astype(int)
      return dummy
  
file_path: statsmodels/statsmodels/sandbox/regression/try_catdata.py
imports: from statsmodels.compat.python import lrange
  import numpy
  from scipy import ndimage
label_desc: Use image node_id 7 for calling a global function with example usage: cat2dummy(y, nonseq) and returns: dummy