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:         ATE and POM from double robust augmented inverse probability weighting
          
  %(params_returns)s
          See Also
          --------
          TreatmentEffectsResults
  
          
docstr_tok: ["ATE","and","POM","from","double","robust","augmented","inverse","probability","weighting","%","(","params_returns",")","s","See","Also","--","--","--","--","TreatmentEffectsResults"]
code: def aipw(self, return_results=True, disp=False):
      """
      ATE and POM from double robust augmented inverse probability weighting
      \n%(params_returns)s
      See Also
      --------
      TreatmentEffectsResults
  
      """
  
      nobs = self.nobs
      prob = self.prob_select
      tind = self.treatment
      exog = self.model_pool.exog  # in original order
      correct0 = (
          self.results0.resid / (1 - prob[tind == 0])
      ).sum() / nobs
      correct1 = (self.results1.resid / (prob[tind == 1])).sum() / nobs
      tmean0 = self.results0.predict(exog).mean() + correct0
      tmean1 = self.results1.predict(exog).mean() + correct1
      ate = tmean1 - tmean0
      if not return_results:
          return ate, tmean0, tmean1
  
      endog = self.model_pool.endog
      p2_aipw = np.asarray([ate, tmean0])
  
      mag_aipw1 = _AIPWGMM(endog, self.results_select, None, teff=self)
      start_params = np.concatenate(
          (
              p2_aipw,
              self.results0.params,
              self.results1.params,
              self.results_select.params,
          )
      )
      res_gmm = mag_aipw1.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="all",
      )
      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 5 for calling the TreatmentEffect obj's underlying member method code with example usage: obj.aipw(return_results, disp) and returns: res, ate,  tmean0,  tmean1