How to calculate median via interpolation I am reading a text on data mining. I came across this formula, but I do not understand how to apply it. There aren't any examples following the forumla and my research online has produced very few results. Can someone explain how to apply this formula?


You have binned data, $k$-th bin contains $freq_k$ points, and has some width $width_k = U_k - L_k$ where $L_k$ is the lower bound for the interval, and $U_k$ is the upper bound (e.g. "\$10-20,000").

*

*Median is located at the $N/2$ point (median is a middle value of a sorted list of values).

*$\sum(freq)$ is the number of points in the bins before the middle bin. In such a case, median would be located at $\sum(freq) + \delta = N/2$ position of a sorted list of points, so $\delta = N/2 - \sum(freq)$ is how many points we are missing till hitting the median.

*$\phi = \delta \big/ freq_{median}$ translates the number of points $\delta$ into the fraction $\phi$ of the median interval. It's the number of points before median divided by the number of points in the interval.

*$L_1 + \phi \,\times\, width$ says that median is located in the $\phi \,\times width$ location of the interval, and you need to move that many units from the lower bound $L_1$ to get there. Here we're moving from counts, to the actual units (e.g. dollars, as in the example).

Try drawing this.

