4
$\begingroup$

I have a $2 \times 2$ contingency table I would like to analyze through logistic regression AND the Fisher's Exact Test. The table tells us how many people responded to treatment vs control for headaches.

             Headache       No Headache
Asprin             55                42
Control            67                34                 

The logical way to interpret the relation is that Headache vs. No Headache is the dependent variable while Asprin vs. Control is the independent predictor variable.

However, I am wondering if there is a difference for Headache being in the columns vs it being in the rows. In other words, would there be any difference in having:

             Headache       No Headache
Asprin             55                42
Control            67                34         

VERSUS

                  Asprin       Control
Headache              55            67
No Headache           42            34         

?

Obviously the log odds ratio will be different but is there a convention to be followed? Additionally, for the Fisher's Exact Test, which assumes fixed columns and rows, does it apply here as well?

$\endgroup$
1
  • $\begingroup$ Either way works $\endgroup$
    – gammer
    Commented Feb 2, 2017 at 2:52

2 Answers 2

4
$\begingroup$

The odds ratio is invariant to exchange of rows and columns (note that for the two tables you constructed the odds ratio is the same) therefore any method such as logistic regression which focuses on the odds ratio will be the same

EDIT: For Fisher's exact test consider the two tables.

+------------+---------+---------+--------+
|            |    A    |    B    |        |
+------------+---------+---------+--------+
| 1          |    a    |    b    |   a+b  |
| 2          |    c    |    d    |   c+d  |
+------------+---------+---------+--------+
|            |   a+c   |   b+d   |    n   |
+------------+---------+---------+--------+

In this table the Fisher's exact test statistic can be calculated as

$$ \dfrac{{a + b\choose a}{c + d \choose c}}{{n\choose a+c}} = \dfrac{(a+b)!(c+d)!(a+c)!(b+d)!}{a!b!c!d!n!} $$

+------------+---------+---------+--------+
|            |    A    |    B    |        |
+------------+---------+---------+--------+
| 1          |    a    |    c    |   a+c  |
| 2          |    b    |    d    |   b+d  |
+------------+---------+---------+--------+
|            |   a+b   |   c+d   |    n   |
+------------+---------+---------+--------+

For this table we get $$ \dfrac{{a + c\choose a}{b + d \choose b}}{{n\choose a+b}} = \dfrac{(a+b)!(c+d)!(a+c)!(b+d)!}{a!b!c!d!n!} $$

So the Fisher exact test is also invariant to switching the rows and columns.

$\endgroup$
1
  • 1
    $\begingroup$ I see, suppose instead we wished to do a Fisher's exact test, which assumes that rows and columns are fixed. Is it valid in this case? thanks! $\endgroup$
    – user321627
    Commented Feb 2, 2017 at 1:23
1
$\begingroup$

@bdeonovic is correct. However, if you want to do regression where you have dependent variable, the convention is put the dependent variable on the rows, and independent variables on the columns.

This is easier for everybody. As you add more independent variables, you will just add more columns while the number of rows in your table remain unchanged.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.