This is the main function, computing the multi-group Kitagawa-Blinder-Oaxaca decomposition
mkbo(formula, group, w = NULL, data, group_fixed = TRUE, viewpoint = "group")An object of class "mkbo", which is a list containing:
RECIA tibble summarizing the mean outcome per group (M), mean difference from the reference (D), and contributions from endowments (E), coefficients (C), and interactions (I).
E_varA data frame detailing variable-level contributions to the endowments (E) component.
C_varA data frame detailing variable-level contributions to the coefficients (C) component.
I_varA data frame detailing variable-level contributions to the interaction (I) component.
A regression formula (as a string) specifying the outcome and explanatory variables.
A string naming the grouping variable. This variable should be a factor, and the decomposition will be performed for each level of this factor.
A string naming the variable in data that contains observation weights. If NULL, equal weights are used.
A data.frame or tibble containing the microdata. The data must not contain missing values in any of the variables used in the decomposition.
Logical. If TRUE (default), group fixed effects are included in the pooled model used to estimate the sample-level coefficients.
Character. Either "group"or "sample". Specifies the decomposition perspective:
"group": How would group outcomes change if they had the endowments/coefficient structure of the full sample?
"sample": How do group characteristics differ from the sample, and how much does this explain outcome differences?
The function performs group-wise regressions and compares them to a pooled regression model. It decomposes the differences in group means of the dependent variable into parts due to differences in observed characteristics (endowments), differences in how those characteristics translate into outcomes (coefficients), and the interaction of both.
The choice of viewpoint changes whether the decomposition is anchored on the sample or group averages, and this influences the interpretation of each component.
Group-specific coefficients are augmented with treatment contrasts to match the pooled model structure.
mkbo_output <- mkbo("PERNP ~ BACHELOR", group = "RACE", data=pums_subset)
Run the code above in your browser using DataLab