oaxbd
Oaxaca-Blinder decomposition of a gap between two groups
oaxbd(y, x, grp, ref = 1, conf = 0.95)Splits the gap in mean outcome between two groups (a sentence length between two groups of defendants, say) into the part their covariates’ means account for and the part they do not, by least squares in each group (Oaxaca 1973; Blinder 1973), with delta-method standard errors (Jann 2008).
Parameters
Section titled “Parameters”yThe outcomes: finite numbers, one per case.
xThe covariates:
NULL(the constant only), a numeric vector, a numeric matrix with one row per case, or a data frame of numeric columns; a constant is added. Factors are refused: code them as indicator columns.grpThe group of each case: labels, exactly two groups, each with more cases than coefficients.
refGroup B, whose coefficients price the explained part of the first decomposition: its label, or its position from 1 among the two (in the order of
grp); the other is group A.confThe confidence level of the intervals, strictly between 0 and 1.
Returns
Section titled “Returns”A list: groups, the labels of a and b; means, a data
frame with one row per term (const first): term, a, b; coef:
term, a, ase, b, bse; dec, one row per part (gap, exp,
unexp, expa, unexpa, endow, coef, inter): part, est,
se and the normal interval lo, hi; by: term, exp, expse,
unexp, unexpse and shift.
With D the difference of the covariate means (group A minus group B,
the constant first) and Delta the difference of the coefficients, the
gap is exactly D'b_B + xbar_A'Delta (explained at B’s coefficients,
exp, and unexplained, unexp), and equally D'b_A + xbar_B'Delta
(expa, unexpa), and D'b_B + xbar_B'Delta + D'Delta (endowments,
coefficients and their interaction). The two explained parts differ by
exactly the interaction, so how much of a gap is “explained” depends on
which group’s coefficients are taken as the standard: oaxbd() reports
both. by splits the first decomposition by covariate; its unexplained
lines are not identified one by one: moving a covariate’s origin by c
for everyone moves c times its shift between that line and the
constant’s, leaving the total alone (Oaxaca and Ransom 1999), and for a
factor coded as indicators the split depends on the category left out.
See proof("oaxbd").
The standard errors treat the two groups, and the means and coefficients within each, as independent, and leave out a term of smaller order, as Jann (2008) does. The unexplained part is what the model’s covariates do not account for. It is not a measure of discrimination: it holds every influence the covariates miss, and the covariates can themselves carry earlier unequal treatment.
References
Section titled “References”Oaxaca, R. (1973). Male-female wage differentials in urban labor markets. International Economic Review, 14(3), 693-709. doi:10.2307/2525981
Blinder, A. S. (1973). Wage discrimination: reduced form and structural estimates. Journal of Human Resources, 8(4), 436-455. doi:10.2307/144855
Oaxaca, R. L. and Ransom, M. R. (1999). Identification in detailed wage decompositions. Review of Economics and Statistics, 81(1), 154-157. doi:10.1162/003465399767923908
Jann, B. (2008). The Blinder-Oaxaca decomposition for linear regression models. The Stata Journal, 8(4), 453-479. doi:10.1177/1536867X0800800401
Examples
Section titled “Examples”set.seed(3)g <- rep(c("a", "b"), each = 200)sev <- rnorm(400, ifelse(g == "a", 5, 4))pri <- rpois(400, ifelse(g == "a", 2, 1))len <- 2 + 0.8 * sev + 0.5 * pri + ifelse(g == "a", 1, 0) + rnorm(400)r <- oaxbd(len, data.frame(sev, pri), g, ref = "b")r$decAlso in the R reference, with the method and its source.