Learn R Programming

mKBO (version 0.1.0)

mkbo: Estimate the mKBO decomposition

Description

This is the main function, computing the multi-group Kitagawa-Blinder-Oaxaca decomposition

Usage

mkbo(formula, group, w = NULL, data, group_fixed = TRUE, viewpoint = "group")

Value

An object of class "mkbo", which is a list containing:

RECI

A 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_var

A data frame detailing variable-level contributions to the endowments (E) component.

C_var

A data frame detailing variable-level contributions to the coefficients (C) component.

I_var

A data frame detailing variable-level contributions to the interaction (I) component.

Arguments

formula

A regression formula (as a string) specifying the outcome and explanatory variables.

group

A string naming the grouping variable. This variable should be a factor, and the decomposition will be performed for each level of this factor.

w

A string naming the variable in data that contains observation weights. If NULL, equal weights are used.

data

A data.frame or tibble containing the microdata. The data must not contain missing values in any of the variables used in the decomposition.

group_fixed

Logical. If TRUE (default), group fixed effects are included in the pooled model used to estimate the sample-level coefficients.

viewpoint

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?

Details

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.

Examples

Run this code
mkbo_output <- mkbo("PERNP ~ BACHELOR", group = "RACE", data=pums_subset)

Run the code above in your browser using DataLab