<s>
Fisher	B-General_Concept
's	I-General_Concept
exact	I-General_Concept
test	I-General_Concept
is	O
a	O
statistical	B-General_Concept
significance	I-General_Concept
test	O
used	O
in	O
the	O
analysis	O
of	O
contingency	B-Application
tables	I-Application
.	O
</s>
<s>
It	O
is	O
named	O
after	O
its	O
inventor	O
,	O
Ronald	O
Fisher	O
,	O
and	O
is	O
one	O
of	O
a	O
class	O
of	O
exact	B-General_Concept
tests	I-General_Concept
,	O
so	O
called	O
because	O
the	O
significance	O
of	O
the	O
deviation	O
from	O
a	O
null	B-General_Concept
hypothesis	I-General_Concept
(	O
e.g.	O
,	O
P-value	B-General_Concept
)	O
can	O
be	O
calculated	O
exactly	O
,	O
rather	O
than	O
relying	O
on	O
an	O
approximation	O
that	O
becomes	O
exact	O
in	O
the	O
limit	O
as	O
the	O
sample	O
size	O
grows	O
to	O
infinity	O
,	O
as	O
with	O
many	O
statistical	O
tests	O
.	O
</s>
<s>
Most	O
uses	O
of	O
the	O
Fisher	O
test	O
involve	O
,	O
like	O
this	O
example	O
,	O
a	O
2×2	O
contingency	B-Application
table	I-Application
(	O
discussed	O
below	O
)	O
.	O
</s>
<s>
The	O
p-value	B-General_Concept
from	O
the	O
test	O
is	O
computed	O
as	O
if	O
the	O
margins	O
of	O
the	O
table	O
are	O
fixed	O
,	O
i.e.	O
</s>
<s>
As	O
pointed	O
out	O
by	O
Fisher	O
,	O
this	O
leads	O
under	O
a	O
null	B-General_Concept
hypothesis	I-General_Concept
of	O
independence	O
to	O
a	O
hypergeometric	O
distribution	O
of	O
the	O
numbers	O
in	O
the	O
cells	O
of	O
the	O
table	O
.	O
</s>
<s>
With	O
large	O
samples	O
,	O
a	O
chi-squared	B-General_Concept
test	I-General_Concept
(	O
or	O
better	O
yet	O
,	O
a	O
G-test	B-General_Concept
)	O
can	O
be	O
used	O
in	O
this	O
situation	O
.	O
</s>
<s>
However	O
,	O
the	O
significance	O
value	O
it	O
provides	O
is	O
only	O
an	O
approximation	O
,	O
because	O
the	O
sampling	B-General_Concept
distribution	I-General_Concept
of	O
the	O
test	O
statistic	O
that	O
is	O
calculated	O
is	O
only	O
approximately	O
equal	O
to	O
the	O
theoretical	O
chi-squared	O
distribution	O
.	O
</s>
<s>
The	O
approximation	O
is	O
inadequate	O
when	O
sample	O
sizes	O
are	O
small	O
,	O
or	O
the	O
data	O
are	O
very	O
unequally	O
distributed	O
among	O
the	O
cells	O
of	O
the	O
table	O
,	O
resulting	O
in	O
the	O
cell	O
counts	O
predicted	O
on	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
(	O
the	O
"	O
expected	O
values	O
"	O
)	O
being	O
low	O
.	O
</s>
<s>
The	O
usual	O
rule	O
for	O
deciding	O
whether	O
the	O
chi-squared	O
approximation	O
is	O
good	O
enough	O
is	O
that	O
the	O
chi-squared	B-General_Concept
test	I-General_Concept
is	O
not	O
suitable	O
when	O
the	O
expected	O
values	O
in	O
any	O
of	O
the	O
cells	O
of	O
a	O
contingency	B-Application
table	I-Application
are	O
below	O
5	O
,	O
or	O
below	O
10	O
when	O
there	O
is	O
only	O
one	O
degree	O
of	O
freedom	O
(	O
this	O
rule	O
is	O
now	O
known	O
to	O
be	O
overly	O
conservative	O
)	O
.	O
</s>
<s>
In	O
fact	O
,	O
for	O
small	O
,	O
sparse	O
,	O
or	O
unbalanced	O
data	O
,	O
the	O
exact	O
and	O
asymptotic	O
p-values	B-General_Concept
can	O
be	O
quite	O
different	O
and	O
may	O
lead	O
to	O
opposite	O
conclusions	O
concerning	O
the	O
hypothesis	O
of	O
interest	O
.	O
</s>
<s>
In	O
contrast	O
the	O
Fisher	B-General_Concept
exact	I-General_Concept
test	I-General_Concept
is	O
,	O
as	O
its	O
name	O
states	O
,	O
exact	O
as	O
long	O
as	O
the	O
experimental	O
procedure	O
keeps	O
the	O
row	O
and	O
column	O
totals	O
fixed	O
,	O
and	O
it	O
can	O
therefore	O
be	O
used	O
regardless	O
of	O
the	O
sample	O
characteristics	O
.	O
</s>
<s>
It	O
becomes	O
difficult	O
to	O
calculate	O
with	O
large	O
samples	O
or	O
well-balanced	O
tables	O
,	O
but	O
fortunately	O
these	O
are	O
exactly	O
the	O
conditions	O
where	O
the	O
chi-squared	B-General_Concept
test	I-General_Concept
is	O
appropriate	O
.	O
</s>
<s>
For	O
hand	O
calculations	O
,	O
the	O
test	O
is	O
feasible	O
only	O
in	O
the	O
case	O
of	O
a	O
2×2	O
contingency	B-Application
table	I-Application
.	O
</s>
<s>
However	O
the	O
principle	O
of	O
the	O
test	O
can	O
be	O
extended	O
to	O
the	O
general	O
case	O
of	O
an	O
m×n	O
table	O
,	O
and	O
some	O
statistical	B-Algorithm
packages	I-Algorithm
provide	O
a	O
calculation	O
(	O
sometimes	O
using	O
a	O
Monte	B-Algorithm
Carlo	I-Algorithm
method	I-Algorithm
to	O
obtain	O
an	O
approximation	O
)	O
for	O
the	O
more	O
general	O
case	O
.	O
</s>
<s>
A	O
p-value	B-General_Concept
may	O
then	O
be	O
calculated	O
,	O
summarizing	O
the	O
significance	O
of	O
the	O
overlap	O
between	O
the	O
two	O
lists	O
.	O
</s>
<s>
The	O
question	O
we	O
ask	O
about	O
these	O
data	O
is	O
:	O
Knowing	O
that	O
10	O
of	O
these	O
24	O
teenagers	O
are	O
studying	O
and	O
that	O
12	O
of	O
the	O
24	O
are	O
female	O
,	O
and	O
assuming	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
that	O
men	O
and	O
women	O
are	O
equally	O
likely	O
to	O
study	O
,	O
what	O
is	O
the	O
probability	O
that	O
these	O
10	O
teenagers	O
who	O
are	O
studying	O
would	O
be	O
so	O
unevenly	O
distributed	O
between	O
the	O
women	O
and	O
the	O
men	O
?	O
</s>
<s>
The	O
formula	O
above	O
gives	O
the	O
exact	O
hypergeometric	O
probability	O
of	O
observing	O
this	O
particular	O
arrangement	O
of	O
the	O
data	O
,	O
assuming	O
the	O
given	O
marginal	O
totals	O
,	O
on	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
that	O
men	O
and	O
women	O
are	O
equally	O
likely	O
to	O
be	O
studiers	O
.	O
</s>
<s>
Thus	O
,	O
we	O
can	O
calculate	O
the	O
exact	O
probability	O
of	O
any	O
arrangement	O
of	O
the	O
24	O
teenagers	O
into	O
the	O
four	O
cells	O
of	O
the	O
table	O
,	O
but	O
Fisher	O
showed	O
that	O
to	O
generate	O
a	O
significance	B-General_Concept
level	I-General_Concept
,	O
we	O
need	O
consider	O
only	O
the	O
cases	O
where	O
the	O
marginal	O
totals	O
are	O
the	O
same	O
as	O
in	O
the	O
observed	O
table	O
,	O
and	O
among	O
those	O
,	O
only	O
the	O
cases	O
where	O
the	O
arrangement	O
is	O
as	O
extreme	O
as	O
the	O
observed	O
arrangement	O
,	O
or	O
more	O
so	O
.	O
</s>
<s>
(	O
Barnard	B-General_Concept
's	I-General_Concept
test	I-General_Concept
relaxes	O
this	O
constraint	O
on	O
one	O
set	O
of	O
the	O
marginal	O
totals	O
.	O
)	O
</s>
<s>
the	O
total	O
probability	O
of	O
observing	O
data	O
as	O
extreme	O
or	O
more	O
extreme	O
if	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
is	O
true	O
,	O
we	O
have	O
to	O
calculate	O
the	O
values	O
of	O
p	O
for	O
both	O
these	O
tables	O
,	O
and	O
add	O
them	O
together	O
.	O
</s>
<s>
This	O
gives	O
a	O
one-tailed	B-General_Concept
test	I-General_Concept
,	O
with	O
p	O
approximately	O
0.001346076	O
+	O
0.000033652	O
=	O
0.001379728	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
the	O
R	B-Language
statistical	I-Language
computing	I-Language
environment	I-Language
,	O
this	O
value	O
can	O
be	O
obtained	O
as	O
fisher.test(rbind(c(1,9 )	O
,	O
c(11,3 )	O
)	O
,	O
alternative	O
=	O
"	O
less	O
"	O
)	O
$	O
p.value	O
,	O
or	O
in	O
python	O
,	O
using	O
scipy.stats.fisher_exact	O
( table	O
=[[	O
1	O
,	O
9 ]	O
,	O
[	O
11	O
,	O
3 ] ]	O
,	O
alternative	O
=	O
"	O
less	O
"	O
)	O
(	O
where	O
one	O
receives	O
both	O
the	O
prior	O
odds	O
ratio	O
and	O
the	O
p-value	B-General_Concept
)	O
.	O
</s>
<s>
This	O
value	O
can	O
be	O
interpreted	O
as	O
the	O
sum	O
of	O
evidence	O
provided	O
by	O
the	O
observed	O
data	O
—	O
or	O
any	O
more	O
extreme	O
table	O
—	O
for	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
(	O
that	O
there	O
is	O
no	O
difference	O
in	O
the	O
proportions	O
of	O
studiers	O
between	O
men	O
and	O
women	O
)	O
.	O
</s>
<s>
The	O
smaller	O
the	O
value	O
of	O
p	O
,	O
the	O
greater	O
the	O
evidence	O
for	O
rejecting	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
;	O
so	O
here	O
the	O
evidence	O
is	O
strong	O
that	O
men	O
and	O
women	O
are	O
not	O
equally	O
likely	O
to	O
be	O
studiers	O
.	O
</s>
<s>
For	O
a	O
two-tailed	B-General_Concept
test	I-General_Concept
we	O
must	O
also	O
consider	O
tables	O
that	O
are	O
equally	O
extreme	O
,	O
but	O
in	O
the	O
opposite	O
direction	O
.	O
</s>
<s>
An	O
approach	O
used	O
by	O
the	O
fisher.test	O
function	O
in	O
R	B-Language
is	O
to	O
compute	O
the	O
p-value	B-General_Concept
by	O
summing	O
the	O
probabilities	O
for	O
all	O
tables	O
with	O
probabilities	O
less	O
than	O
or	O
equal	O
to	O
that	O
of	O
the	O
observed	O
table	O
.	O
</s>
<s>
In	O
the	O
example	O
here	O
,	O
the	O
2-sided	O
p-value	B-General_Concept
is	O
twice	O
the	O
1-sided	O
value	O
—	O
but	O
in	O
general	O
these	O
can	O
differ	O
substantially	O
for	O
tables	O
with	O
small	O
counts	O
,	O
unlike	O
the	O
case	O
with	O
test	O
statistics	O
that	O
have	O
a	O
symmetric	O
sampling	B-General_Concept
distribution	I-General_Concept
.	O
</s>
<s>
As	O
noted	O
above	O
,	O
most	O
modern	O
statistical	B-Algorithm
packages	I-Algorithm
will	O
calculate	O
the	O
significance	O
of	O
Fisher	O
tests	O
,	O
in	O
some	O
cases	O
even	O
where	O
the	O
chi-squared	O
approximation	O
would	O
also	O
be	O
acceptable	O
.	O
</s>
<s>
The	O
actual	O
computations	O
as	O
performed	O
by	O
statistical	B-Algorithm
software	I-Algorithm
packages	O
will	O
as	O
a	O
rule	O
differ	O
from	O
those	O
described	O
above	O
,	O
because	O
numerical	O
difficulties	O
may	O
result	O
from	O
the	O
large	O
values	O
taken	O
by	O
the	O
factorials	O
.	O
</s>
<s>
Despite	O
the	O
fact	O
that	O
Fisher	O
's	O
test	O
gives	O
exact	O
p-values	B-General_Concept
,	O
some	O
authors	O
have	O
argued	O
that	O
it	O
is	O
conservative	O
,	O
i.e.	O
</s>
<s>
that	O
its	O
actual	O
rejection	O
rate	O
is	O
below	O
the	O
nominal	O
significance	B-General_Concept
level	I-General_Concept
.	O
</s>
<s>
The	O
apparent	O
contradiction	O
stems	O
from	O
the	O
combination	O
of	O
a	O
discrete	O
statistic	O
with	O
fixed	O
significance	B-General_Concept
levels	I-General_Concept
.	O
</s>
<s>
To	O
be	O
more	O
precise	O
,	O
consider	O
the	O
following	O
proposal	O
for	O
a	O
significance	O
test	O
at	O
the	O
5%	O
-level	O
:	O
reject	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
for	O
each	O
table	O
to	O
which	O
Fisher	O
's	O
test	O
assigns	O
a	O
p-value	B-General_Concept
equal	O
to	O
or	O
smaller	O
than	O
5%	O
.	O
</s>
<s>
If	O
is	O
the	O
largest	O
p-value	B-General_Concept
smaller	O
than	O
5%	O
which	O
can	O
actually	O
occur	O
for	O
some	O
table	O
,	O
then	O
the	O
proposed	O
test	O
effectively	O
tests	O
at	O
the	O
-level	O
.	O
</s>
<s>
While	O
this	O
effect	O
occurs	O
for	O
any	O
discrete	O
statistic	O
(	O
not	O
just	O
in	O
contingency	B-Application
tables	I-Application
,	O
or	O
for	O
Fisher	O
's	O
test	O
)	O
,	O
it	O
has	O
been	O
argued	O
that	O
the	O
problem	O
is	O
compounded	O
by	O
the	O
fact	O
that	O
Fisher	O
's	O
test	O
conditions	O
on	O
the	O
marginals	O
.	O
</s>
<s>
To	O
avoid	O
the	O
problem	O
,	O
many	O
authors	O
discourage	O
the	O
use	O
of	O
fixed	O
significance	B-General_Concept
levels	I-General_Concept
when	O
dealing	O
with	O
discrete	O
problems	O
.	O
</s>
<s>
The	O
p-values	B-General_Concept
derived	O
from	O
Fisher	O
's	O
test	O
come	O
from	O
the	O
distribution	O
that	O
conditions	O
on	O
the	O
margin	O
totals	O
.	O
</s>
<s>
It	O
is	O
possible	O
to	O
obtain	O
an	O
exact	O
p-value	B-General_Concept
for	O
the	O
2×2	O
table	O
when	O
the	O
margins	O
are	O
not	O
held	O
fixed	O
.	O
</s>
<s>
Barnard	B-General_Concept
's	I-General_Concept
test	I-General_Concept
,	O
for	O
example	O
,	O
allows	O
for	O
random	O
margins	O
.	O
</s>
<s>
However	O
,	O
some	O
authors	O
(	O
including	O
,	O
later	O
,	O
Barnard	O
himself	O
)	O
have	O
criticized	O
Barnard	B-General_Concept
's	I-General_Concept
test	I-General_Concept
based	O
on	O
this	O
property	O
.	O
</s>
<s>
An	O
alternative	O
exact	B-General_Concept
test	I-General_Concept
,	O
Barnard	B-General_Concept
's	I-General_Concept
exact	I-General_Concept
test	I-General_Concept
,	O
has	O
been	O
developed	O
and	O
proponents	O
of	O
it	O
suggest	O
that	O
this	O
method	O
is	O
more	O
powerful	O
,	O
particularly	O
in	O
2×2	O
tables	O
.	O
</s>
<s>
Furthermore	O
,	O
Boschloo	B-General_Concept
's	I-General_Concept
test	I-General_Concept
is	O
an	O
exact	B-General_Concept
test	I-General_Concept
that	O
is	O
uniformly	O
more	O
powerful	O
than	O
Fisher	B-General_Concept
's	I-General_Concept
exact	I-General_Concept
test	I-General_Concept
by	O
construction	O
.	O
</s>
<s>
Another	O
alternative	O
is	O
to	O
use	O
maximum	O
likelihood	O
estimates	O
to	O
calculate	O
a	O
p-value	B-General_Concept
from	O
the	O
exact	O
binomial	O
or	O
multinomial	O
distributions	O
and	O
reject	O
or	O
fail	O
to	O
reject	O
based	O
on	O
the	O
p-value	B-General_Concept
.	O
</s>
<s>
For	O
stratified	O
categorical	O
data	O
the	O
Cochran	B-General_Concept
–	I-General_Concept
Mantel	I-General_Concept
–	I-General_Concept
Haenszel	I-General_Concept
test	I-General_Concept
must	O
be	O
used	O
instead	O
of	O
Fisher	O
's	O
test	O
.	O
</s>
<s>
propose	O
a	O
p-value	B-General_Concept
derived	O
from	O
the	O
likelihood	O
ratio	O
test	O
based	O
on	O
the	O
conditional	O
distribution	O
of	O
the	O
odds	O
ratio	O
given	O
the	O
marginal	O
success	O
rate	O
.	O
</s>
<s>
This	O
p-value	B-General_Concept
is	O
inferentially	O
consistent	O
with	O
classical	O
tests	O
of	O
normally	O
distributed	O
data	O
as	O
well	O
as	O
with	O
likelihood	O
ratios	O
and	O
support	O
intervals	O
based	O
on	O
this	O
conditional	O
likelihood	O
function	O
.	O
</s>
