Quantile: Weighted Quantiles

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/StatsAndCIs.r

Description

Compute weighted quantiles (Eurostat definition).

Usage

1
2
Quantile(x, weights = NULL, probs = seq(0, 1, 0.25), na.rm = FALSE,
         names = TRUE, type = 7)

Arguments

x

a numeric vector.

weights

an optional numeric vector giving the sample weights.

probs

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

na.rm

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

names

logical; if true, the result has a names attribute. Set to FALSE for speedup with many probs.

type

an integer between 1 and 9 selecting one of the nine quantile algorithms detailed below to be used. Currently only type=5 is implemented.

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

Median

Examples

1
Quantile(d.pizza$temperature, rep(c(1:3), length.out=nrow(d.pizza)))

Example output

[1] NA NA NA NA NA

DescTools documentation built on June 17, 2021, 5:12 p.m.