Fisher Algorithm
Performed on a set of non-negative numbers and labels of size N. There must be two specific labels. Label 1 must be 1 and label 2 must be 2. There can also be any other labels that will be ignored.
Consider all numbers greater than 0 as 1. Construct the following table:
|
Column1 |
Column2 |
Total |
Row1 |
a |
b |
r1 |
Row2 |
c |
d |
r2 |
Total |
s1 |
s2 |
N |
Where:
- a is the number of 1 values in group 1.
- b is the number of 1 values in group 2.
- c is the number of 0 values in group 1.
- d is the number of 0 values in group 2.
- r1 = a + b
- r2 = c + d
- s1 = a + c
- s2 = b + d
- N = r1 + r2 = s1 + s2
Rearrage the table so a is the smallest value. There are two possible rearranging moves:
- Swap Row1 and Row2.
- Swap Column1 and Column2.
Fisher's Exact value
- Chi1:
- E:
- Chi2:
- E:
- Chi3:
- E:
- Chi4:
- E:
- Chi-Square: Chi1 + Chi2 + Chi3 + Chi4
Fisher's Exact probability
The probability for a table is calculated by
.
The following table is called "Set 0":
|
Column1 |
Column2 |
Total |
Row1 |
0 |
B |
r1 |
Row2 |
C |
D |
r2 |
Total |
s1 |
s2 |
N |
- Determine the number of table probabilities to calculate by finding the smallest marginal total (least value among r1, r2, s1, s2) and adding 1.
- Generate the table for "Set 0"
- A = 0
- B = b + a
- C = c + a
- D = d - a
- Totals remain unchanged.
- Calculate the probability of "Set 0"
- :
- This is because in "Set 0" A! = 1, = 1, and = 1.
- Calculate probabilities for other tables where A = {1, 2, ..., smallest marginal total}
- :
- P-value: where <= +
Remarks
- When the P-value gets very close to 1 and should in fact be 1, it is necessary to make a correction.