Entering edit mode

I want to apply fisher's exact test (fisher.test() function in R) to a table typically like this:

A | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|

5 20

| | | | | | | | | | B | 33 11 |

| | | | | | | | | | C | 17 6 |

| | | | | | | | | | | |

```
The p-value is 5.219e-05.
```

My question is , it is obvious row 'A' made the significant. However, how can I tell from the test automatically which row caused the significant value?

Thanks.

There is no obvious way to extract that kind of information from a Fisher test, perhaps you might want to look into a Poisson regression model using your A/B/C factors as predictors

Binomial (logistic) regression, I think? The "counts" here are a contingency table so the model is something like

glm(cbind(m[,2], rowSums(m)) ~ LETTERS[1:3], family="binomial")

if 'm' is the matrix above. There are also likelihood ratio tests for contingency tables, something called G-tests, but not in base R

@David W, G-test seams also can't tell which row made significant.

The result:

It actually says B,C are significant. It seams 'significant' here always based on the first row.

You have to tell R which coeficients you want to contrast against each other - this will be determined by the design of your experiment. The result you've just shown is a bit meaningless at the moment, you should maybe have done anova(glm(...)) first - to check whether accounting for the rows improves the fit.

russ has set you on the right path with contrasts. I should add that I might not have been prefectly clear. This code above is not a G-test, which is a little different and related to chi squared.

@[russ_hyde](https://www.biostars.org/u/11208/), Thanks. I don't really understand the model. Could you give a example how to call the model with glm, and how to tell which row made significant?

I might have confused you, the data isn't showing what I thought it was: I thought you had 6 different treatment pairs with the columns representing the levels of one treatment and the rows representing the levels of another treatment and the body being counts.

Stick with the binomial model if the columns represent your experimental outcomes