3
$\begingroup$

How can I rewrite the equation $\mu = \frac{1}{N}\sum _{i=1}^Nx_i$, if I don't want to find the mean, but the median of all $x_i$, $i=1,\dots,N$?

$\endgroup$
2
  • $\begingroup$ Sorted data? Or do you have any ideas of the underlying distribution? There are approximations to the median. $\endgroup$ Commented Jan 9, 2015 at 11:23
  • $\begingroup$ Nope, neither sorted nor belonging to a particular distribution. But of course one could add a sentence like "...where $x_i$ are the values sorted in ascending order" or something similar. $\endgroup$ Commented Jan 9, 2015 at 12:27

3 Answers 3

2
$\begingroup$

After some extra research it seems there is no solution for my desire. The best bet probably is to define a function, say $m(x)$, which is defined as

$m\left(x\right) =\begin{cases} x_\frac{n+1}{2} & n\text{ odd}\\ \frac {1}{2}\left(x_{\frac{n}{2}} + x_{\frac{n}{2} + 1}\right) & n \text{ even} \end{cases} $

$\endgroup$
1
$\begingroup$

For a given sample $X_1,\ldots,X_n -$ by which I mean a collection of independent, identically distributed random variables $-$ the median of the sample is either the $\dfrac{n+1}{2}^{th}$ or $\dfrac{n}{2}^{th}$ order-statistic, depending on whether $n$ is odd or even respectively. The sample mean does not give a sufficient amount of information to uniquely determine what these order-statistics are.

$\endgroup$
4
  • $\begingroup$ I do know about this OR distinction, but I was hoping to find an equation being applicable to both cases. $\endgroup$ Commented Jan 9, 2015 at 12:29
  • $\begingroup$ @Michael, "applicable to both cases" in what sense: can you please give an analogous example of what you mean? Are you looking for a way to transform the mean, by an equation, into the median? $\endgroup$ Commented Jan 9, 2015 at 12:39
  • $\begingroup$ With both cases I referred to $n$ being odd or even. I don't want to distinguish between odd or even $n$ in a programming like if-else way, but I would simply like to write replace the formula I have used in my question (for the standard mean value) with an analogous formula for the median. $\endgroup$ Commented Jan 9, 2015 at 15:44
  • 1
    $\begingroup$ @Michael, Aah, I see; thanks for the clarification. The "or" is necessary since the sample defines a discrete distribution. That is, in an ordered sample $x_i$ of numbers, to determine the smallest of $x_i$ that is greater than or equal to half of the other numbers is necessarily an "or" in the sense outlined. Any algorithm that computes the median exactly must manifest this distinction in some form, although this does not necessarily have to be an explicit $if-else$. For example, sorting $m$ out of $n$ numbers, where "ceiling(n/2)=m" is fed into the sort routine, should suffice. $\endgroup$ Commented Jan 9, 2015 at 16:09
1
$\begingroup$

Let's start with just $3$ numbers. Unfortunately, $\mathrm{median}(a,b,c)$ is not a polynomial of $a,b,c$. (polynomial in the operations $+, \times, x^y$.)

It is a polynomial in the "lattice" operations $x \vee y$ and $x \wedge y$, however:

$$ \mathrm{median}(a,b,c) = (a \vee b) \wedge (b \vee c) \wedge (c \vee a) = (a \wedge b) \vee (b \wedge c) \vee (c \wedge a) . $$

$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.