class_docstr: Estimate average treatment effect under conditional independence
  
  .. versionadded:: 0.14.0
  
  This class estimates treatment effect and potential outcome using 5
  different methods, ipw, ra, aipw, aipw-wls, ipw-ra.
  Standard errors and inference are based on the joint GMM representation of
  selection or treatment model, outcome model and effect functions.
  
  Parameters
  ----------
  model : instance of a model class
      The model class should contain endog and exog for the outcome model.
  treatment : ndarray
      indicator array for observations with treatment (1) or without (0)
  results_select : results instance
      The results instance for the treatment or selection model.
  _cov_type : "HC0"
      Internal keyword. The keyword oes not affect GMMResults which always
      corresponds to HC0 standard errors.
  kwds : keyword arguments
      currently not used
  
  Notes
  -----
  The outcome model is currently limited to a linear model based on OLS.
  Other outcome models, like Logit and Poisson, will become available in
  future.
  
  See `Treatment Effect notebook
  <../examples/notebooks/generated/treatment_effect.html>`__
  for an overview.
class_docstr_tok: ["Estimate","average","treatment","effect","under","conditional","independence","..","versionadded",":",":","0.14.0","This","class","estimates","treatment","effect","and","potential","outcome","using","5","different","methods",",","ipw",",","ra",",","aipw",",","aipw-wls",",","ipw-ra",".","Standard","errors","and","inference","are","based","on","the","joint","GMM","representation","of","selection","or","treatment","model",",","outcome","model","and","effect","functions",".","Parameters","--","--","--","--","--","model",":","instance","of","a","model","class","The","model","class","should","contain","endog","and","exog","for","the","outcome","model",".","treatment",":","ndarray","indicator","array","for","observations","with","treatment","(","1",")","or","without","(","0",")","results_select",":","results","instance","The","results","instance","for","the","treatment","or","selection","model",".","_cov_type",":","``","HC0","''","Internal","keyword",".","The","keyword","oes","not","affect","GMMResults","which","always","corresponds","to","HC0","standard","errors",".","kwds",":","keyword","arguments","currently","not","used","Notes","--","--","-","The","outcome","model","is","currently","limited","to","a","linear","model","based","on","OLS",".","Other","outcome","models",",","like","Logit","and","Poisson",",","will","become","available","in","future",".","See","`","Treatment","Effect","notebook","<","..","\/examples\/notebooks\/generated\/treatment_effect.html",">","`","__","for","an","overview","."]
docstr:         Regression Adjustment treatment effect estimation.
          
  %(params_returns)s
          See Also
          --------
          TreatmentEffectsResults
          
docstr_tok: ["Regression","Adjustment","treatment","effect","estimation",".","%","(","params_returns",")","s","See","Also","--","--","--","--","TreatmentEffectsResults"]
code: def ra(self, return_results=True, effect_group="all", disp=False):
      """
      Regression Adjustment treatment effect estimation.
      \n%(params_returns)s
      See Also
      --------
      TreatmentEffectsResults
      """
      # need indicator for reordered observations
      tind = np.zeros(len(self.treatment))
      tind[-self.treatment.sum() :] = 1
      if effect_group == "all":
          probt = None
      elif effect_group in [1, "treated"]:
          probt = tind
          effect_group = 1  # standardize effect_group name
      elif effect_group in [0, "untreated", "control"]:
          probt = 1 - tind
          effect_group = 0  # standardize effect_group name
      elif isinstance(effect_group, np.ndarray):
          # TODO: do we keep this?
          probt = effect_group
          effect_group = "user"  # standardize effect_group name
      else:
          raise ValueError("incorrect option for effect_group")
  
      exog = self.exog_grouped
  
      # weight or indicator for effect_group
      if probt is not None:
          cw = probt / probt.mean()
      else:
          cw = 1
  
      pom0 = (self.results0.predict(exog) * cw).mean()
      pom1 = (self.results1.predict(exog) * cw).mean()
      if not return_results:
          return pom1 - pom0, pom0, pom1
  
      endog = self.model_pool.endog
      mod_gmm = _RAGMM(
          endog, self.results_select, None, teff=self, probt=probt
      )
      start_params = np.concatenate(
          (
              # ate, tt0.effect,
              [pom1 - pom0, pom0],
              self.results0.params,
              self.results1.params,
          )
      )
      res_gmm = mod_gmm.fit(
          start_params=start_params,
          inv_weights=np.eye(len(start_params)),
          optim_method="nm",
          optim_args={"maxiter": 5000, "disp": disp},
          maxiter=1,
      )
      res = TreatmentEffectResults(
          self,
          res_gmm,
          "IPW",
          start_params=start_params,
          effect_group=effect_group,
      )
      return res
  
imports: import numpy
  from statsmodels.compat.pandas import Substitution
  from scipy.linalg import block_diag
  from statsmodels.regression.linear_model import WLS
  from statsmodels.sandbox.regression.gmm import GMM
  from statsmodels.stats.contrast import ContrastResults
  from statsmodels.tools.docstring import indent
label_desc: Use image node_id 4 for calling the TreatmentEffect obj's underlying member method code with example usage: obj.ra(return_results, effect_group, disp) and returns: res, unknown,  pom0,  pom1