This calculator helps you determine whether there is a significant relationship between two categorical variables, especially when sample sizes are small (n < 20) or when cell values are less than 5. Unlike the Chi-Square test, Fisher's Exact Test calculates the exact probability of observing a particular distribution of frequencies in a 2×2 contingency table, making it ideal when expected cell counts are low. This test is widely used in fields like genetics, clinical trials, and social sciences to analyze small datasets. for a quick example.
Tip: You can edit variable names by clicking directly on the table headers (column names) or row labels. Click on any header to customize the names for your analysis.
\ | ||
|---|---|---|
Fisher's Exact Test is used to determine whether there is a significant association between two categorical variables in a 2×2 contingency table. It's particularly useful when sample sizes are small or when cell values are less than 5. The test calculates the exact probability of observing the data assuming the null hypothesis of independence is true.
The probability of observing any particular table:
Where:
Odds Ratio:
Drug effectiveness study results:
| Group | Treated | Control | Total |
|---|---|---|---|
| Recovered | 8 | 2 | 10 |
| Not Recovered | 1 | 7 | 8 |
| Total | 9 | 9 | 18 |
(This is the probability of observing exactly this table configuration)
For right-sided test (treatment increases recovery), we need all possible tables maintaining margins:
When :
| 8 | 2 | 10 |
| 1 | 7 | 8 |
| 9 | 9 | 18 |
When :
| 9 | 1 | 10 |
| 0 | 8 | 8 |
| 9 | 9 | 18 |
Right-sided p-value calculation:
Since -value () (), we reject . There is strong evidence that the treatment increases recovery rate, with the odds of recovery being 28 times higher in the treatment group.
Note:
# Create a contingency table
data <- matrix(c(8, 1, 2, 7), nrow = 2,
dimnames = list(
c("Recovered", "Not Recovered"),
c("Treatment", "Control")
))
# or simply
# data = rbind(c(8,1),c(2,7))
# Perform Fisher's exact test
result <- fisher.test(data, alternative = "greater")
# Print results
print(result)from scipy.stats import fisher_exact
import numpy as np
# Create contingency table
contingency_table = np.array([
[8, 2], # Recovered (Treatment, Control)
[1, 7] # Not Recovered (Treatment, Control)
])
# Perform Fisher's exact test
odds_ratio, p_value = fisher_exact(contingency_table, alternative='greater')
print(f'Odds Ratio: {odds_ratio:.4f}')
print(f'p-value: {p_value:.4f}')Consider these alternatives:
This calculator helps you determine whether there is a significant relationship between two categorical variables, especially when sample sizes are small (n < 20) or when cell values are less than 5. Unlike the Chi-Square test, Fisher's Exact Test calculates the exact probability of observing a particular distribution of frequencies in a 2×2 contingency table, making it ideal when expected cell counts are low. This test is widely used in fields like genetics, clinical trials, and social sciences to analyze small datasets. for a quick example.
Tip: You can edit variable names by clicking directly on the table headers (column names) or row labels. Click on any header to customize the names for your analysis.
\ | ||
|---|---|---|
Fisher's Exact Test is used to determine whether there is a significant association between two categorical variables in a 2×2 contingency table. It's particularly useful when sample sizes are small or when cell values are less than 5. The test calculates the exact probability of observing the data assuming the null hypothesis of independence is true.
The probability of observing any particular table:
Where:
Odds Ratio:
Drug effectiveness study results:
| Group | Treated | Control | Total |
|---|---|---|---|
| Recovered | 8 | 2 | 10 |
| Not Recovered | 1 | 7 | 8 |
| Total | 9 | 9 | 18 |
(This is the probability of observing exactly this table configuration)
For right-sided test (treatment increases recovery), we need all possible tables maintaining margins:
When :
| 8 | 2 | 10 |
| 1 | 7 | 8 |
| 9 | 9 | 18 |
When :
| 9 | 1 | 10 |
| 0 | 8 | 8 |
| 9 | 9 | 18 |
Right-sided p-value calculation:
Since -value () (), we reject . There is strong evidence that the treatment increases recovery rate, with the odds of recovery being 28 times higher in the treatment group.
Note:
# Create a contingency table
data <- matrix(c(8, 1, 2, 7), nrow = 2,
dimnames = list(
c("Recovered", "Not Recovered"),
c("Treatment", "Control")
))
# or simply
# data = rbind(c(8,1),c(2,7))
# Perform Fisher's exact test
result <- fisher.test(data, alternative = "greater")
# Print results
print(result)from scipy.stats import fisher_exact
import numpy as np
# Create contingency table
contingency_table = np.array([
[8, 2], # Recovered (Treatment, Control)
[1, 7] # Not Recovered (Treatment, Control)
])
# Perform Fisher's exact test
odds_ratio, p_value = fisher_exact(contingency_table, alternative='greater')
print(f'Odds Ratio: {odds_ratio:.4f}')
print(f'p-value: {p_value:.4f}')Consider these alternatives: