# Chi-squared and repeated measures

I would like to determine whether there is a deviation in the male:female ratio of a certain strain of laboratory mouse from the normal situation (with male:female = 1:1).

I have several mouse pairs, and several litters for each pair.

So, for instance:

Pair 1
Litter 1  5M:3F
Litter 2  3M:4F
Litter 3  7M:4F
...
Pair 2
Litter 1  4M:5F
Litter 2  2M:5F
Litter 3  6M:2F
...


What would be the best way to analyse this situation?
I thought of using chi-squared, but I am not sure about how to handle the fact that I have repeated measures for each pair.

-

Interesting, the general question of repeated measures in chi-square has been asked quite a few times but usually obtusely so that it doesn't come up in a simple search. Mcnemar test is what you want. mcnemar.test in R.

-
Thank you! Indeed I could not find something that seemed to answer it, hopefully the tags in this question will be of use for future searches! –  nico Sep 14 '12 at 15:44
However, it would be of great help if you could write a snippet of code, I only see examples on 2x2 contingency tables... Note that I would like to take into account all litters at once, just using the pairs as a nuisance factor. –  nico Sep 14 '12 at 15:47
@John +1 for a good answer. I think that a one-sided McNemar test would be of interest since as was shown for humans There may be slightly more male births than female births. Also, the actual difference in the proportions may be small. So large samp;es would be need to have good power to reject the null hypothesis. In the example given in a post on CV the estimate was around 0.505 for males and 0.495 for females. –  Michael Chernick Sep 14 '12 at 16:27
After reading some more I am a bit confused about what constitutes a pair? If we are misinterpreting McNemar may not be the right test. –  Michael Chernick Sep 14 '12 at 16:32
@Michael Chernick: for my purposes 1:1 M:F would be perfectly OK. A pair is a pair of mice ("mom and dad" if you wish) that have had multiple litters, each litter being in the order of 8-12 pups. –  nico Sep 14 '12 at 17:37

The pooling of litters for an individual set of parents seems reasonable to me. If the data could be put into a kxk contingency table and the male mice could be naturally paired with female mice a generalization of Mc Nemar's test could be given. This is a generalization of the the McNemar test for K>2. This paper points out the generalization which can be credited to both Stuart in a cited 1955 paper and maxwell in a 1970 paper. The authors of this article show how to implement the procedure in SAS and provide some examples.

The three relevant papers are:

[1] Maxwell A.E. (1970). Comparing the classification of subjects by two independent judges. British Journal of Psychiatry, 116: 651 - 655.

[2] McNemar Q. (1947). Note on the sampling error of the difference between correlated proportions or percentages. Psychometrika, 12: 153 - 157.

[3] Stuart A. (1955). A Test for Homogeneity of the Marginal Distributions in a Two-Way Classification. Biometrika, 42: 412 - 416.

I gave this information in my original answer but pairing is by parents and not by the offspring mice. So given this information it appears these test do not apply.

However the design looks like it could represent a series of kx2 contingency tables where each table represents columns for males and females where k is the number of litters in each group and the cells represent the number of males in the litter or females in the litter depending on the colum the cell belongs to. There is one such table for each set of parents. The tables can be looked upon as a stratification of the data stratified by parents. If the value of k is the same for each set of parents (all sets of parents have the same number of litters) there is a test that compares the distribution of male and female mice taking account for the stratification. The test is a generalization of the Cochran-Mantel-Haenszel test describe here for example.

If you could control or have controlled the experiment so that each parent pair produce the same number of litters you can use this test. If not I do not know yet if there is something similar for unequal stratification groups (counts here being number of litters for the ith parent group).

-
Thanks Michael, this seems to be quite what I need. So, there is no generalization to nxm ? –  nico Sep 14 '12 at 19:36
I am sorry I thought this was an extension to NxM tables and that your application needed Nx2. But apparently the right way togeneralize the McNemar test is to other square tables of the form KxK. So for this to be useful to you you need to formulate the problem to fit a KxK table. I think the idea with McNemar and the generalization is to see if one member of the pair has the same (correlated) marginally binomial distribution (for McNemar) and multinomial (for the generalization). –  Michael Chernick Sep 14 '12 at 20:24
So as I think about it your definition of pair being matching parents does not fit in with the definition of pair for the McNemar test and its generalization. I think the pairing would have to be on male female. So this probably won't work for you. In which case I should retract my answer and look for something suitable. –  Michael Chernick Sep 14 '12 at 20:28
@nico I now believe the McNemar generalization is not appropriate but a generalization of Cochran-Mantel-Haenszel could be. Take a look at my edited answer. –  Michael Chernick Sep 15 '12 at 3:32