*! version 1.0.0 02feb2024 Maximilian Sprengholz & Maik Hamjediers

Title

nopo postestimation -- Postestimation commands for nopo decomp

Postestimation commands

The following postestimation commands are of special interest after nopo decomp:

Command Description

nopo summarize descriptive table by group and matching/weighting status

nopo gapoverdist plotting decomposition-components over the distribution of depvar

nopo dadb plot that displays contribute to components DA and DB

Description for nopo summarize

nopo summarize [varlist] [, statistics(statnames) displayoptions]

Returns a descriptive table with selected statistics by group and matching/weighting status:
A unmatched, A matched, A^B or B^A (matched and weighted; depends on the matching direction),
B matched, and B unmatched. If no variables are specified, depvar and
varlist from nopo decomp are summarized. By default, means and standard deviations are
reported. For factor variables, the shares of factor levels are reported (indicate factors
by using factor notation in varlist of either nopo summarize or the prior nopo decomp).

Options of nopo summarize

statistics(statnames) are mean sd by default, but
you can choose any other available statnames.

displayoptions comprise:

label displays labels instead of names for variables and value labels instead of values for
factor variables.

fvpercent displays factor variable shares as percent.

fvdummies displays both dummy categories.

keepempty keeps empty columns for the unmatched. This is useful to keep the number of table
columns fixed irrespective of common support, which allows appending r(table) after matching
on various specifications.

Stored results of nopo summarize

nopo summarize stores the following in r():

Matrices

r(table) matrix of the descriptive statistics by group and matching/weighting status

r(statnames) matrix of each statistic of statistics() by group and matching/weighting status

Description of nopo gapoverdist

nopo gapoverdist [d d0 dx da db] [, options]

This command plots decomposition components based on the distribution of depvar by group and matching/weighting status
(thus, A unmatched, A matched, A^B or B^A , B matched, and B unmatched).
The same calculation is performed as in the overall decomposition,
but instead of the overall depvar means of each group, we plug in the component-and-group-specific depvar
mean for each requested quantile. Consider D0 and quartiles as an example. Here, we would take the difference
between (1) the mean wage in Q1 of the wage distribution of the matched group A and the (2) mean wage in Q1 of
the wage distribution of the matched and reweighted group B^A; repeated for each quartile. The mean of the
quantile-spcific values per component correspond to the estimates returned by nopo decomp.

Please note that the decomposition components might not add up to D within each quantile. This is usually the
case without common support, simply because the depvar distribution might vary greatly between the matched and
unmatched in each group. For example, when all units in depvar Q1 of groups A and B are matched,
D for Q1 can only be based on the depvar values of the matched; and these values would always be exceeded
by the depvar values among the unmatched (assuming there are some).

You can specify which decomposition components to plot (default are all) by explicitly calling, for example,
nopo gapoverdist d d0 dx.

Options of nopo gapoverdist

nquantiles(#) specifies the number of quantiles to be plotted. Default is 100.

recast(string) sets the twoway plottype. Default is line.

twoptsd(string), twoptsd0(string),
twoptsdx(string), twoptsda(string), and twoptsdb(string)
set subplot-specific twoway_options (should be according to specified recast()-option).

twopts(string) sets the general twoway_options.
Check the stored results of nopo gapoverdist to see defaults (e.g. r(twopts)).
You can also use the save() option to build the plot from the underlying data yourself.

xsize(real) and ysize(real) set the x and y dimensions of the plot.

nodraw specifies that the plot is not produced at all. Useful in combination with save()
to build your own plot from the data.

save(filename) saves the underlying plot data (which will be replaced if it already exists).

Stored results of nopo gapoverdist

nopo gapoverdist stores the following in r():

Scalars

r(ysize) value of option ysize() or system default (if retrievable)

r(xsize) value of option xsize() or system default (if retrievable)

Macros

r(twoptsdb) invoked options for the plot denoting component DB

r(twoptsda) invoked options for the plot denoting component DA

r(twoptsdx) invoked options for the plot denoting component DX

r(twoptsd0) invoked options for the plot denoting component D0

r(twoptsd) invoked options for the plot denoting overall gap D

r(recast) invoked option for recast()

r(twopts) invoked options for twopts()

Description for nopo dadb

nopo dadb varname [, options]

Creates a plot showing how the different levels of varname contribute to DA and DB
because these levels are associated with either many unmatched units and/or large differences in
depvar by matching status within groups A and B
(see online documentation
for details).

The bar-segments of the plot denote the difference between category-specific mean of unmatched units and
the overall mean of matched units. The scatter-markers denote the contribution of this difference to D,
which depends on the size of the difference and the number of unmatched units
in the respective category. Additionally, the number of unmatched units for each category are displayed.

Note that the output is not the same as a detailed decomposition in regression-based approaches
(which is generally not possible with matching). The "contribution" to D refers only to the
comparison between matched and varname-level-specific unmatched units among group A and
B, and is interdependent with all other characteristics of the matching set besides varname.

Options of nopo dadb

nosort specifies that the plot is not to be sorted by the mean values of depvar per level of
varname. Default is to sort in ascending order.

descending specifies that the plot is to be sorted by the mean values of depvar per level of
varname in descending order. Default is to sort in ascending order.

force skips the check for the number of levels of varname. By default, the program exits if
varname has more than 30 levels.

nmin(#) specifies the minimum number of unmatched, weighted observations per level
of varname to be plotted. Default is 1. This option is useful if, for example, a small number of
unmatched observations strongly deviate from the average value of depvar in that group, producing
large bars.

twopts(string), twoptsbar(string),
twoptsscatter(string), twoptsn(string), and
twoptsby(string) set the general, element-specific, and by-specific
twoway_options. Check the stored results of nopo dadb to see defaults
(e.g. r(twopts)). You can also use the save() option to build the plot from the
underlying data yourself.

xsize(real) and ysize(real) set the x and y dimensions of the plot.

xlabfmt(%fmt) sets the format of the x-axis labels and range. Try different
formats when the gridlines of the top and bottom x-axes do not align (or use save() to build your own graph).

nodraw specifies that the plot is not produced at all. Useful in combination with save()
to build your own plot from the data.

save(filename) saves the underlying plot data (which will be replaced if it already exists).

Stored results of nopo dadb

nopo dadb stores the following in r():

Scalars

r(ysize) value of option ysize() or computed default

r(xsize) value of option xsize() or computed default

Macros

r(twoptsby) invoked options for twoptsby()

r(twoptsn) invoked options for twoptsn()

r(twoptsscatter) invoked options for twoptsscatter()

r(twoptsbar) invoked options for twoptsbar()

r(twopts) invoked options for twopts()

Examples

Example data (click to run)

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

. for any exper tenure: gen X_c = round(X,5)

. gen educ_c = round(educ,1)

. lab var educ_c "years of educational attainment (rounded)"

. lab var exper_c "years of work experience (5-year intervalls)"

. lab var tenure_c "years of job tenure (5-year intervalls)"

. lab def female 0 "Men" 1 "Women"

. lab val female female

Example decomposition

. nopo decomp lnwage educ_c exper_c tenure_c, by(female)

Postestimation

. nopo summarize, label

. nopo summarize i.educ_c, label

. nopo gapoverdist

. nopo gapoverdist d d0

. nopo dadb tenure_c

References

Jann, B. (2017). kmatch: Stata module for multivariate-distance and propensity-score matching,
including entropy balancing, inverse probability weighting, (coarsened) exact matching, and
regression adjustment. Available from //ideas.repec.org/c/boc/bocode/s458346.html.

Ñopo, H. (2008). Matching as a Tool to Decompose Wage Gaps. The Review of Economics and Statistics, 90(2), 290–299. https://doi.org/10/b6tqwq

Acknowledgements

Special thanks to Carla Rowold for stress testing and many helpful comments.

Authors

Maximilian Sprengholz, maximilian.sprengholz@hu-berlin.de

Maik Hamjediers, maik.hamjediers@hu-berlin.de

Department of Social Sciences,

Humboldt-Universität zu Berlin