margin_quantile: Estimates quantiles (of level probs) of y for groups A and B...

View source: R/various_dec.R

margin_quantileR Documentation

Estimates quantiles (of level probs) of y for groups A and B (marginals) and the number of observations.

Description

Estimates quantiles (of level probs) of y for groups A and B (marginals) and the number of observations.

Usage

margin_quantile(...)

## Default S3 method:
margin_quantile(
  .reweight_strata_all,
  y = NULL,
  weights = NULL,
  probs = 0.5,
  ...
)

## S3 method for class 'reweighted'
margin_quantile(.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 of length one with the desired quantile level (should be between 0 and 1).

.reweighted

an object of class reweighted (the output of reweight_strata_all4)

Value

a data frame with two rows (one for each group) and the follwing four columns:

  • the name of the treatment column used in reweight_strata_all2;

  • yhat: quantile of the y variable;

  • Nhat: estimate of the number of individuals;

  • probs: level of the estimated quantile (between 0 and 1).

Examples

data(invented_wages)

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

margin_quantile(r00, probs = 0.75)

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)

margin_quantile(r00)


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