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? - MathOverflow most recent 30 from http://mathoverflow.net 2013-05-22T15:50:02Z http://mathoverflow.net/feeds/question/47258 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://mathoverflow.net/questions/47258/when-is-the-function-of-a-median-closer-to-the-median-of-the-function-than-the-me 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? David LeBauer 2010-11-24T19:40:46Z 2011-01-25T20:03:19Z <p><strong>Background</strong></p> <p>notation: RV= random variable, $\mu=$ mean $m=$ median</p> <p>Jensen's Inequality considers the relationship between the mean of a function of an RV and the function of the mean of an RV.</p> <p>If $f(x)$ strictly convex:</p> <p>$$\mu (f(x)) > f(\mu (x))\mathrm{\hspace{20mm}(1)}$$</p> <p>Conversely if $-f(x)$ is strictly convex: </p> <p>$$\mu (f(x)) &lt; f(\mu (x))$$</p> <p>An analogous property of the median has been presented (<a href="http://dx.doi.org/10.1016/j.spl.2004.11.010" rel="nofollow">Merkle et al 2005</a>, <a href="http://milanmerkle.com/documents/radovi/SPL-71.pdf" rel="nofollow">pdf</a>).</p> <p><strong>Motivation</strong></p> <p>I have a nonlinear <a href="http://www.esajournals.org/doi/full/10.1890/0012-9615%282001%29071%5B0557%3AAMFSVD%5D2.0.CO%3B2" rel="nofollow">function</a> <a href="http://www.oeb.harvard.edu/faculty/moorcroft/publications/publications/Moorcroft_etal_01.pdf" rel="nofollow">(pdf)</a> 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.</p> <p>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.</p> <p><strong>Question</strong> </p> <p>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?</p> <p>Specifically for what types of $f(x)$ and $x$ is</p> <p>$$|\mu (f(x)) - f(\mu (x))| > |m (f(x)) - f(m (x))|$$</p> <p><em>I previously asked this on <a href="http://stats.stackexchange.com/q/4655/1381" rel="nofollow">here</a> on stats.stackexchange.com, but after not receiving an answer, was advised to post here on MO.</em> </p> <p><strong>References</strong></p> <p><a href="http://dx.doi.org/10.1016/j.spl.2004.11.010" rel="nofollow">Merkle et al 2005 Jensen's inequality for medians. Statistics &amp; Probability Letters, Volume 71, Issue 3, 1 March 2005, Pages 277-281</a></p> http://mathoverflow.net/questions/47258/when-is-the-function-of-a-median-closer-to-the-median-of-the-function-than-the-me/47326#47326 Answer by Shai Covo for 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? Shai Covo 2010-11-25T14:14:25Z 2010-11-28T16:59:38Z <p><strong>REVISED ANSWER</strong>:</p> <p>Lemma 1. If <code>$f$</code> is not convex, then we can find a random variable <code>$X$</code> such that <code>$\mu (f(X)) - f(\mu (X)) &lt; m(f(X)) - f(m(X))$</code>. </p> <p>Proof. If <code>$f$</code> is not convex, then, by definition, there exist two points <code>$a \neq b$</code> and a <code>$p \in (0,1)$</code> such that <code>$f(pa + (1-p)b) &gt; pf(a) + (1-p)f(b)$</code>. If this inequality holds for <code>$p = 1/2$</code> but not for <code>$p = 3/4$</code>, then it also holds with <code>$p = 2/3$</code> and <code>$a$</code> replaced by <code>$3a/4 + b/4$</code>. Thus, WLOG we can assume that <code>$f(pa + (1-p)b) &gt; pf(a) + (1-p)f(b)$</code> for some <code>$a \neq b$</code> and <code>$p &gt; 1/2$</code>. Define random variable <code>$X$</code> as follows: <code>${\rm P}(X = a) = p$</code>, <code>${\rm P}(X = b) = 1-p$</code>. Then, <code>$m(X) = a$</code> and <code>$m(f(X)) = f(a)$</code>, so <code>$m(f(X)) - f(m(X)) = 0$</code>. The lemma now follows from <code>$\mu (f(X)) - f(\mu (X)) = pf(a) + (1-p)f(b) - f(pa + (1-p)b) &lt; 0$</code>.</p> <p>Lemma 2. If for some <code>$a &lt; b &lt; c$</code>, <code>$f(a) = f(c) &gt; f(b)$</code>, then we can find a random variable <code>$X$</code> such that <code>$\mu (f(X)) - f(\mu (X)) &lt; m(f(X)) - f(m(X))$</code>. </p> <p>Proof. Fix <code>$\varepsilon &gt; 0$</code> sufficiently small. Define random variable <code>$X$</code> as follows: <code>${\rm P}(X=b) = 1/2 - \varepsilon$</code>, <code>${\rm P}(X=a) = (1/2 + \varepsilon)(c - b)/(c - a)$</code>, <code>${\rm P}(X=c) = (1/2 + \varepsilon)(b - a)/(c - a)$</code>. Then, <code>$\mu(X)=m(X)=b$</code>, and <code>${\rm P}[f(X) = f(b)] = 1/2 - \varepsilon$</code>, <code>${\rm P}[f(X) = f(a)]= 1/2 + \varepsilon$</code>. The lemma now follows from <code>$\mu(f(X)) = (1/2 - \varepsilon)f(b) + (1/2 + \varepsilon)f(a) &lt; f(a) = m(f(X))$</code>.</p> <p>From Lemmas 1 and 2, we conclude:</p> <p>Corollary. The inequality <code>$\mu (f(X)) - f(\mu (X)) \geq m(f(X)) - f(m(X))$</code> holds for any (integrable) random variable <code>$X$</code> only if <code>$f$</code> is convex and monotone.</p> <p><strong>EDIT</strong>: A somewhat trivial extension of this corollary ("if part").</p> <p>Suppose that <code>$f$</code> is a strictly monotone convex function, defined on an interval <code>$I$</code> containing the range of an integrable rv <code>$X$</code>. If <code>$m(X)$</code> is unique, then so is <code>$m(f(X))$</code>, and it holds <code>$\mu (f(X)) - f(\mu (X)) \geq m(f(X)) - f(m(X)) = 0$</code>.</p> <p>Proof. By Jensen's inequality, <code>$\mu (f(X)) - f(\mu (X)) \geq 0$</code>. So, it remains to show that <code>$m(f(X)) = f(m(X))$</code>. Suppose that <code>$\tilde m \in f(I)$</code> is a median of <code>$f(X)$</code>. Then, by definition, <code>${\rm P}(f(X) \leq \tilde m) \geq 1/2$</code> and <code>${\rm P}(f(X) \geq \tilde m) \geq 1/2$</code>. Taking inverses shows that <code>$f^{-1}(\tilde m)$</code> is a median of <code>$X$</code>. Thus, <code>$f^{-1}(\tilde m) = m(X)$</code>, and the assertion follows.</p> http://mathoverflow.net/questions/47258/when-is-the-function-of-a-median-closer-to-the-median-of-the-function-than-the-me/53210#53210 Answer by Anthony Quas for 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? Anthony Quas 2011-01-25T09:18:00Z 2011-01-25T20:03:19Z <p>If $f\ $ is a monotonic function then the median value of $f(X)$ is <em>the same</em> as the function applied to the median value of $X$. <p> 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. <p> 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 <p> 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. <p> By the way, you didn't ask this, but in case you are interested in the <em>sample mean</em> and <em>sample median</em> 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.</p>