code: def coef_restriction_diffbase(
      n_coeffs, n_vars=None, position=0, base_idx=0
  ):
      reduced = -np.eye(n_coeffs)  # make all rows, drop one row later
      reduced[:, base_idx] = 1
  
      keep = lrange(n_coeffs)
      del keep[base_idx]
      reduced = np.take(reduced, keep, axis=0)
  
      if n_vars is None:
          return reduced
      else:
          full = np.zeros((n_coeffs - 1, n_vars))
          full[:, position : position + n_coeffs] = reduced
          return full
  
imports: from statsmodels.compat.python import lrange
  import numpy
  from statsmodels.tools.decorators import cache_readonly
  from statsmodels.regression.linear_model import OLS, GLS, RegressionResults
  from statsmodels.regression.feasible_gls import atleast_2dcols
label_desc: Use image node_id 2 for calling a global function with example usage: coef_restriction_diffbase(n_coeffs, n_vars, position, base_idx) and returns: reduced, full