Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

weightedQuantile

Weighted quantiles


Description

Compute weighted quantiles (Eurostat definition).

Usage

weightedQuantile(x, weights = NULL, probs = seq(0, 1, 0.25),
  sorted = FALSE, na.rm = FALSE)

Arguments

x

a numeric vector.

weights

an optional numeric vector giving the sample weights.

probs

numeric vector of probabilities with values in [0,1].

sorted

a logical indicating whether the observations in x are already sorted.

na.rm

a logical indicating whether missing values in x should be omitted.

Details

The implementation strictly follows the Eurostat definition.

Value

A numeric vector containing the weighted quantiles of values in x at probabilities probs is returned. Unlike quantile, this returns an unnamed vector.

Author(s)

Andreas Alfons and Matthias Templ

References

Working group on Statistics on Income and Living Conditions (2004) Common cross-sectional EU indicators based on EU-SILC; the gender pay gap. EU-SILC 131-rev/04, Eurostat.

See Also

Examples

data(eusilc)
weightedQuantile(eusilc$eqIncome, eusilc$rb050)

laeken

Estimation of Indicators on Social Exclusion and Poverty

v0.5.1
GPL (>= 2)
Authors
Andreas Alfons [aut, cre], Josef Holzer [aut], Matthias Templ [aut], Alexander Haider [ctb]
Initial release
2020-02-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.