Two sided Fisher's exact test with uneven number of samples

I'm not a statistician so maybe this question doesn't make sense, but here goes...

I'm trying to write some code that does a 2-sided Fisher's exact test on some data that looks like this:

| GROUP | SAMPLE_NUMBER | TOTAL_RESULT | BAD_RESULT |
-----------------------------------------------------
| 1     | 1             | 100          | 0          |
| 1     | 2             | 100          | 2          |
| 1     | 3             | 100          | 5          |
| 1     | 4             | 100          | 1          |
-----------------------------------------------------
| 2     | 1             | 100          | 2          |
| 2     | 2             | 100          | 1          |
-----------------------------------------------------
| 3     | 1             | 100          | 6          |
| 3     | 2             | 100          | 3          |
-----------------------------------------------------
| 4     | 1             | 100          | 7          |
| 4     | 2             | 100          | 9          |


The book I'm reading says that I need to sort the results into duplicate pairs and get the Fisher's P-value for each pair, like so:

| GROUP | PROPORTIONS COMPARED | P-VALUE |
| 1     | 0/100 vs. 2/100      | 0.2487  |
| 1     | 5/100 vs. 1/100      | 0.1203  |
| 1     | 2/200 vs. 6/200      | 0.1758  |
| 2     | 2/100 vs. 1/100      | 0.6231  |
| 3     | 6/100 vs. 3/100      | 0.3337  |
| 4     | 7/100 vs. 9/100      | 0.6153  |


Because group 1 has 4 sets of data, the book says I need to compare the first and second, the third and fourth and then the first two with the last two, hence there are three rows in the above table for group 1. I kind of get this but what would I do if there were an uneven number of samples (e.g. 3) from group 1?

• It looks to me that you want to know if the proportion of BAD_RESULTs differs by GROUP. I think you would be best to explore logistic regression, instead of using Fisher's exact test. Out of curiosity, what book are you reading? Jun 18, 2013 at 15:03
• Unfortunately I have to do the Fisher's test, because this is what one of my clients wants - I don't really have a say in the matter! Jun 19, 2013 at 13:16
• So do you know what I should do if there are an uneven number of samples in a group? Or does it HAVE to have paired data? Jun 19, 2013 at 13:36
• And what would happen if there were more than 4 sets of data in group 1, say 6 or 8? Jun 19, 2013 at 14:06