margin_difference | R Documentation |
Computes observed (marginal) difference between statistics of two groups (mean, quantiles, ...)
margin_difference(...)
## Default S3 method:
margin_difference(.margin_stat, ...)
... |
arguments passed to or from other methods. |
.margin_stat |
data frame with the marginal statistics of two groups. This is the output of function |
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.