plot.oaxaca {oaxaca}R Documentation

Coefficient Bar Plots for the Blinder-Oaxaca Decomposition

Description

plot.oaxaca is used to generate a set of coefficient bar plots that present the results of a Blinder-Oaxaca decomposition graphically.

Usage

## S3 method for class 'oaxaca'
plot(x, decomposition = "threefold", type = "variables", group.weight = NULL,
     unexplained.split = FALSE, variables = NULL, components = NULL,
     component.left = FALSE, component.labels = NULL, variable.labels = NULL,
     ci = TRUE, ci.level = 0.95, 
     title = "", xlab = "", ylab = "", bar.color = NULL, ...) 

Arguments

x

an object of class "oaxaca", typically generated by the oaxaca function.

decomposition

specifies which type of decomposition will be presented. Can be either "threefold" (default) or "twofold".

type

specifies whether the results of an overall decomposition or a variable-by-variable decomposition will be presented. Can be either "variables" (default) or "overall".

group.weight

a numeric value that specifies the group weight for which the twofold decomposition results will be presented. Only relevant when argument decomposition is set to "twofold".

unexplained.split

a logical value that toggles whether, in the twofold decomposition, the presentation of the unexplained component will be split into the unexplained A and unexplained B parts. See oaxaca for details.

variables

a character vector that specifies the variables for which coefficient bar plots are requested. If NULL, plots for all variables will be produced. Only relevant when argument type is set to "variables". This argument can also be used to determine the order in which variables are presented.

components

a character vector that specifies which decomposition components will be presented. For threefold decomposition, must be a subset of "endowments", "coefficients" and "interaction". For twofold decomposition, must be a subset of "explained", "unexplained" and - if argument unexplained.split is set to TRUE - "unexplained A" and "unexplained B". This argument can also be used to determine the order in which decomposition components are presented.

component.left

a logical value that specifies whether the decomposition components will be presented along the left side of the coefficient bar plot. By default, the argument is set to FALSE, and the left side of the plot lists individual variables. Only relevant when argument type is set to "variables".

component.labels

a named character vector that specifies custom labels for individual decomposition components. The character vector elements contain the new labels, while the elements' names must correspond to the appropriate decomposition components: "endowments", "coefficients", "interaction", "explained", "unexplained", "unexplained A", "unexplained B".

variable.labels

a named character vector that specifies custom labels for the presented variables. The character vector elements contain the new labels, while the elements' names must contain the appropriate variable name. Only relevant when argument type is set to "variables".

ci

a logical value that toggles the presentation of confidence intervals (standard error bars) in the coefficient bar plots.

ci.level

a numeric value between 0 and 1 that specifies the confidence level for the presented confidence intervals.

title

a character string that contains the title of the coefficient bar plot.

xlab

a character string that specifies the horizontal axis label.

ylab

a character string that specifies the vertical axis label.

bar.color

a named vector that specifies the color of bars in the plot. The vector elements' names contain a string that identifies either the variable or the decomposition component that the color will be applied to. If no names are specifies, the bars will be colored from top to bottom.

...

additional arguments passed on to the aesthetic mapping (aes) of the ggplot function (Wickham, 2009) used to generate the coefficient bar plots inside the method.

Please cite as:

Hlavac, Marek (2022). oaxaca: Blinder-Oaxaca Decomposition in R.
R package version 0.1.5. https://CRAN.R-project.org/package=oaxaca

Author(s)

Dr. Marek Hlavac < mhlavac at alumni.princeton.edu >
Social Policy Institute, Bratislava, Slovakia

References

Wickham, Hadley. (2009). ggplot2: Elegant Graphics for Data Analysis. Springer Science & Business Media.

See Also

oaxaca

Examples

# set random seed
set.seed(08544)

# load data set of Hispanic workers in Chicago
data("chicago")

# perform Blinder-Oaxaca Decomposition:
# explain differences in log real wages across native and foreign-born groups
oaxaca.results <- oaxaca(ln.real.wage ~ age + female + LTHS + some.college + 
                                          college + advanced.degree | foreign.born, 
                         data = chicago, R = 50)

# plot results of the threefold decomposition, variable-by-variable
# only include educational variables
# decomposition components along the left side of the plot
plot(oaxaca.results, component.left = TRUE,
     variables = c("LTHS", "some.college", "college", "advanced.degree"),
     variable.labels = c("LTHS" = "less than high school", 
                         "some.college" = "some college",
                         "advanced.degree" = "advanced degree"))
                         
# plot results of the twofold decomposition (overall results)
# equal weight for Group A and B in reference coefficient determinantion (weight = 0.5)
# unexplained portion split into A and B
plot(oaxaca.results, decomposition = "twofold", type = "overall",
     group.weight = 0.5, unexplained.split = TRUE, 
     bar.color = c("limegreen", "hotpink", "steelblue"))


[Package oaxaca version 0.1.5 Index]