2

Is it possible to find an example of two samples each of size 5 which have equal mean and equal variance but distinct median?

I thought about this for a while but have not been successful in coming up with such an example, so I believe the answer Is no, but I don't know why.

Stiven G
  • 535
  • I think mathematically this question asks if there exists a number $n$ such that $n = \sum_{i=1}^{5} x_i^2$ for two distinct sets ${x_i}$. Kind of like the taxicab numbers – John Lou Aug 27 '19 at 19:01
  • @John Lou Yes for your first sentence. But the connection with Ramanujan's taxicab numbers is tenuous... – Jean Marie Aug 28 '19 at 09:10
  • @JeanMarie True, at first I thought it was only natural numbers, thus the similarity. – John Lou Aug 29 '19 at 18:08

2 Answers2

4

Yes, but it's weird. It's particularly simple when your mean is $0,$ and from there you can just add whatever mean you want.

Start with a sample that has a mean of zero that is constructed as follows:

$$\mathbf{A} = (-a,-b,\alpha, \beta, a),$$

where $\alpha + \beta = b$. This ensures that the mean is zero.

Create another sample:

$$\mathbf{B} = (-a-\gamma,-b_1,\alpha_1, \beta_1, a+\gamma),$$

where $\alpha_1+\beta_1 = b_1$, and you may or may not choose $b\ne b_1$, although you must have $\alpha\not=\alpha_1,$ and $\gamma$ is chosen so that the variance is the same. We would have the following equations to solve for $\gamma, b_1, \alpha_1,$ and $\beta_1:$ \begin{align*} \alpha_1+\beta_1&=b_1\\ a^2+b^2+\alpha^2+\beta^2+a^2&=(a+\gamma)^2+b_1^2+\alpha_1^2+\beta_1^2+(a+\gamma)^2. \end{align*} Simplifying these equations yields \begin{align*} \alpha_1+\beta_1&=b_1\\ 2a^2+b^2+\alpha^2+\beta^2&=2(a+\gamma)^2+b_1^2+\alpha_1^2+\beta_1^2\\ 2a^2+b^2+\alpha^2+\beta^2&=2a^2+4a\gamma+2\gamma^2+(\alpha_1+\beta_1)^2+\alpha_1^2+\beta_1^2\\ b^2+\alpha^2+\beta^2&=4a\gamma+2\gamma^2+\alpha_1^2+2\alpha_1\beta_1+\beta_1^2+\alpha_1^2+\beta_1^2\\ b^2+\alpha^2+\beta^2&=4a\gamma+2\gamma^2+2\alpha_1^2+2\alpha_1\beta_1+2\beta_1^2. \end{align*} This is a single equation with three unknowns, each of which $(\gamma,\alpha_1,\beta_1)$ occurs quadratically. Therefore, you could simply choose two of them, and solve for the third using the quadratic formula.

An example:

\begin{align*} \mathbf{A} &= (-1,-0.9,0.1,0.8,1)\\ \mathbf{B} &= (-1.058, -0.8, 0.05, 0.75, 1.0580) \end{align*}

These two have the same mean (zero), different medians (0.1 and 0.05), and similar enough variances given the number of decimal places (I obtained these through MATLAB), although you can probably refine it if you work through the algebra.

Adrian Keister
  • 10,099
  • 13
  • 30
  • 43
2

Here are two simple "almost always winning" approaches.

1st approach

Consider two sets of (random) values $x_1<\cdots< x_5$ and $y_1<\cdots< y_5$.

Compute their resp. mean and standard-deviation $m_x, \sigma_x$ and $m_y, \sigma_y$.

Their normalised versions :

$$X=\dfrac{x-m_x}{\sigma_x} \ \ \text{and} \ \ Y=\dfrac{x-m_y}{\sigma_y}$$

have a common mean $0$ and a common variance $1$, but their median values are almost certainly distinct.

Numerical examples obtained with a Matlab program (see remark below):

$$-0.9609 < -0.8694 < -0.5949 < 1.0982 < 1.3270$$ $$ -0.8979 < -0.8132< -0.7285 < 1.1069 < 1.3328$$

2nd approach

Take 5 sorted numbers (e.g., integers) $x_1\leq x_2\leq x_3\leq x_4 \leq x_5$ such that $x_1+x_2+x_3+x_4+x_5=0$.

Set $a=1/\sqrt{\tfrac15(x_1^2+x_2^2+x_3^2+x_4^2+x_5^2)}$.

Then $(ax_1,ax_2,ax_3,ax_4,ax_5)$ has mean $0$ and standard-deviation $1$.

Two occurences of such distributions will have in general different medians. For example

$$-2a<-a<0<a<2a \ \ \text{with a =} \tfrac{1}{\sqrt{2}}$$

$$-6b<0<b<2b<3b \ \ \text{with b =} \tfrac{1}{\sqrt{10}} $$

(median values $0$ and $b\approx 0.316$.)

Remark : Caveat... Matlab gives "experimental" variance (unbiased estimator) instead of exact variance : thus you have to "twist" it by asking $(4/5)*var(x)$. Similar problem with the median : median(x) takes the mean of the two mid-values (!)...

Jean Marie
  • 81,803