# My trip to the museum with the $$\chi^2$$-test

During a recent trip to a modern art museum,
I was absolutely delighted to find that the collection contains
Robert Rauschenberg’s “White Paintings” from 1951.
To my dismay, however, I found that
one of the pictures has been hung upside down.
The security guard that yelled “You’re too close!”
couldn’t have cared less, saying “You got a screw loose buddy —
orientation means nothing with respect to the abstract.
Now get a move-on before I taze you.”
So I decided to passive-aggressively conduct a poll to prove that
one of the paintings is incorrectly hung.
Over the course of a few hours, I asked 50 people to pick which one of three paintings is hung incorrectly,
and whether it is top-left (TL), top-right (TR), or top-down (TD).
My data is shown below.

 Painting TD TL TR TOTAL A 13 5 6 24 B 5 0 5 10 C 4 7 5 16 50

The guard will only judge something statistically significant if $$p < 0.05$$.
So I set to work by testing the null hypothesis that people are choosing one of the paintings and orientations at random.
For this, I can use the $$\chi^2$$-test, and assume that the expected frequency of each of the 9 pairs of painting and orientation will be $$50/9$$.
The $$\chi^2$$-distributed test statistic has 8 degrees of freedom, and has a value
$$W_8 := \mathop{\sum_{p \in \{A, B, C\}}}_{o \in \{TD, TL, TR\}} \frac{(N_{p,o} – 50/9)^2}{(50/9)} = 16.6.$$
And so, thumbing my nose at the guard, I show him
$$p = P\{W_8 \ge 16.6\} < 0.035 < 0.05$$
"And so I reject your naive null hypothesis.
Now bring me the curator; we have work to do."

“No, you’re all wrong, see?” he says, pausing in between each word to deliver brief but crippling shocks.
“Let’s test the hypothesis that people are picking a painting at random, regardless of the orientation.
This $$\chi^2$$-distributed test statistic has 2 degrees of freedom
$$W_2 := \sum_{p \in \{A, B, C\}} \frac{( \sum_{o \in \{TD, TL, TR\}} N_{p,o} – 50/3)^2}{(50/3)} = 5.92$$
and thus
$$p = P\{W_2 \ge 5.92\} > 0.051.$$
So we cannot reject that null hypothesis.” ZAP.
“And now let’s test whether those that selected painting A
are choosing the orientation at random.
This $$\chi^2$$-distributed test statistic has 2 degrees of freedom
$$A_2 := \sum_{o \in \{TD, TL, TR\}} \frac{( N_{A,o} – 24/3)^2}{(24/3)} = 4.75$$
and thus
$$p = P\{A_2 \ge 4.75\} > 0.09.$$
So we cannot reject that null hypothesis.” ZAP.
“So you see, sir,

Dazed and confused, I walk away defeated.
What went wrong?

Below is the MATLAB to reproduce the tests:

N = [13 5 6; 5 0 5; 4 7 5];
W1 = (N-50/9).^2./(50/9);
pop = 1-chi2cdf(sum(W1(:)),length(N(:))-1)
W2 = (sum(N')'-50/3).^2/(50/3);
pp = 1-chi2cdf(sum(W2(:)),2)
W3 = (N(1,:)- sum(N(1,:))/3).^2./(sum(N(1,:))/3);
po = 1-chi2cdf(sum(W3(:)),2)