Fisher’s exact test is similar to the Chi-squared test, but is suitable for small sample sizes. As a rule it should be used if at least 20% of values are less than 5 or any value is zero. Although in practice it is employed when sample sizes are small, it is valid for all sample sizes.

For example, let us look at an example where a group of 16 people may choose tennis or football. In the group of 16 there are six boys and ten girls. The tennis group has one boy and eight girls. The football group has five boys and two girls. Does the sport affect the proportion of boys and girls choosing it?

import numpy as np
import scipy.stats as stats
obs = np.array([[1,5], [8,2]])
fisher_result = stats.fisher_exact(obs)
p_val = fisher_result[1]
print ('Data:')
print (obs)
print ('\nProbability that column does not effect row values:')
print (p_val)
OUT:
Data:
[[1 5]
[8 2]]
Probability that column does not effect row values:
0.03496503496503495

Interests are use of simulation and machine learning in healthcare, currently working for the NHS and the University of Exeter. Committed to all work being performed in Free and Open Source Software (FOSS), and as much source data being made available as possible.
https://gitlab.com/michaelallen1966
View all posts by Michael Allen

Published

One thought on “59. Statistics: Fisher’s exact test”

## One thought on “59. Statistics: Fisher’s exact test”