I have a table of 288 rows and 4 columns where each row corresponds to a tumour sample, and each column is a gene. All of the values are 0 or 1, to indicate whether there's a mutation in a particular gene for a particular sample, but obviously each sample can have more than one mutation.

I want to test for correlations between pairs of columns, to see if mutations in certain genes are likely to appear in the same sample or if they're likely to not appear in the same sample (the null hypothesis being that they're occur independently). Normally for categorical data I'd use Fisher's exact test, but it seems like all the examples I see use mutually exclusive variables, which is not the case for my dataset.

What would be the most relevant test for this kind of dataset?


1 Answer 1


Consider first two specific columns, say $A$ and $B$. It is not difficult to calculate the probability directly, without resorting to a generic test.

Say the number of instances is $N$ (your 288), column $A$ has $n$ positives, and $B$ has $K$ positives. Now suppose that the null hypothesis is true, i.e., that $A$ being positive has no bearing on $B$ being positive. Then the number of positives in $B$ in instances corresponding to the positives in $A$ is exactly distributed hypergeometrically, that is, the probability that in the $n$ positives of $A$ you'll see $k$ positives in $B$, is exactly

$$ P(k) = {{K \choose k} {N - K \choose n - k} \over {N \choose n}} . $$

Under the null hypothesis, the probability that you would get the result you got or higher, that is, at least $k$, is

$$\sum_{k' = k}^K P(k'). $$

You should reject the null hypothesis if this probability is smaller than something commonly used (e.g., 0.05, or 0.01).

In your problem, you don't have $A$ and $B$ pre-determined, but rather must consider all the possibilities. For all possibilities of $A$ and $B$, you might consider doing a Bonferroni correction of the above (i.e., choose a p-value that is divided by the number of possible pairs as the rejection level).

  • $\begingroup$ So I'm just working through one of the examples to see if I understand you correctly. One of the gene columns ($A$) has 80 ($n$) positives, and another ($B$) has 62 ($K$) positives. Of the 80 rows which are positive in $A$, 10 of those are also positive in $B$, so my value for $k$ is 10. So to calculate the probability of 10 or more co-located values I sum the 1st equation for all values of $k$ from 10 to 62. In this case the probability is $\approx 0.995$ so I accept the null for those two genes? $\endgroup$ Mar 9, 2018 at 14:40
  • $\begingroup$ @JSneathThompson Essentially, yes, except that I wouldn't call it "accept" but rather "not reject" - there is simply insufficient evidence to show that $A \Rightarrow B$. This isn't exactly your question, but given the low value you got (10), you might want to consider also $A \Rightarrow \not B$ (I don't know enough biology, or your particular case, to know if that is a plausible hypothesis). $\endgroup$
    – Ami Tavory
    Mar 9, 2018 at 14:44
  • $\begingroup$ Ok, that makes sense. For $H_0: A \rightarrow \not B$ would my probability equation become $\sum\limits_{k'=1}^{k} P(k')$? $\endgroup$ Mar 9, 2018 at 14:53
  • $\begingroup$ Or now I think about it, it would be the same, but my value for $k$ would be the number of positives in $A$ that correspond to negatives in $B$ $\endgroup$ Mar 9, 2018 at 15:05
  • $\begingroup$ @JSneathThompson That seems right. $\endgroup$
    – Ami Tavory
    Mar 9, 2018 at 15:36

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.