# Expected value of sample median given the sample mean

Let $Y$ denote the median and let $\bar{X}$ denote the mean, of a random sample of size $n=2k+1$ from a distribution that is $N(\mu,\sigma^2)$. How can I compute $E(Y|\bar{X}=\bar{x})$?

Intuitively, because of the normality assumption, it makes sense to claim that $E(Y|\bar{X}=\bar{x})=\bar{x}$ and indeed that is the correct answer. Can that be shown rigorously though?

My initial thought was to approach this problem using the conditional normal distribution which is generally a known result. The problem there is that since I do not know the expected value and consequently the variance of the median, I would have to compute those using the $k+1$st order statistic. But that is very complicated and I would rather not go there unless I absolutely have to.

• I believe this is an immediate consequence of the generalization I just posted at stats.stackexchange.com/a/83887. The distribution of the residuals $x_i-\bar{x}$ clearly is symmetric about $0$, whence their median has a symmetric distribution, thus its mean is zero. Therefore the expectation of the median itself (not just of the residuals) equals $0 + E(\bar{X}\ |\ \bar{X}=\bar{x}) = \bar{x}$, QED.
– whuber
Jan 30 '14 at 17:36
• @whuber Sorry, residuals? Jan 30 '14 at 18:38
• @whuber Okay, then please correct me If I'm wrong, $E(Y|\bar{X})=E(\bar{X}|\bar{X})+E(Y-\bar{X}|\bar{X})$ And now the second term is zero because the median is symmetric around $\bar{x}$. Therefore, the expectation reduces to $\bar{x}$ Jan 30 '14 at 19:53
• But isnt this Just the Rao-Blackwell theorem? Nov 24 '14 at 23:12
• JohnK: OK, we need both Rao-Blackwell and Lehmann-Scheffe. Then the result follows immeadiately, since the median has the same expectation as the sample mean. Nov 25 '14 at 12:25

Let $X$ denote the original sample and $Z$ the random vector with entries $Z_k=X_k-\bar X$. Then $Z$ is normal centered (but its entries are not independent, as can be seen from the fact that their sum is zero with full probability). As a linear functional of $X$, the vector $(Z,\bar X)$ is normal hence the computation of its covariance matrix suffices to show that $Z$ is independent of $\bar X$.

Turning to $Y$, one sees that $Y=\bar X+T$ where $T$ is the median of $Z$. In particular, $T$ depends on $Z$ only hence $T$ is independent of $\bar X$, and the distribution of $Z$ is symmetric hence $T$ is centered.

Finally, $$E(Y\mid\bar X)=\bar X+E(T\mid\bar X)=\bar X+E(T)=\bar X.$$

• Thank you, this was asked almost a year ago and I am very glad that someone finally cleared it up. Nov 24 '14 at 11:31

The sample median is an order statistic and has a non-normal distribution, so the joint finite-sample distribution of sample median and sample mean (which has a normal distribution) would not be bivariate normal. Resorting to approximations, asymptotically the following holds (see my answer here):

$$\sqrt n\Big [\left (\begin{matrix} \bar X_n \\ Y_n \end{matrix}\right) - \left (\begin{matrix} \mu \\ \mathbb v \end{matrix}\right)\Big ] \rightarrow_{\mathbf L}\; N\Big [\left (\begin{matrix} 0 \\ 0 \end{matrix}\right) , \Sigma \Big]$$

with

$$\Sigma = \left (\begin{matrix} \sigma^2 & E\left( |X-\mathbb v|\right)\left[2f(\mathbb v)\right]^{-1} \\ E\left(|X-\mathbb v|\right)\left[2f(\mathbb v)\right]^{-1} & \left[2f(\mathbb v)\right]^{-2} \end{matrix}\right)$$

where $\bar X_n$ is the sample mean and $\mu$ the population mean, $Y_n$ is the sample median and $\mathbb v$ the population median, $f()$ is the probability density of the random variables involved and $\sigma^2$ is the variance.

So approximately for large samples, their joint distribution is bivariate normal, so we have that

$$E(Y_n \mid \bar X_n=\bar x) = \mathbb v + \rho\frac {\sigma_{\mathbb v}}{\sigma_{\bar X}}(\bar x -\mu)$$

where $\rho$ is the correlation coefficient.

Manipulating the asymptotic distribution to become the approximate large-sample joint distribution of sample mean and sample median (and not of the standardized quantities), we have $$\rho = \frac {\frac 1nE\left(|X-\mathbb v|\right)\left[2f(\mathbb v)\right]^{-1}}{\frac 1n \sigma \left[2f(\mathbb v)\right]^{-1}} = \frac {E\left(|X-\mathbb v|\right)}{\sigma }$$

So $$E(Y_n \mid \bar X_n=\bar x) = \mathbb v + \frac {E\left(|X-\mathbb v|\right)}{\sigma }\frac {\left[2f(\mathbb v)\right]^{-1}}{\sigma}(\bar x -\mu)$$

We have that $2f(\mathbb v) = 2/\sigma\sqrt{2\pi}$ due to the symmetry of the normal density so we arrive at

$$E(Y_n \mid \bar X_n=\bar x) = \mathbb v + \sqrt{\frac {\pi}{2}}E\left(\left|\frac {X-\mu}{\sigma}\right|\right)(\bar x -\mu)$$

where we have used $\mathbb v = \mu$. Now the standardized variable is a standard normal, so its absolute value is a half-normal distribution with expected value equal to $\sqrt{2/\pi}$ (since the underlying variance is unity). So

$$E(Y_n \mid \bar X_n=\bar x) = \mathbb v + \sqrt{\frac {\pi}{2}}\sqrt{\frac {2}{\pi}}(\bar x -\mu) = \mathbb v + \bar x -\mu = \bar x$$

• As always, nice answer +1. However, since we have no information about the sample size, the asymptotic distribution might not hold. If there is no way to obtain the exact distribution though, I suppose I'll have to make do. Thank you very much. Jan 30 '14 at 16:53

The answer is $\bar{x}$.

Let $x = (x_1, x_2, \ldots, x_n)$ have a multivariate distribution $F$ for which all the marginals are symmetric about a common value $\mu$. (It does not matter whether they are independent or even are identically distributed.) Define $\bar{x}$ to be the arithmetic mean of the $x_i,$ $\bar{x} = (x_1+x_2+\cdots+x_n)/n$ and write $x-\bar{x} = (x_1-\bar{x}, x_2-\bar{x}, \ldots, x_n-\bar{x})$ for the vector of residuals. The symmetry assumption on $F$ implies the distribution of $x - \bar{x}$ is symmetric about $0$; that is, when $E\subset\mathbb{R}^n$ is any event,

$${\Pr}_F(x - \bar{x}\in E) = {\Pr}_F(x - \bar{x}\in -E).$$

Applying the generalized result at https://stats.stackexchange.com/a/83887 shows that the median of $x-\bar{x}$ has a symmetric distribution about $0$. Assuming its expectation exists (which is certainly the case when the marginal distributions of the $x_i$ are Normal), that expectation has to be $0$ (because the symmetry implies it equals its own negative).

Now since subtracting the same value $\bar{x}$ from each of a set of values does not change their order, $Y$ (the median of the $x_i$) equals $\bar{x}$ plus the median of $x-\bar{x}$. Consequently its expectation conditional on $\bar{x}$ equals the expectation of $x-\bar{x}$ conditional on $\bar{x}$, plus $E(\bar{x}\ |\ \bar{x})$. The latter obviously is $\bar{x}$ whereas the former is $0$ because the unconditional expectation is $0$. Their sum is $\bar{x},$ QED.

• Thank you for posting it as a full answer. I now understand the essence of your argument but I might ping you if something is still unclear. Jan 30 '14 at 21:15
• JohnK, I need to alert you to be cautious. A counterexample to this argument has been brought to my attention. I have encouraged its originator to post it here for further discussion, but briefly it concerns a discrete bivariate distribution with symmetric marginals but asymmetric conditional marginals. Its existence points to a flawed deduction early in my argument. I currently hope that the argument might be rescued by imposing stronger conditions on the $x_i$, but my attention is presently focused elsewhere and I might not get to think about this for awhile.
– whuber
Jan 31 '14 at 14:10
• In the meantime I would encourage you to unaccept this answer. I would ordinarily delete any answer of mine known to be incorrect, but (as you might be able to tell) I like solutions based on first principles rather than detailed calculations, so I hope this argument can be rescued. I therefore intend to leave it open for criticism and improvement (and therefore made it CW); let the votes fall as they may.
– whuber
Jan 31 '14 at 14:12
• Of course, thanks for letting me know. We will discuss it further when you have time. In the meantime I will settle for the asymptotic argument proposed by @Alecos Papadopoulos. Jan 31 '14 at 14:16

This is simpler than the above answers make it. The sample mean is a complete and sufficient statistic (when the variance is known, but our results do not depend on the variance, hence will be valid also in the situation when the variance is unknown). Then the Rao-Blackwell together with the Lehmann-Scheffe theorems (see wikipedia ...) will imply that the conditional expectation of the median, given the arithmetic mean, is the unique minimum variance unbiased estimator of the expectation $\mu$. But we know that is the arithmetic mean, hence the result follows.

We did also use that the median is an unbiased estimator, which follows from symmetry.

• By symmetry $E[Y]=\mu$, indeed. Then from these two theorems we know that $E[Y|\bar{X}]$ is the Unique Minimum Variance Unbiased Estimator for $\mu$ which we already know to be equal to $\bar{X}$. This is a brilliant answer, thank you very much. I would have marked it as the correct one, had I not done that already for another answer. Nov 25 '14 at 13:41