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

weighted_median

Weighted Median


Description

Calculates weighted median. For odd sample sizes consistent with unweighted quantiles.

Usage

weighted_median(x, w = NULL, ...)

Arguments

x

Numeric vector.

w

Optional non-negative case weights.

...

Further arguments passed to weighted_quantile.

See Also

Examples

n <- 21
x <- seq_len(n)
quantile(x, probs = 0.5)
weighted_median(x, w = rep(1, n))
weighted_median(x, w = x)
quantile(rep(x, x), probs = 0.5)

MetricsWeighted

Weighted Metrics, Scoring Functions and Performance Measures for Machine Learning

v0.5.2
GPL (>= 2)
Authors
Michael Mayer [aut, cre, cph], Christian Lorentzen [ctb, rev]
Initial release
2021-04-16

We don't support your browser anymore

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