dec_quantiles: Estimates quantiles of the y variable for the two groups, in...

View source: R/various_dec.R

dec_quantilesR Documentation

Estimates quantiles of the y variable for the two groups, in and out the common support. In the common support, counterfactual quantiles of y are estimated. It also estimates the number of individuals of the two groups. Moreover, marginal quantiles of the two groups are also computed.

Description

The results in the common support are all the components necessary to perform a decomposition of the quantile wage difference between two groups, in two components: one that can be explained by the difference in the distributions of characteristics between the two groups (delta_X), and one that cannot be explained by the different characteristics of the two groups (delta_S).

Usage

dec_quantiles(...)

## Default S3 method:
dec_quantiles(
  .reweight_strata_all,
  y = NULL,
  weights = NULL,
  probs = c(0.25, 0.5, 0.75),
  ...
)

## S3 method for class 'reweighted'
dec_quantiles(.reweighted, ...)

Arguments

...

arguments passed to or from other methods.

.reweight_strata_all

output of reweight_strata_all2

y

name of the outcome variable for which you want to make the decomposition. If NULL (default), the value is inherited from the attributes of .reweight_strata_all

weights

name of the weight variable (sample weights). If NULL (default), the value is inherited from the attributes of .reweight_strata_all.

probs

numeric vector with the desired quantile levels (all the values should be between 0 and 1). Default value: c(0.25, 0.5, 0.75)

.reweighted

an object of class reweighted (the output of reweight_strata_all4)

Details

Note that this function estimates quantiles at different levels simultaneously, while dec_quantile does only one quantile level.

Value

A data frame with four, five or six rows, with the following columns:

  • the name of the treatment column used in reweight_strata_all2;

  • common_support logical indicating if in or out the common support;

  • yhat quantiles of the y variable, weighted by the given weights. This is a list where each element is a numeric vector with the estimates of the quantiles at all the levels given by the argument probs;

  • yhat_C_A counterfactual quantiles y of group A as if they had the same distribution of characteristics of group B. This is computed in the common support only and for group A individuals. It is computed with the weights w_AB that result from reweight_strata_all2. This is a list where each element is a numeric vector with the estimates of the quantiles at all the levels given by the argument probs;

  • yhat_C_B counterfactual quantiles y of group B as if they had the same distribution of characteristics of group A. This is computed in the common support only and for group B individuals. It is computed with the weights w_BA that result from reweight_strata_all2. This is a list where each element is a numeric vector with the estimates of the quantiles at all the levels given by the argument probs;

  • Nhat estimate of the number of individuals. This is a list where each element is a numeric vector of length one.

The number of rows is given by the combinations of the distinct values of the first two columns: treatment and common_support. In addition to these rows, there are two more rows at the end, with the marginal quantiles of the two groups. In the "typical" case, the resulting data frame will have 4 rows. It can have three rows if all the individuals of one group are in the common support. In case of no common support or no out-of-support, the data frame will have two rows.

Examples

data(invented_wages)

# Common support and computation of counterfactual weights
r00 <- reweight_strata_all2(invented_wages, treatment = "gender",
                       variables = c("sector", "education"),
                       y = "wage", weights = "sample_weights")

# Computation of the elements necessary to the decomposition
dec_quantiles(r00)
dec_quantiles(r00, probs = seq(0.05, 0.95, by = 0.05))

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

str(r00)
names(r00)
class(r00)

dec_quantiles(r00)


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