# Association between a categorical and binary variable

I have a set of patients that I split into two parts using some obscure algorithm (doesn't matter how): let the $X$ take on values $A$ and $B$. Each patient belongs to exactly one of 5 disease subtypes: let $S$ take on the values $a, b, c, d, e$. Here is the contingency table:

       A    B
a    116  109
b     64   87
c    161   86
d    123  140
e     77   38


Using Fisher's exact test, I get a p-value of $5.274e-07$. So I conclude that $X$ and $S$ are somehow associated (or not independent). What I'd like to ask next is which subtypes are significantly associated with $X$. For example, subtype $a$ doesn't seem to deviate much from the expected number of $A$s and $B$s if $a$ is independent of $X$, while there seems to be an overrepresentation of $A$s within the $e$ subtype.

What kind of test would be appropriate here?

Could I use Fisher's exact test again for each of the subtypes separately. Or should I use something like logistic regression?

• The way the cross-classification occurs is important, nonetheless, since some tests assume that one or both marginal totals are fixed. Why a Fisher's test in this instance? A Pearson' $\chi^2$ would yield a comparable p-value (5.91e-07), for example; expected counts under the null for row e are 62.2 (A) and 52.8 (B), and the residuals are not much different in magnitude from those of row b. – chl Oct 16 '12 at 21:37
• @chl Isn't Pearson's $\chi^2$ an approximation to Fisher's exact? So they should give similar results. Concerning the marginals, I can only say that the subtypes are fixed, but the classification algorithm (i.e., variable X) is not constrained and is free to classify any number of patients as either A or B. But this is similar to many situations where I have seen Fisher's exact test be applied. – ALiX Oct 16 '12 at 22:13