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","."]
code: def __init__(
      self,
      model,
      treatment,
      results_select=None,
      _cov_type="HC0",
      **kwds,
  ):
      # Note _cov_type is only for preliminary estimators,
      # cov in GMM alwasy corresponds to HC0
      self.__dict__.update(kwds)  # currently not used
      self.treatment = np.asarray(treatment)
      self.treat_mask = treat_mask = treatment == 1
  
      if results_select is not None:
          self.results_select = results_select
          self.prob_select = results_select.predict()
  
      self.model_pool = model
      endog = model.endog
      exog = model.exog
      self.nobs = endog.shape[0]
      self._cov_type = _cov_type
  
      # no init keys are supported
      mod0 = model.__class__(endog[~treat_mask], exog[~treat_mask])
      self.results0 = mod0.fit(cov_type=_cov_type)
      mod1 = model.__class__(endog[treat_mask], exog[treat_mask])
      self.results1 = mod1.fit(cov_type=_cov_type)
      # self.predict_mean0 = self.model_pool.predict(self.results0.params
      #                                             ).mean()
      # self.predict_mean1 = self.model_pool.predict(self.results1.params
      #                                             ).mean()
  
      self.exog_grouped = np.concatenate((mod0.exog, mod1.exog), axis=0)
      self.endog_grouped = np.concatenate(
          (mod0.endog, mod1.endog), axis=0
      )
  
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 1 to create a new TreatmentEffect object  with example: obj = TreatmentEffect(model, treatment, results_select, _cov_type)