Fisher's Exact Test
Fisher's exact test checks whether two categorical variables are associated, for example whether the proportion of animals with a lesion depends on the treatment group. Unlike the chi-square test, it calculates the p-value exactly instead of relying on an approximation. This makes it the preferred test when the table has small counts; a common rule of thumb is any expected count below 5.
- Steps
Load the dataset -> Go to ToxCore -> Fisher's Exact Test -> Move one categorical variable to Row Variable -> Move the other to Column Variable -> Choose the test and output options -> Execute the dialog.

Video walkthrough
Video walkthrough coming soon.
Data requirements
One row per subject or animal (raw data). BioStat Prime counts the rows to build the contingency table.
Both variables are treated as categories. Numeric codes such as 0/1 are accepted.
Rows with a missing value in either variable are left out.
| Group | Lesion |
|---|---|
| Control | No |
| Control | No |
| Treated | Yes |
| Treated | No |
Example layout: one row per animal.
Dialog options
- Enter Result Name
A name for this analysis (default
FishersExact1).- Row Variable (categorical)
The variable shown in the table rows, usually the group.
- Column Variable (categorical)
The variable shown in the table columns, usually the outcome.
- Alternative Hypothesis (2x2 tables only)
- two.sided (default), less or greater. For a 2x2 table this refers to the odds ratio being different from, less than, or greater than 1. Ignored for larger tables.
- Confidence Level
90, 95 (default) or 99%. Used for the odds ratio confidence interval (2x2 tables only).
- Simulate p-value (for tables larger than 2x2)
Exact calculation for large tables can be very slow or fail. When checked, the p-value is estimated by Monte Carlo simulation instead. Ignored for 2x2 tables.
- Number of Simulation Replicates
How many simulated tables to use when Simulate p-value is checked (default 2000). More replicates give a more precise p-value but take longer.
- Show Contingency Table
Shows the table of counts. On by default.
- Show Row-Percentage Table
Shows each cell as a percentage of its row total. Off by default.
Output
- Contingency Table (Counts)
Number of rows for each combination of row and column categories.
- Row Percentages (%)
Each row adds up to 100%, which makes it easy to compare outcome rates between groups.
- Table_Size
Size of the table, for example
2x2or4x2.- p_value
p-value of the test. A small value (for example below 0.05) means the two variables are associated.
- Method
Exact, or Simulated with the number of replicates.
- Odds_Ratio, CI_Lower, CI_Upper, CI_Level
Reported for 2x2 tables only. An odds ratio of 1 means no association; the confidence interval shows the plausible range.
R function used: stats::fisher.test(). R packages required: none (base R).