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: Calculates the two-fold or pooled Oaxaca Blinder Decompositions
  
  Methods
  -------
  std: boolean, optional
      If true, bootstrapped standard errors will be calculated.
  
  two_fold_type: string, optional
      This method allows for the specific calculation of the
      non-discriminatory model. There are four different types
      available at this time. pooled, cotton, reimers, self_submitted.
      Pooled is assumed and if a non-viable parameter is given,
      pooled will be ran.
  
      pooled - This type assumes that the pooled model's parameters
      (a normal regression) is the non-discriminatory model.
      This includes the indicator variable. This is generally
      the best idea. If you have economic justification for
      using others, then use others.
  
      nuemark - This is similar to the pooled type, but the regression
      is not done including the indicator variable.
  
      cotton - This type uses the adjusted in Cotton (1988), which
      accounts for the undervaluation of one group causing the
      overevalution of another. It uses the sample size weights for
      a linear combination of the two model parameters
  
      reimers - This type uses a linear combination of the two
      models with both parameters being 50% of the
      non-discriminatory model.
  
      self_submitted - This allows the user to submit their
      own weights. Please be sure to put the weight of the larger mean
      group only. This should be submitted in the
      submitted_weights variable.
  
  submitted_weight: int/float, required only for self_submitted,
      This is the submitted weight for the larger mean. If the
      weight for the larger mean is p, then the weight for the
      other mean is 1-p. Only submit the first value.
  
  n: int, optional
      A amount of iterations to calculate the bootstrapped
      standard errors. This defaults to 5000.
  conf: float, optional
      This is the confidence required for the standard error
      calculation. Defaults to .99, but could be anything less
      than or equal to one. One is heavy discouraged, due to the
      extreme outliers inflating the variance.
  
  Returns
  -------
  OaxacaResults
      A results container for the two-fold decomposition.
docstr_tok: ["Calculates","the","two-fold","or","pooled","Oaxaca","Blinder","Decompositions","Methods","--","--","--","-","std",":","boolean",",","optional","If","true",",","bootstrapped","standard","errors","will","be","calculated",".","two_fold_type",":","string",",","optional","This","method","allows","for","the","specific","calculation","of","the","non-discriminatory","model",".","There","are","four","different","types","available","at","this","time",".","pooled",",","cotton",",","reimers",",","self_submitted",".","Pooled","is","assumed","and","if","a","non-viable","parameter","is","given",",","pooled","will","be","ran",".","pooled","-","This","type","assumes","that","the","pooled","model","'s","parameters","(","a","normal","regression",")","is","the","non-discriminatory","model",".","This","includes","the","indicator","variable",".","This","is","generally","the","best","idea",".","If","you","have","economic","justification","for","using","others",",","then","use","others",".","nuemark","-","This","is","similar","to","the","pooled","type",",","but","the","regression","is","not","done","including","the","indicator","variable",".","cotton","-","This","type","uses","the","adjusted","in","Cotton","(","1988",")",",","which","accounts","for","the","undervaluation","of","one","group","causing","the","overevalution","of","another",".","It","uses","the","sample","size","weights","for","a","linear","combination","of","the","two","model","parameters","reimers","-","This","type","uses","a","linear","combination","of","the","two","models","with","both","parameters","being","50","%","of","the","non-discriminatory","model",".","self_submitted","-","This","allows","the","user","to","submit","their","own","weights",".","Please","be","sure","to","put","the","weight","of","the","larger","mean","group","only",".","This","should","be","submitted","in","the","submitted_weights","variable",".","submitted_weight",":","int\/float",",","required","only","for","self_submitted",",","This","is","the","submitted","weight","for","the","larger","mean",".","If","the","weight","for","the","larger","mean","is","p",",","then","the","weight","for","the","other","mean","is","1-p.","Only","submit","the","first","value",".","n",":","int",",","optional","A","amount","of","iterations","to","calculate","the","bootstrapped","standard","errors",".","This","defaults","to","5000.","conf",":","float",",","optional","This","is","the","confidence","required","for","the","standard","error","calculation",".","Defaults","to",".99",",","but","could","be","anything","less","than","or","equal","to","one",".","One","is","heavy","discouraged",",","due","to","the","extreme","outliers","inflating","the","variance",".","Returns","--","--","--","-","OaxacaResults","A","results","container","for","the","two-fold","decomposition","."]
code: def two_fold(
      self,
      std=False,
      two_fold_type="pooled",
      submitted_weight=None,
      n=None,
      conf=None,
  ):
      """
      Calculates the two-fold or pooled Oaxaca Blinder Decompositions
  
      Methods
      -------
      std: boolean, optional
          If true, bootstrapped standard errors will be calculated.
  
      two_fold_type: string, optional
          This method allows for the specific calculation of the
          non-discriminatory model. There are four different types
          available at this time. pooled, cotton, reimers, self_submitted.
          Pooled is assumed and if a non-viable parameter is given,
          pooled will be ran.
  
          pooled - This type assumes that the pooled model's parameters
          (a normal regression) is the non-discriminatory model.
          This includes the indicator variable. This is generally
          the best idea. If you have economic justification for
          using others, then use others.
  
          nuemark - This is similar to the pooled type, but the regression
          is not done including the indicator variable.
  
          cotton - This type uses the adjusted in Cotton (1988), which
          accounts for the undervaluation of one group causing the
          overevalution of another. It uses the sample size weights for
          a linear combination of the two model parameters
  
          reimers - This type uses a linear combination of the two
          models with both parameters being 50% of the
          non-discriminatory model.
  
          self_submitted - This allows the user to submit their
          own weights. Please be sure to put the weight of the larger mean
          group only. This should be submitted in the
          submitted_weights variable.
  
      submitted_weight: int/float, required only for self_submitted,
          This is the submitted weight for the larger mean. If the
          weight for the larger mean is p, then the weight for the
          other mean is 1-p. Only submit the first value.
  
      n: int, optional
          A amount of iterations to calculate the bootstrapped
          standard errors. This defaults to 5000.
      conf: float, optional
          This is the confidence required for the standard error
          calculation. Defaults to .99, but could be anything less
          than or equal to one. One is heavy discouraged, due to the
          extreme outliers inflating the variance.
  
      Returns
      -------
      OaxacaResults
          A results container for the two-fold decomposition.
      """
      self.submitted_n = n
      self.submitted_conf = conf
      std_val = None
      self.two_fold_type = two_fold_type
      self.submitted_weight = submitted_weight
  
      if two_fold_type == "cotton":
          self.t_params = (
              self.len_f
              / (self.len_f + self.len_s)
              * self._f_model.params
          ) + (
              self.len_s
              / (self.len_f + self.len_s)
              * self._s_model.params
          )
  
      elif two_fold_type == "reimers":
          self.t_params = 0.5 * (
              self._f_model.params + self._s_model.params
          )
  
      elif two_fold_type == "self_submitted":
          if submitted_weight is None:
              raise ValueError("Please submit weights")
          submitted_weight = [submitted_weight, 1 - submitted_weight]
          self.t_params = (
              submitted_weight[0] * self._f_model.params
              + submitted_weight[1] * self._s_model.params
          )
  
      elif two_fold_type == "nuemark":
          self._t_model = OLS(self.endog, self.neumark).fit(
              cov_type=self.cov_type, cov_kwds=self.cov_kwds
          )
          self.t_params = self._t_model.params
  
      else:
          self._t_model = OLS(self.endog, self.exog).fit(
              cov_type=self.cov_type, cov_kwds=self.cov_kwds
          )
          self.t_params = np.delete(
              self._t_model.params, self.bifurcate
          )
  
      self.unexplained = (
          self.exog_f_mean @ (self._f_model.params - self.t_params)
      ) + (self.exog_s_mean @ (self.t_params - self._s_model.params))
      self.explained = (
          self.exog_f_mean - self.exog_s_mean
      ) @ self.t_params
  
      if std is True:
          std_val = self.variance(2)
  
      return OaxacaResults(
          (self.unexplained, self.explained, self.gap),
          2,
          std_val=std_val,
      )
  
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 4 for calling the OaxacaBlinder obj's underlying member method code with example usage: obj.two_fold(std, two_fold_type, submitted_weight, n, conf) and returns: OaxacaResults