Estimates one or more quantile-based inequality indicators simultaneously — QRI, quantile-based share ratio (QSR, Palma, or custom), percentile ratio — together with the Gini coefficient as a widely used benchmark. When standard errors are requested, all indicators are evaluated on the same bootstrap replicates, ensuring full comparability.
Usage
inequantiles(
y,
weights = NULL,
indicators = "all",
se = FALSE,
type = 6,
na.rm = TRUE,
M = 100,
B = 200,
seed = NULL,
data = NULL,
strata = NULL,
psu = NULL,
N_h = NULL,
m_h = NULL,
verbose = TRUE
)
# S3 method for class 'inequantiles'
print(x, digits = 4, ...)Arguments
- y
A numeric vector of strictly positive values (e.g. income, wealth, expenditure).
- weights
A numeric vector of sampling weights. If
NULL, all observations are equally weighted.- indicators
Character vector specifying which indicators to compute. Use
"all"(default) for all, or any subset of"qri","qsr","palma","ratio_quantiles","gini"."qsr"(quintile share ratio) and"palma"(Palma index) are special cases ofshare_ratio."ratio_quantiles"computes the P90/P10.- se
Logical; if
TRUE, standard errors are estimated via the rescaled bootstrap; seerescaled_bootstrap. Requiresdataandstrata(see below).- type
Quantile estimation type: integer
4–9or"HD"for Harrell–Davis (default:6). Seecsquantile.- na.rm
Logical; remove missing values before computing? Default:
TRUE.- M
Integer; number of quantile-ratio grid points for the QRI (default:
100). Only used when the QRI is estimated; seeqri.- B
Integer; number of bootstrap replicates (default:
200). Only used whense = TRUE.- seed
Integer; random seed for reproducibility. Only used when
se = TRUE.- data
A data frame containing the survey design variables (strata, PSU). Required when
se = TRUE.- strata
Character string; name of the stratification column in
data. Required whense = TRUE.- psu
Character string; name of the PSU column in
data. Required for two-stage complex designs.- N_h
Optional named numeric vector of stratum population sizes for the finite population correction. See
rescaled_bootstrap.- m_h
Optional vector of bootstrap sample sizes per stratum. Defaults to the Rao-Wu formula. See
rescaled_bootstrap.- verbose
Logical; if
TRUE(default), displays a progress bar during bootstrap iterations.- x
An object of class
"inequantiles".- digits
Integer; number of decimal places for rounding (default:
4).- ...
Further arguments passed to or from other methods.
Value
A list with components:
- estimates
Numeric vector of point estimates of inequality indicators.
- se
Numeric vector of standard errors, or
NULLwhense = FALSE.- B
Number of bootstrap replicates used, or
NULL.- design
Sampling design type detected by the bootstrap, or
NULLwhense = FALSE.- call
The matched function call.
The argument x, invisibly.
Details
All quantile-based indicators are computed from the same specified
csquantile type. When se = TRUE, a single
bootstrap loop is run through the rescaled bootstrap method
(see rescaled_bootstrap) and all indicators are evaluated on
each replicate, so standard errors are based on identical resamples and are
directly comparable.
The Gini coefficient is estimated following (Langel and Tillé 2013) , equation 6, using a weighted formula based on cumulative weight sums.
See also
qri, share_ratio,
ratio_quantiles, rescaled_bootstrap
Other inequality indicators based on quantiles:
plot_inequality_curve(),
qri(),
ratio_quantiles(),
share_ratio(),
superpop_qri()
Examples
data(synthouse)
eq <- synthouse$eq_income
w <- synthouse$weight
# Point estimates only
inequantiles(eq, weights = w)
#> Quantile-based inequality indicators
#> -------------------------------------
#> Estimate
#> qri 0.5691
#> qsr 7.0161
#> palma 1.5787
#> p90p10 5.9206
#> gini 0.3715
# Subset of indicators
inequantiles(eq, weights = w, indicators = c("qri", "palma"))
#> Quantile-based inequality indicators
#> -------------------------------------
#> Estimate
#> qri 0.5691
#> palma 1.5787
# \donttest{
# With bootstrap standard errors (complex design)
inequantiles(eq, weights = w,
se = TRUE, B = 50, seed = 42,
data = synthouse, strata = "NUTS2",
psu = "municipality",
verbose = FALSE)
#> Quantile-based inequality indicators
#> -------------------------------------
#> Estimate SE
#> qri 0.5691 0.0046
#> qsr 7.0161 0.1757
#> palma 1.5787 0.0387
#> p90p10 5.9206 0.1638
#> gini 0.3715 0.0043
#>
#> Bootstrap replicates: 50
# }