Description Usage Arguments Details Value See Also Examples
Compute a weighted median of a numeric vector.
1 | weighted.median(x, w, na.rm = FALSE)
|
x |
a numeric vector containing the values whose mean is to be computed. |
w |
a vector of weights the same length as |
na.rm |
a logical value indicating whether |
If w
is missing then all elements of x
are
given the same weight.
Missing values in w
are not handled.
The weighted median is the median of the discrete distribution with
values given by x
and probabilities given by w/sum(w)
.
numeric value giving the weighted median
1 2 3 4 | ## GPA from Siegel 1994
wt <- c(5, 5, 4, 1)/15
x <- c(3.7,3.3,3.5,2.8)
xm <- weighted.median(x,wt)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.