# Cauchy Distribution Statistics – Median of the Squared Difference from the Median of a Cauchy Random Variable

cauchy distributiondispersiondistributionsmedian

# Motivation

One of the classic challenges with Cauchy random variables is that their moments are not finite, and I even recently learned that Cauchy principal values of even moments of Cauchy random variables are not finite either.

Of course among these moments are centered second moments that would have been the variance, which is one mathematical way of expressing a less precise notion of "dispersion" or "spread". I have tried to consider what other variance-like-thing we could define and compute for a Cauchy random variable, in this case based on replacing expectations with medians.

# Effort

Let's take a Cauchy random variable $$X \sim f(x;x_0, \gamma)$$ where $$\mathcal{M}[X]=x_0$$ is the median and $$\gamma$$ is a scale parameter. Consider the quantity

$$\mathcal{M}[(X – \mathcal{M}[X])^2]$$

to be the median of the square of the difference from the median of the random variable. This can be expanded to

$$\mathcal{M}[X^2 – 2X \mathcal{M}[X] + \mathcal{M}[X]^2]$$

using a distributive property. I am less certain about this next step, but my thinking is that the median should be equivariant to monotonic transformations. Assuming $$\mathcal{M}[X]$$ is a constant, I think we should have

$$\mathcal{M}[X^2] – \mathcal{M}[2X \mathcal{M}[X]] + \mathcal{M}[X]^2$$

$$\iff$$

$$\mathcal{M}[X^2] – 2\mathcal{M}[X]^2 + \mathcal{M}[X]^2$$

$$\iff$$

$$\mathcal{M}[X^2] – \mathcal{M}[X]^2$$

for which $$\mathcal{M}[X^2] \geq \mathcal{M}[X]^2$$ due to the convexity of squaring and the Jensen inequality for medians. We know we took a square at the beginning anyway, but it doesn't hurt to notice that $$\mathcal{M}[X]^2 \geq 0 \land \mathcal{M}[X^2] \geq \mathcal{M}[X]^2 \implies \mathcal{M}[X^2] – \mathcal{M}[X]^2 \geq 0.$$

Knowing that $$\mathcal{M}[X] = x_0$$, we can substitute to obtain

$$\mathcal{M}[X^2] – x_0^2$$

but it remains to determine $$\mathcal{M}[X^2]$$. If I had the distribution for $$X^2$$ I could compute the median from an integral definition. But I do not have the distribution of $$X^2$$. At first I looked to the distribution of the product of two random variables wiki page, but their general approach assumes that the product is between independent variables. I do not think I can readily assume that $$X$$ is independent from itself. I also check the relationships among probability distributions but again did not find any useful relations for squaring a Cauchy variable.

# Question

What is the median of the squared difference from the median of a Cauchy random variable?

## Monte Carlo

The following samples from a standard Cauchy distribution, and shifts its values up by 10 units. Then I computed the statistic as described in the question and plotted a histogram with 100 bins.

import matplotlib.pyplot as plt
import numpy as np

results = []
for i in range(10000):
x = np.random.standard_cauchy(size=10000) + 10
stat = np.median(np.power((x - np.median(x)),2))
results.append(stat)

plt.hist(results, bins=100)
plt.show()


The above result is consistent with the scale being invariant to translations.

Repeating the above Monte Carlo simulation but scaling the variable by three instead of shifting it by ten, I get the following histogram.

This is consistent with scaling the variable leading to a squaring of scale.

Suppose $$F$$ is the distribution function of a random variable $$X$$ with median $$m.$$

By definition, a median is any number for which $$F(m)\ge 1/2$$ and $$F(x) \le 1/2$$ for all $$x \lt m.$$

For any non-negative number $$y,$$ let

$$G(y) = F(m+y) - F(m-y) = \Pr(X \in (m-y, m+y]).$$

Clearly (by the probability axioms) $$G(0)=0$$ and $$G$$ is a nondecreasing function rising to a limiting value of $$1.$$ Consequently there is at least one $$y$$ for which $$G(y) \ge 1/2$$ and $$G(x)\le 1/2$$ for all $$x \lt y.$$

$$y^2$$ is a median of $$(X-m)^2.$$

Proof: $$\Pr((X-m)^2 \le y^2) = \Pr(|X-m| \le y) = \Pr(X \in [m-y, m+y] = G(y) \ge 1/2.$$

At the same time, if $$0 \le y-\epsilon \lt y,$$

\begin{aligned} \Pr((X-m)^2 \le (y-\epsilon)^2) &= \Pr(X \in [m-y+\epsilon, m+y-\epsilon]) \\ &\le \Pr(X \in (m-y + \epsilon/2, m+y-\epsilon/2])\\ &= G(y-\epsilon/2) \lt 1/2. \end{aligned}

Thus the definition of median is satisfied, QED.

Application:

Let $$X$$ have a Cauchy distribution. This means it has a density function

$$f_X(x) = \frac{1}{\pi}\frac{1}{1+x^2}.$$

Thus

$$\frac{1}{2} = G(y) = \frac{1}{\pi}\int_{-y}^y \frac{\mathrm{d}x}{1+x^2} = \frac{2}{\pi}\arctan(y)$$

has unique solution $$y = 1.$$ Consequently the median squared deviation from the median is $$1^2 = 1.$$

### Remarks on shifting and scaling

When you shift and scale the random variable $$X,$$ creating the new variable $$Z=\mu + \sigma X,$$ you are really just changing the units of measurement. Accordingly, the median $$m$$ becomes $$\mu + \sigma m$$ and all squared differences relative to $$m$$ are multiplied by $$\sigma^2.$$ This is why you found, when setting $$\sigma=3,$$ that the median squared difference from the median is $$3^2\times 1 = 9;$$ and when setting $$\mu=10,$$ you found the median squared difference remained $$1.$$

### Terminology

$$y$$ is called the Median Absolute Deviation from the Median, or MAD. It is a standard robust measure of dispersion.