code: def groupsstats_dummy(y, x, nonseq=0):
      if x.ndim == 1:
          # use groupsstats_1d
          x = x[:, np.newaxis]
      dummy = cat2dummy(y, nonseq=nonseq)
      countgr = dummy.sum(0, dtype=float)
      meangr = np.dot(x.T, dummy) / countgr
      meandata = np.dot(
          dummy, meangr.T
      )  # category/group means as array in shape of x
      xdevmeangr = x - meandata  # deviation from category/group mean
      vargr = np.dot((xdevmeangr * xdevmeangr).T, dummy) / countgr
      return meangr, vargr, xdevmeangr, countgr
  
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 8 for calling a global function with example usage: groupsstats_dummy(y, x, nonseq) and returns: meangr,  vargr,  xdevmeangr,  countgr