**Background**


notation: RV= random variable, $\mu=$ mean $m=$ median


Jensen's Inequality considers the relationship between the mean of a function of an RV and the function of the mean of an RV.


If $f(x)$ strictly convex:


$$\mu (f(x)) > f(\mu (x))\mathrm{\hspace{20mm}(1)}$$


Conversely if $-f(x)$ is strictly convex: 


$$\mu (f(x)) < f(\mu (x))$$


An analogous property of the median has been presented ([Merkle et al 2005](http://dx.doi.org/10.1016/j.spl.2004.11.010), [pdf](http://milanmerkle.com/documents/radovi/SPL-71.pdf)).


**Motivation**


I have a nonlinear [function](http://www.esajournals.org/doi/full/10.1890/0012-9615%282001%29071%5B0557%3AAMFSVD%5D2.0.CO%3B2) [(pdf)](http://www.oeb.harvard.edu/faculty/moorcroft/publications/publications/Moorcroft_etal_01.pdf) of positive random variables, too complex to post here, not directly pertinent to this question; I am looking for a more general answer. It is worth noting that it is, however, neither strictly concave nor convex.


In practice, I find that the function of the medians provides a much better estimate of the median of the function than does the estimate of the mean of the function from the function of the means. I am interested in learning the conditions for which this is true.


**Question** 


Under what conditions will the function of a median be closer to the median of a function than the mean of a function is to a function of the mean?


Specifically for what types of $f(x)$ and $x$ is


$$|\mu (f(x)) - f(\mu (x))| > |m (f(x)) - f(m (x))|$$


*I previously asked this on [here](https://stats.stackexchange.com/q/4655/1381) on stats.stackexchange.com, but after not receiving an answer, was advised to post here on MO.* 


**References**


[Merkle et al 2005 Jensen's inequality for medians. Statistics & Probability Letters, Volume 71, Issue 3, 1 March 2005, Pages 277-281](http://dx.doi.org/10.1016/j.spl.2004.11.010)



When is the function of a median closer to the median of the function than the mean of the function is to the function of the mean?
If $f\ $ is a monotonic function then the median value of $f(X)$ is *the same* as the function applied to the median value of $X$.

If there is no monotonicity (or approximate monotonicity) you wouldn't expect them to be even close: just think of $X$ being uniformly distributed on the interval and $f(x)=|x-1/2|$ say. 

On the other hand, a reasonable condition for the mean of $f(X)$ to lie close to $f$ applied to the mean of $X$ is for $f\ $ to be close to a linear function (the same example as above shows the mean of the function being very far from the function of the mean). Of course the mean is very sensitive to extreme values of $f(X)$ whereas the median is not

In general for monotone or nearly monotone $f$, you can expect better closeness for the medians than the means. For seriously non-monotone $f$, I don't think there's anything useful you can say.

By the way, you didn't ask this, but in case you are interested in the *sample mean* and *sample median* of $f(X\_1),\ldots,f(X\_n)$ as compared to the true mean and median of $f(X)$, the first typically errs by about std dev$(f(X))/\sqrt n$, whereas the latter errs by about $(1/\sqrt{8n})/\rho(m(f(X)))$ where $\rho$ is the density function of $f(X)$ (which I'm assuming exists). This means you can do a numerical test to see which of these will be closer.










