*! version 2.3 Nov 2020
help oaxaca_rif

Title

oaxaca_rif -- Recentered influence
function decomposition: Oaxaca-Blinder
decomposition of outcome distributional differences

Syntax

oaxaca_rif depvar [indepvars] [if] [in] [weight],
by(groupvar)
rif(RIF_options)
[options]

where indepvars is term [term ...]
with term as varlist or
([name:] varlist)
and varlist may contain
normalize(spec)

options

* by(groupvar) specify the groups for decomposition

* rif(RIF_options) specify the statistic used as outcome;
see rifvar() for details on options

relax do not stop when zero variance coefficients are encountered

noisily display model estimation output

swap swap groups for the estimation of the wage differential

wgt(#) define the counterfactual for the two-fold decomposition; default is wgt(0); for the reweighted decomposition,
# can be only the value 0 or 1

scale(real) specify a value to rescale the recentered influence
function (RIF) statistic; default is scale(1) (no rescaling)

cluster(varname) specify a variable to be used as cluster

robust specify using robust standard errors

retain(newvar) specify a new variable where the generated RIF
will be stored; for the reweighted decomposition, this option
does not store the RIF for the counterfactual

replace when retain() is specified, replaces the values of
the variable declared in retain(newvar) if it already exists

s2var(varlist) request the inclusion of centered
squared parameters ^2 of all variables in varlist to be included in
the model specification; this helps to control for differences in
mean characteristics and also for differences in variance

rwlogit(varlist) specify the logit regression for the
estimation of the reweighting factors; default is no reweight

rwprobit(varlist) specify the probit regression for the
estimation of the reweighting factors; default is no reweight

iseed(str) create replicable results with rank-dependent indices

nose suppress computation of standard errors.

old This option request using the older rifvar function (for replication purposes).

aweights, fweights, iweights, and pweights are allowed;
see weight.

* by() and rif() are required.

Description

oaxaca_rif is a wrapper command that uses the capabilities of
oaxaca to compute the standard and reweighted Oaxaca-Blinder (OB)
decompositions using RIFs as outcome variables of various distributional
statistics including the mean, quantiles, and Gini coefficient, among others.
See rifvar() for a full list of all statistics currently
permitted.

The current version has changed some of the component names for easier access.
However, the older command is still available under the name oaxaca_rif_old.

OB decompositions are often used to analyze average outcome gaps over two
groups. In combination with RIFs, they can be used to analyze outcome
decompositions of any distributional statistic for which a RIF can be
calculated (Firpo, Fortin, and Lemieux 2018).

depvar is the outcome variable of interest (for example, log wages), and
indepvars are predictors (for example, education and work experience).
groupvar identifies the groups to be compared.
rif(RIF_options) is used to define the RIF function to be used in the
decomposition. The default is to estimate the standard OB decomposition. When
the option rwlogit() or rwprobit() is used, it estimates the
reweighted OB decomposition as described in Firpo, Fortin, and Lemieux (2018).

By default, The standard errors of the decomposition components are computed using the delta method
and take into account the variability induced by stochastic regressors. For methods and formulas, see Jann (2008).
One may also request clustered standard errors cluster(), possibly at the individual level,
or robust standard errors.

Firpo, Fortin, and Lemieux (2018) suggest to estimate standard errors using
bootstrap methods because of the additional complication of estimating
regressions that rely on predicted inverse probability weights in addition to
the estimations of the RIF.

oaxaca_rif typed without arguments replays the last results.

Aggregated and normalized results for sets of variables

Thanks to the capabilities of oaxaca, decomposition results can be
aggregated for subsets of variables and normalized for a set of categorical
variables.

Options

by(groupvar) specifies the groupvar that defines the two groups to
be compared. by() is required. While the variable itself can contain
multiple groups, it should identify only two groups within the sample used in
the data.

rif(RIF_options) specifies the
RIF to be estimated and used for the decomposition. rif() is required.

See rifvar() for the most current list of all statistics for
which RIF can be estimated, and see Rios-Avila (2019) for a detailed list of
the formulas used for analysis.

relax enables the estimation of the OB decomposition even if there are
zero variance coefficients in the model. This typically happens when
explanatory variables in the outcome model specification are dropped because
of collinearity for one of the two groups in the model.

noisily displays the intermediate steps of the model estimation. This
is useful to identify bugs in the estimation process.

swap reverses the order of the groups for the estimation of the
distribution gaps.

wgt(#) is similar to oaxaca's option weight(). It
requests to compute the two-fold decomposition, where # is the weight
given to group 1 relative to group 2. This is used to determine the
counterfactual scenario for the decomposition. One can specify only
wgt(0) or wgt(1). When the standard OB decomposition is done (no
reweights), wgt(0) indicates the counterfactual to be X1*B2. Thus,
DX=(X1-X2)*B2 and DB=X1*(B1-B2), and vice versa.

When the reweighted OB decomposition is obtained, wgt(0) indicates the
counterfactual to be obtained by fitting the model using data for group 2
reweighted to have characteristics of distribution similar to those in group
1, and vice versa. See Rios-Avila (2019) for more specifics.

scale(real) specifies a value to rescale the RIF statistic. The default
is scale(1) (no rescaling). It is useful to facilitate the
interpretation of statistics like the Gini and Lorenz ordinates, which by
construction fall between 0 and 1.

cluster(varname) adjusts standard errors for intragroup correlation. By
default, standard errors are estimated using each individual as a cluster.

retain(newvar) specifies a new variable where the internally generated
RIF will be stored. For the reweighted decomposition, this option does not
store the RIF for the counterfactual distribution.

replace can be used in combination with retain() to replace the
values of the variable declared in retain(newvar) if it already exists.

s2var(varlist) requests the inclusion of centered squared parameters
^2 of all variables in varlist to be included in the model
specification. This helps to control for differences in mean characteristics
and for differences in variance. This is the preferred method to add centered
squared terms when using the reweighted decomposition.

rwlogit(varlist) and rwprobit(varlist) request to estimate the
reweighted OB decomposition as described in Firpo, Fortin, and Lemieux (2018).
The variables declared are used to fit a logit or probit model to estimate the
inverse probability weights for the identification of the counterfactual
distributions. Only one of the two methods is allowed. One can use the same
specification as the one in the main model or a different specification.

iseed(str) is used to create an auxiliary variable to deal with ties for
the replication of results with rank-dependent indices.

nose supresses the estimation of standard errors. This is suggested
to speed up calculations when using resampling methods like bootstrap.

RIF options

RIF_options

mean sample mean

var variance

q(#p) [kernel(kernel) bw(#)] pth quantile, where 0<#p<100;
kernel functions available are gaussian (default), epan,
epan2, biweight, cosine, parzen, rectan,
triangle, and triweight; all kernel functions available for the
command kdensity are also allowed; default for bandwidth is
the Silverman's plugin optimal bandwidth

iqr(#p1 #p2) [kernel(kernel) bw(#)] interquantile
range: q(#p2) - q(#p1), where 0<p1<=p2<100;
bw() and kernel() options are the same as for the quantile case

gini Gini inequality index

cvar coefficient of variation

std standard error

iqratio(#p1 #p2) [kernel(kernel) bw(#)] interquantile ratio:
q(#p2)/q(#p1), where 0<p1<=p2<100;
bw() and kernel() options are the same as for the quantile case

entropy(#a) entropy inequality index with sensitivity index
#a

atkin(#e) Atkinson inequality index with inequality aversion
#e>0

logvar logarithmic variance (different from variance of logarithms)

glor(#p) generalized Lorenz ordinate at #p, where
0<#p<100

lor(#p) Lorenz ordinate at #p, with 0<#p<100

ucs(#p) share of income held by richest 1-p%; 1-lor(#p)

iqsr(#p1 #p2) interquantile share ratio:
(1-lor(#p2))/lor(#p1), where 0<#p1<=#p2<100

mcs(#p1 #p2) share of income held by people between #p1
and #p2: lor(#p2)-lor(#p1), where 0<#p1<#p2<100; also known as P_shares

pov(#a) pline(#|varname) Foster-Greer-Thorbecke poverty measure
with sensitivity parameter #a>=0 and poverty line defined by
pline(); pline() can be a single number or a variable

watts(#povline) Watts poverty index; requires a number or variable to define the poverty line

sen(#povline) Sen poverty index; requires a number to define the poverty line

tip(#p) pline(#) three I's of poverty (TIP) curve ordinate at
#p for poverty line defined by pline(#), where 0<#p<100

agini absolute Gini

acindex(varname) absolute concentration index using varname as the rank variable

cindex(varname) concentration index using varname as the rank variable

eindex(varname) lb(#) ub(#) Erreygers's index using
varname as the rank variable, with lower bound lb() and upper
bound ub()
and where lb()<ub()

arcindex(varname) lb(#) attainment relative concentration index
using varname as the rank variable, with lower bound lb()

srindex(varname) ub(#) shortfall relative concentration index
using varname as the rank variable, with upper bound ub()

windex(varname) lb(#) ub(#) Wagstaff concentration index using
varname as the rank variable, with lower bound lb() and upper
bound ub()
and where lb()<ub()

rifown(str) rifopt(str) these options are added to enable
rifvar() to use other community-contributed programs to estimate RIF for statistics not available in this list

Examples

. use http://fmwww.bc.edu/RePEc/bocode/o/oaxaca.dta

Verify you have the latest oaxaca install on your computer. Older
versions have problems with the robust option.

. ssc install oaxaca, replace

. generate wage=exp(lnwage)

Standard OB decomposition.

. oaxaca lnwage educ exper tenure, by(female) weight(1) robust

Standard RIF-OB decomposition.

. oaxaca_rif lnwage educ exper tenure, by(female) wgt(1) rif(mean)

Standard OB decomposition with weights.

. oaxaca lnwage educ exper tenure [pw=wt], by(female) weight(1) robust

Standard RIF-OB decomposition with weights.

. oaxaca_rif lnwage educ exper tenure [pw=wt], by(female) wgt(1) rif(mean)

Standard RIF-q(50)-OB decomposition.

. oaxaca_rif lnwage educ exper tenure, by(female) wgt(1) rif(q(50))

Standard RIF-iqr(25 75)-OB decomposition.

. oaxaca_rif lnwage educ exper tenure, by(female) wgt(1) rif(iqr(25 75))

Standard RIF-Gini-OB decomposition.

. oaxaca_rif wage educ exper tenure, by(female) wgt(1) rif(gini)

Reweighted RIF-OB decomposition.

. oaxaca_rif lnwage educ exper tenure, by(female) wgt(1) rif(mean) rwlogit(educ exper tenure)

Reweighted RIF-OB decomposition with weights.

. oaxaca_rif lnwage educ exper tenure [pw=wt], by(female) wgt(1) rif(mean) rwlogit(educ exper tenure)

Reweighted RIF-OB decomposition with weights with centered squared terms.

. oaxaca_rif lnwage educ exper tenure [pw=wt], by(female) wgt(1) rif(mean) rwlogit(educ exper tenure) s2var(educ exper tenure)

Reweighted RIF-q(50)-OB decomposition.

. oaxaca_rif lnwage educ exper tenure, by(female) wgt(1) rif(q(50)) rwlogit(educ exper tenure)

Reweighted RIF-iqr(25 75)-OB decomposition.

. oaxaca_rif lnwage educ exper tenure, by(female) wgt(1) rif(iqr(25 75)) rwlogit(educ exper tenure)

Reweighted RIF-Gini-OB decomposition.

. oaxaca_rif wage educ exper tenure, by(female) wgt(1) rif(gini) rwlogit(educ exper tenure)

Reweighted RIF-Gini-OB decomposition with bootstrap errors.

. bootstrap: oaxaca_rif wage educ exper tenure, by(female) wgt(1) rif(gini) rwlogit(educ exper tenure)

Using variable aggregation and normalization options with oaxaca_rif
without aggregation.

. oaxaca_rif lnwage age educ exper tenure, by(female) wgt(1) rif(q(25))

Aggregating the results from experience and tenure.

. oaxaca_rif lnwage age educ (exper_tenure:exper tenure), by(female) wgt(1) rif(q(25))

Decomposition with normalization of multiple categorical variables.

. oaxaca_rif lnwage age educ normalize(single married divorced), by(female) wgt(1) rif(q(25))

Decomposition without normalization.

. oaxaca_rif lnwage age educ married divorced, by(female) wgt(1) rif(q(25))

Using the community-contributed RIF function. Be sure to have the program
_ghvar.ado in the right folder. This estimates the half-variance. See
the structure of _ghvar.ado as a template.

. oaxaca_rif lnwage age educ exper tenure, by(female) wgt(1) rif(rifown(hvar) rifopt(hvn))

. oaxaca_rif lnwage age educ exper tenure, by(female) wgt(1) rif(rifown(hvar) rifopt(hvp))

Bootstrap accounting for Survey design Bootstrap. It uses the official prefix svy:

. use http://www.stata-press.com/data/r11/nhanes2brr

. gen bmi=weight/(height/100)^2

Bootstrap using survey design for decomposition of means. The second supresses Standard errors for faster bootstrapping:

. svy:oaxaca_rif bmi age black orace region2 region3 region4 , by(female) rif(mean)

. svy:oaxaca_rif bmi age black orace region2 region3 region4 , by(female) rif(mean) nose

Bootstrap using survey design for decomposition of 25th quantile:

. svy:oaxaca_rif bmi age black orace region2 region3 region4 , by(female) rif(q(25)) nose

Bootstrap using survey design for decomposition of 25th quantile, using reweighted decomposition :

. svy:oaxaca_rif bmi age black orace region2 region3 region4 , by(female) rif(q(25)) rwlogit(age black orace region2 region3 region4) nose

Acknowledgments

This command is based on the recommendations in Firpo, Fortin, and Lemieux
(2018) for the RIF-OB decompositions. Rios-Avila (2019) provides an intuitive
description of RIFs and their use in decomposition analysis. This command
relies on Ben Jann's (2008) community-contributed command oaxaca to
implement the decompositions.

RIF variables are estimated using the egen addon rifvar().

All errors are my own.

References

Jann, B. 2008. The Blinder-Oaxaca decomposition for linear regression models. Stata Journal 8: 453-479.

Firpo, S. P., N. M. Fortin, and T. Lemieux. 2018.
Decomposing wage distributions using recentered influence function
regressions. Econometrics 6: 28.
https://doi.org/10.3390/econometrics6020028.

Rios-Avila, F. 2020. Recentered influence functions (RIFs) in Stata: RIF regression and RIF decomposition.
Stata Journal, 20(1), 51-94. https://doi.org/10.1177/1536867X20909690.

Author

Fernando Rios-Avila

Levy Economics Institute of Bard College

Annandale-on-Hudson, NY

friosavi@levy.org

Also see

Help: oaxaca, rifvar(), rifhdreg,
rifreg, rifsureg, rifsureg2, uqreg,
hvar() (if installed)