# How to get weighted median where $w_i$ is real?

I'm trying to get what Friedman's meant with "is the weighted median with weights wi", I know if $$w_i$$ is natural number I should to replicate each observation $$w_i$$ times and calculate the median of new sample with replicated values but i dont have any idea what i should do if $$w_i \in \Re$$. The unweighted empirical CDF is $$\mathbb{F}(x)=\frac{1}{n}\sum_{i=1}^n I(x_i\leq x)$$ and the weighted version is $$\mathbb{F}_w(x)=\frac{1}{n_w}\sum_{i=1}^n w_iI(x_i\leq x)$$ where $$n_w=\sum_i w_i$$
The unweighted median is where the graph of $$\mathbb{F}(x)$$ crosses $$y=1/2$$; the weighted median is where that happens for $$\mathbb{F}_w(x)$$. And, finally, that gives the definition of the weighted median as the smallest number $$m$$ such that $$\sum_{x_i\leq m} w_i \geq \frac{n_w}{2}$$
• Is it shouldn't be $\sum_{x_i\leq m}w_i\leq n_w/2$? If you know any book or article that defines weighted median like this please tell me I would like look through on them. May 23, 2021 at 19:44
• You could use the largest $m$ such that the sum is less than or equal. As usual, there's more than one way to define the median. THere's the wiki page and its references (en.wikipedia.org/wiki/Weighted_median) and the usual survey-sampling references is Woodruff RS (1952) Confidence intervals for medians and other position measures. JASA 57, 622-627. May 23, 2021 at 22:23
• @thomas_lumley Vazler et al. (2012) define as follows: $u$ is any weighted median if $\sum_{y_i<u} w_i\leq n_w/2$ and $\sum_{y_i>u} w_i\leq n_w/2$ that is $u$ the data split weight data in a half. Are both approaches equivalent? May 23, 2021 at 23:46