code: def group_sums_dummy(x, group_dummy):
      """sum by groups given group dummy variable
  
      group_dummy can be either ndarray or sparse matrix
      """
      if data_util._is_using_ndarray_type(group_dummy, None):
          return np.dot(x.T, group_dummy)
      else:  # check for sparse
          return x.T * group_dummy
  
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 a global function with example usage: group_sums_dummy(x, group_dummy) and returns: np, unknown