Fisher's Exact with mid-P method

version (2.79 KB) by Steinar Thorvaldsen
Fisher's Exact mid-P method to test row/col independence of a 2x2 contingency table.


Updated 23 Dec 2010

View License

It is a non-parametric statistical test for discrete data used to
determine if there are nonrandom associations between the two variables.
Mid-P values are a reasonable compromise between the conservativeness of
the ordinary exact test and the uncertain adequacy of large-sample methods.
Mid-P values usually performs well, typically being a bit conservative,
and is currently recommended by many leading statisticians.

Ref.: DeltaProt toolbox at

X: data matrix (2x2-table) of observed counts
tail: The alternative hypothesis against which to compute p-values.
Choices are:
'ne' 2-Tail (default)
'gt' Right tail: the alternative to independence is that there is positive association between the variables.
'lt' Left tail: the alternative hypothesis is that there is negative association between the variables


Use: P = FisherExtest(Observed,'ne')

Please, use the following reference:
Thorvaldsen, S. , Flå, T. and Willassen, N.P. (2010) DeltaProt: a software toolbox for comparative genomics. BMC Bioinformatics 2010, Vol 11:573.

Other references:
Agresti, A. (2001), Exact inference for categorical data: recent advances and continuing controvercies. Statistics in Medicine, 20: 2709-2722.
Hirji, K.F. (2006), Exact Analysis of Discrete Data. Chapman & Hall.
Fisher, R.A. (1934), Statistical Methods for Research Workers. Chapter 12. 5th Ed., Oliver & Boyd.

Cite As

Steinar Thorvaldsen (2022). Fisher's Exact with mid-P method (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14SP3
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!