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$.
1 Answer
The easiest way to think about this is via the cumulative distribution function, because it's all just means and weighted sums are easy.
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}$$
-
$\begingroup$ 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. $\endgroup$ May 23, 2021 at 19:44
-
$\begingroup$ 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. $\endgroup$ May 23, 2021 at 22:23
-
$\begingroup$ @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? $\endgroup$ May 23, 2021 at 23:46
-
$\begingroup$ No, like the choices of how to define an unweighted median they differ, but by an amount that's small compared to the standard error. $\endgroup$ May 23, 2021 at 23:51