View source: R/weighted.median.R
weighted.median | R Documentation |
Compute the lower weighted median of a specified vector. The weighted median is considered to be the value where the sum of probabilities of order values is equals to half of the total sum of all probabilities.
weighted.median(v, weights)
v |
a |
weights |
a |
a double
which is the weighted median of the vector.
Alexander Krasnitz, Guoli Sun
## Vector of values values <- c(0.06363411, 0.04342896, 0.07207384, 0.07319237, 0.07273546, 0.01463932, 0.02136043, 0.01967027) ## Vector of weight associated to each value weight <- c(1, 1, 1, 1, 0, 0, 0, 0) ## Calculation of the weighted median CNprep:::weighted.median(v=values, weights=weight)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.