class_docstr: Class to perform Oaxaca-Blinder Decomposition.
  
  Parameters
  ----------
  endog : array_like
      The endogenous variable or the dependent variable that you are trying
      to explain.
  exog : array_like
      The exogenous variable(s) or the independent variable(s) that you are
      using to explain the endogenous variable.
  bifurcate : {int, str}
      The column of the exogenous variable(s) on which to split. This would
      generally be the group that you wish to explain the two means for.
      Int of the column for a NumPy array or int/string for the name of
      the column in Pandas.
  hasconst : bool, optional
      Indicates whether the two exogenous variables include a user-supplied
      constant. If True, a constant is assumed. If False, a constant is added
      at the start. If nothing is supplied, then True is assumed.
  swap : bool, optional
      Imitates the STATA Oaxaca command by allowing users to choose to swap
      groups. Unlike STATA, this is assumed to be True instead of False
  cov_type : str, optional
      See regression.linear_model.RegressionResults for a description of the
      available covariance estimators
  cov_kwds : dict, optional
      See linear_model.RegressionResults.get_robustcov_results for a
      description required keywords for alternative covariance estimators
  
  Notes
  -----
  Please check if your data includes at constant. This will still run, but
  will return incorrect values if set incorrectly.
  
  You can access the models by using their code as an attribute, e.g.,
  _t_model for the total model, _f_model for the first model, _s_model for
  the second model.
  
  Examples
  --------
  >>> import numpy as np
  >>> import statsmodels.api as sm
  >>> data = sm.datasets.ccards.load()
  
  '3' is the column of which we want to explain or which indicates
  the two groups. In this case, it is if you rent.
  
  >>> model = sm.OaxacaBlinder(df.endog, df.exog, 3, hasconst = False)
  >>> model.two_fold().summary()
  Oaxaca-Blinder Two-fold Effects
  Unexplained Effect: 27.94091
  Explained Effect: 130.80954
  Gap: 158.75044
  
  >>> model.three_fold().summary()
  Oaxaca-Blinder Three-fold Effects
  Endowments Effect: 321.74824
  Coefficient Effect: 75.45371
  Interaction Effect: -238.45151
  Gap: 158.75044
class_docstr_tok: ["Class","to","perform","Oaxaca-Blinder","Decomposition",".","Parameters","--","--","--","--","--","endog",":","array_like","The","endogenous","variable","or","the","dependent","variable","that","you","are","trying","to","explain",".","exog",":","array_like","The","exogenous","variable","(","s",")","or","the","independent","variable","(","s",")","that","you","are","using","to","explain","the","endogenous","variable",".","bifurcate",":","{","int",",","str","}","The","column","of","the","exogenous","variable","(","s",")","on","which","to","split",".","This","would","generally","be","the","group","that","you","wish","to","explain","the","two","means","for",".","Int","of","the","column","for","a","NumPy","array","or","int\/string","for","the","name","of","the","column","in","Pandas",".","hasconst",":","bool",",","optional","Indicates","whether","the","two","exogenous","variables","include","a","user-supplied","constant",".","If","True",",","a","constant","is","assumed",".","If","False",",","a","constant","is","added","at","the","start",".","If","nothing","is","supplied",",","then","True","is","assumed",".","swap",":","bool",",","optional","Imitates","the","STATA","Oaxaca","command","by","allowing","users","to","choose","to","swap","groups",".","Unlike","STATA",",","this","is","assumed","to","be","True","instead","of","False","cov_type",":","str",",","optional","See","regression.linear_model.RegressionResults","for","a","description","of","the","available","covariance","estimators","cov_kwds",":","dict",",","optional","See","linear_model.RegressionResults.get_robustcov_results","for","a","description","required","keywords","for","alternative","covariance","estimators","Notes","--","--","-","Please","check","if","your","data","includes","at","constant",".","This","will","still","run",",","but","will","return","incorrect","values","if","set","incorrectly",".","You","can","access","the","models","by","using","their","code","as","an","attribute",",","e.g.",",","_t_model","for","the","total","model",",","_f_model","for","the","first","model",",","_s_model","for","the","second","model",".","Examples","--","--","--","--",">",">",">","import","numpy","as","np",">",">",">","import","statsmodels.api","as","sm",">",">",">","data","=","sm.datasets.ccards.load","(",")","'","3","'","is","the","column","of","which","we","want","to","explain","or","which","indicates","the","two","groups",".","In","this","case",",","it","is","if","you","rent",".",">",">",">","model","=","sm.OaxacaBlinder","(","df.endog",",","df.exog",",","3",",","hasconst","=","False",")",">",">",">","model.two_fold","(",")",".summary","(",")","Oaxaca-Blinder","Two-fold","Effects","Unexplained","Effect",":","27.94091","Explained","Effect",":","130.80954","Gap",":","158.75044",">",">",">","model.three_fold","(",")",".summary","(",")","Oaxaca-Blinder","Three-fold","Effects","Endowments","Effect",":","321.74824","Coefficient","Effect",":","75.45371","Interaction","Effect",":","-238.45151","Gap",":","158.75044"]
docstr: A helper function to calculate the variance/std. Used to keep
  the decomposition functions cleaner
docstr_tok: ["A","helper","function","to","calculate","the","variance\/std",".","Used","to","keep","the","decomposition","functions","cleaner"]
code: def variance(self, decomp_type, n=5000, conf=0.99):
      """
      A helper function to calculate the variance/std. Used to keep
      the decomposition functions cleaner
      """
      if self.submitted_n is not None:
          n = self.submitted_n
      if self.submitted_conf is not None:
          conf = self.submitted_conf
      if self.submitted_weight is not None:
          submitted_weight = [
              self.submitted_weight,
              1 - self.submitted_weight,
          ]
      bi = self.bi
      bifurcate = self.bifurcate
      endow_eff_list = []
      coef_eff_list = []
      int_eff_list = []
      exp_eff_list = []
      unexp_eff_list = []
      for _ in range(0, n):
          endog = np.column_stack((self.bi_col, self.endog))
          exog = self.exog
          amount = len(endog)
  
          samples = np.random.randint(0, high=amount, size=amount)
          endog = endog[samples]
          exog = exog[samples]
          neumark = np.delete(exog, bifurcate, axis=1)
  
          exog_f = exog[np.where(exog[:, bifurcate] == bi[0])]
          exog_s = exog[np.where(exog[:, bifurcate] == bi[1])]
          endog_f = endog[np.where(endog[:, 0] == bi[0])]
          endog_s = endog[np.where(endog[:, 0] == bi[1])]
          exog_f = np.delete(exog_f, bifurcate, axis=1)
          exog_s = np.delete(exog_s, bifurcate, axis=1)
          endog_f = endog_f[:, 1]
          endog_s = endog_s[:, 1]
          endog = endog[:, 1]
  
          two_fold_type = self.two_fold_type
  
          if self.hasconst is False:
              exog_f = add_constant(exog_f, prepend=False)
              exog_s = add_constant(exog_s, prepend=False)
              exog = add_constant(exog, prepend=False)
              neumark = add_constant(neumark, prepend=False)
  
          _f_model = OLS(endog_f, exog_f).fit(
              cov_type=self.cov_type, cov_kwds=self.cov_kwds
          )
          _s_model = OLS(endog_s, exog_s).fit(
              cov_type=self.cov_type, cov_kwds=self.cov_kwds
          )
          exog_f_mean = np.mean(exog_f, axis=0)
          exog_s_mean = np.mean(exog_s, axis=0)
  
          if decomp_type == 3:
              endow_eff = (exog_f_mean - exog_s_mean) @ _s_model.params
              coef_eff = exog_s_mean @ (
                  _f_model.params - _s_model.params
              )
              int_eff = (exog_f_mean - exog_s_mean) @ (
                  _f_model.params - _s_model.params
              )
  
              endow_eff_list.append(endow_eff)
              coef_eff_list.append(coef_eff)
              int_eff_list.append(int_eff)
  
          elif decomp_type == 2:
              len_f = len(exog_f)
              len_s = len(exog_s)
  
              if two_fold_type == "cotton":
                  t_params = (
                      len_f / (len_f + len_s) * _f_model.params
                  ) + (len_s / (len_f + len_s) * _s_model.params)
  
              elif two_fold_type == "reimers":
                  t_params = 0.5 * (_f_model.params + _s_model.params)
  
              elif two_fold_type == "self_submitted":
                  t_params = (
                      submitted_weight[0] * _f_model.params
                      + submitted_weight[1] * _s_model.params
                  )
  
              elif two_fold_type == "nuemark":
                  _t_model = OLS(endog, neumark).fit(
                      cov_type=self.cov_type, cov_kwds=self.cov_kwds
                  )
                  t_params = _t_model.params
  
              else:
                  _t_model = OLS(endog, exog).fit(
                      cov_type=self.cov_type, cov_kwds=self.cov_kwds
                  )
                  t_params = np.delete(_t_model.params, bifurcate)
  
              unexplained = (
                  exog_f_mean @ (_f_model.params - t_params)
              ) + (exog_s_mean @ (t_params - _s_model.params))
  
              explained = (exog_f_mean - exog_s_mean) @ t_params
  
              unexp_eff_list.append(unexplained)
              exp_eff_list.append(explained)
  
      high, low = int(n * conf), int(n * (1 - conf))
      if decomp_type == 3:
          return [
              np.std(np.sort(endow_eff_list)[low:high]),
              np.std(np.sort(coef_eff_list)[low:high]),
              np.std(np.sort(int_eff_list)[low:high]),
          ]
      elif decomp_type == 2:
          return [
              np.std(np.sort(unexp_eff_list)[low:high]),
              np.std(np.sort(exp_eff_list)[low:high]),
          ]
  
file_path: statsmodels/statsmodels/stats/oaxaca.py
imports: from textwrap import dedent
  import numpy
  from statsmodels.regression.linear_model import OLS
  from statsmodels.tools.tools import add_constant
label_desc: Use image node_id 2 for calling the OaxacaBlinder obj's underlying member method code with example usage: obj.variance(decomp_type, n, conf) and returns: list, list