About Site Map Submit Contact Us Log in | Create an account
Create an account Log In
Average Rating
User Rating:
Visitors Rating:
My rating:

Write review
See full specifications

scripts default iconFISHERTEST (Scripts) Publisher's description

FISHERTEST - Fisher Exact test for 2-x-2 contingency tables

FISHERTEST - Fisher Exact test for 2-x-2 contingency tables

H = FISHERTEST(M) performs the non-parametric Fisher exact probability
test on a 2-by-2 contingency table described by M, and returns the
result in H. It calculates the exact probability of observing the given
and more extreme distributions on two variables. H==0 indicates that
the null hypothesis (H0: "the score on one variable is independent from
the score on the other variable") cannot be rejected at the 5%
significance level. H==1 indicates that the null hypothesis can be
rejected at the 5% level. For practical convenience, the variables can
be considered as "0/1 questions" and each observation is casted in
one of the cells of the 2-by-2 contingency table [1/1, 1/0 ; 0/1, 0/0].

If M is a 2-by-2 array, it specifies this 2-by-2 contingency table
directly. It holds the observations for each of the four possible
If M is a N-by-2 logical or binary array, the 2-by-2 contingency table
is created from it. Each row of M is a single observation that is
casted in the appropriate cell of M.

[H,P,STATS] = FISHERTEST(..) also returns the exact probability P of
observing the null-hypothesis and some statistics in the structure
STATS, which has the following fields:
.M - the 2-by-2 contingency table
.P - a list of probabilities for the original and all more extreme
.phi - the phi coefficient of association between the two attributes
.Chi2 - the Chi Square value for the 2-by-2 contingency table

H =FISHERTEST(M, APLHA) performs the test at the significance level
(100*ALPHA)%. ALPHA must be a scalar between 0 and 1.

% We have measured the responses of 15 subjects on two 0-1
% "questions" and obtained the following results:
% Q1: 1 0
% Q2: 1 5 1
% 0 2 7
% (so 5 subjects answered yes on both questions, etc.)
M = [ 5 1 ; 2 7]
% Our null-hypothesis is that the answers on the two questions are
% independent. We apply the Fisher exact test, since the data is
% measured on an ordinal scale, and we have far to few observations to
% apply a Chi2 test. The result of ...
[H,P] = fishertest(M)
% (-> H = 1, P = 0.0350)
% shows that the probability of observing this distribution M or the
% more extreme distributions (i.e., only one in this case: [6 0 ; 1
8]) is 0.035. Since this is less than 0.05, we can reject our
null-hypothesis indicated by H being 1.

The Fisher Exact test is most suitable for small numbers of
observations, that have been measured on a nominal or ordinal scale.
Note that the values 0 and 1 have only arbitray meanings, and do
reflect a nominal category, such as yes/no, short/long, above/below
average, etc. In matlab words, So, M, M.', flipud(M), etc. all give
the same results.

See also signtest, ranksum, kruskalwallis, ttest, ttest2 (stats Toolbox)
permtest, cochranqtest (File Exchange)

This file does not require the Statistics Toolbox.

System Requirements:

MATLAB 6.5 (R13)
Program Release Status: New Release
Program Install Support: Install and Uninstall

FISHERTEST (Scripts) Tags:

Click on a tag to find related softwares

Is FISHERTEST (Scripts) your software?

Manage your software

Most Popular

scripts default icon ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation 1.1
ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation contain several functions for digital modulation simulation
scripts default icon Simulink Communication Labs 1.1
Simulink Communication Labs allows you to learn communication systems in greater depth.
scripts default icon M-QAM modulation and demodulation 1.1
M-QAM modulation and demodulation is the QAM modulation and demodulation tech.
scripts default icon LZW Compression/Decompression 1.1
LZW Compression/Decompression - Updated LZW compressor and decompressor with reasonable performance
scripts default icon InSPIRE utility to plot a 2D displacement field (Scripts) 1.0
This program plots the deformation field (displace vectors) contained in vector.txt.