margin_difference: Computes observed (marginal) difference between statistics of...

View source: R/various_dec.R

margin_differenceR Documentation

Computes observed (marginal) difference between statistics of two groups (mean, quantiles, ...)

Description

Computes observed (marginal) difference between statistics of two groups (mean, quantiles, ...)

Usage

margin_difference(...)

## Default S3 method:
margin_difference(.margin_stat, ...)

Arguments

...

arguments passed to or from other methods.

.margin_stat

data frame with the marginal statistics of two groups. This is the output of function margin_mean or margin_quantile.

Examples

data(invented_wages)

r00 <- reweight_strata_all2(invented_wages, treatment = "gender",
                            variables = c("sector", "education"),
                            y = "wage", weights = "sample_weights")

m00 <- margin_mean(r00)

m00

# Difference between observed average wages of men and women
margin_difference(m00)


# An example with quantiles. In this case, the 75th percentile
q00 <- margin_quantile(r00, probs = 0.75)

q00

# Difference between observed 75th percentiles of wages of men and women
margin_difference(q00)



gibonet/decr documentation built on Jan. 5, 2024, 7:26 a.m.