For any values (RF,LF,RM,LM) we calculate the marginal totals and then we can ask, how surprising is the observed distribution given the marginal distributions?

Suppose the distribution is that we have 60 females and 80 right-handers, out of a total of 100 subjects. (Actually, the incidence of left-handers is about half) this much.

If hand bias and sex are not associated, what distribution of distributions do we expect by chance? Let's do a simulation in Python. Here are the results from 50,000 reps.

I was quite surprised by this at first. On reflection, I guess it is implicit in the whole idea of the chi-square test, but it just completely passed me by that the standard deviation for each subgroup is necessarily the same.

It is connected to the fact that, as they say, there is only one degree of freedom. If our group of 60 females happens to have not 48 but 53 right-handers, then the rest is all determined. There will be 7 left-handed females, and for the 40 males there will be not 32 right-handers but only 27, and not 8 left-handers but 13. Each group will be shifted from its mean value by the

*same amount*. So the total amount of "shifting" or variation from the mean, is the same for each group. And of course the sum of the square of this difference for the whole series of trials will also be the same. Huh!

## No comments:

Post a Comment