View source: R/reweight_strata_all.R
reweight_strata_all2 | R Documentation |
Estimates adjustment (counterfactual) weights in the common support and joins with the data. For observations out of the common support, the weights are equal to the sample weights (or one, in case of absence of sample weights).
reweight_strata_all2(data, treatment, variables, y, weights = NULL)
data |
data frame |
treatment |
column name of the binary variable |
variables |
character vector of the variables' names, for which the common support has to be established |
y |
name of the outcome variable for which you want to make the decomposition |
weights |
name of the weight variable (sample weights). If |
a data frame with the same number of rows of the starting data, with columns of the chosen treatment
, variables
, y
, weights
, common_support
(TRUE
or FALSE
), strata
(a strata
is given by a certain combination of the modalities of the variables
), adjustment factors (rw_BA
and rw_AB
), empirical joint frequencies of strata in the two groups (f_A
and f_B
) and adjustment weights (w_BA
and w_AB
), which have to be used to perform (wage) decompositions
common_support_strata2
, fhat_strata2
and
reweight_strata2
, that are used internally by this function.
For the next steps, see for example nopodec_mean
, dec_median
and dec_quantile
.
See also margin_mean
and margin_quantile
, that use the output
of this function as their input.
This function is also used in reweight_strata_all4
, whose result is an object of class
reweighted
, that is a list with 3 components: the output of fhat_strata2
(.fhat_strata
), reweight_strata2
(.reweight_strata
) and
reweight_strata_all2
(.reweight_strata_all
).
data(invented_wages)
reweight_strata_all2(invented_wages, treatment = "gender",
variables = c("sector", "education"),
y = "wage", weights = "sample_weights")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.