<s>
Pearson	B-General_Concept
's	I-General_Concept
chi-squared	I-General_Concept
test	I-General_Concept
(	O
)	O
is	O
a	O
statistical	O
test	O
applied	O
to	O
sets	O
of	O
categorical	O
data	O
to	O
evaluate	O
how	O
likely	O
it	O
is	O
that	O
any	O
observed	O
difference	O
between	O
the	O
sets	O
arose	O
by	O
chance	O
.	O
</s>
<s>
It	O
is	O
the	O
most	O
widely	O
used	O
of	O
many	O
chi-squared	B-General_Concept
tests	I-General_Concept
(	O
e.g.	O
,	O
Yates	B-General_Concept
,	O
likelihood	B-General_Concept
ratio	I-General_Concept
,	O
portmanteau	O
test	O
in	O
time	O
series	O
,	O
etc	O
.	O
)	O
</s>
<s>
In	O
contexts	O
where	O
it	O
is	O
important	O
to	O
improve	O
a	O
distinction	O
between	O
the	O
test	B-General_Concept
statistic	I-General_Concept
and	O
its	O
distribution	O
,	O
names	O
similar	O
to	O
Pearson	O
χ-squared	O
test	O
or	O
statistic	O
are	O
used	O
.	O
</s>
<s>
It	O
tests	O
a	O
null	B-General_Concept
hypothesis	I-General_Concept
stating	O
that	O
the	O
frequency	O
distribution	O
of	O
certain	O
events	O
observed	O
in	O
a	O
sample	O
is	O
consistent	O
with	O
a	O
particular	O
theoretical	O
distribution	O
.	O
</s>
<s>
Pearson	B-General_Concept
's	I-General_Concept
chi-squared	I-General_Concept
test	I-General_Concept
is	O
used	O
to	O
assess	O
three	O
types	O
of	O
comparison	O
:	O
goodness	O
of	O
fit	O
,	O
homogeneity	B-General_Concept
,	O
and	O
independence	O
.	O
</s>
<s>
A	O
test	O
of	O
homogeneity	B-General_Concept
compares	O
the	O
distribution	O
of	O
counts	O
for	O
two	O
or	O
more	O
groups	O
using	O
the	O
same	O
categorical	O
variable	O
(	O
e.g.	O
</s>
<s>
A	O
test	O
of	O
independence	O
assesses	O
whether	O
observations	O
consisting	O
of	O
measures	O
on	O
two	O
variables	O
,	O
expressed	O
in	O
a	O
contingency	B-Application
table	I-Application
,	O
are	O
independent	O
of	O
each	O
other	O
(	O
e.g.	O
</s>
<s>
Calculate	O
the	O
chi-squared	B-General_Concept
test	I-General_Concept
statistic	O
,	O
,	O
which	O
resembles	O
a	O
normalized	O
sum	O
of	O
squared	O
deviations	O
between	O
observed	O
and	O
theoretical	O
frequencies	O
(	O
see	O
below	O
)	O
.	O
</s>
<s>
For	O
a	O
test	O
of	O
homogeneity	B-General_Concept
,	O
,	O
where	O
Rows	O
corresponds	O
to	O
the	O
number	O
of	O
categories	O
(	O
i.e.	O
</s>
<s>
rows	O
in	O
the	O
associated	O
contingency	B-Application
table	I-Application
)	O
,	O
and	O
Cols	O
corresponds	O
to	O
the	O
number	O
of	O
independent	O
groups	O
(	O
i.e.	O
</s>
<s>
columns	O
in	O
the	O
associated	O
contingency	B-Application
table	I-Application
)	O
.	O
</s>
<s>
Select	O
a	O
desired	O
level	O
of	O
confidence	O
(	O
significance	B-General_Concept
level	I-General_Concept
,	O
p-value	B-General_Concept
,	O
or	O
the	O
corresponding	O
alpha	O
level	O
)	O
for	O
the	O
result	O
of	O
the	O
test	O
.	O
</s>
<s>
Sustain	O
or	O
reject	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
that	O
the	O
observed	O
frequency	O
distribution	O
is	O
the	O
same	O
as	O
the	O
theoretical	O
distribution	O
based	O
on	O
whether	O
the	O
test	B-General_Concept
statistic	I-General_Concept
exceeds	O
the	O
critical	O
value	O
of	O
.	O
</s>
<s>
If	O
the	O
test	B-General_Concept
statistic	I-General_Concept
exceeds	O
the	O
critical	O
value	O
of	O
,	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
(	O
=	O
there	O
is	O
no	O
difference	O
between	O
the	O
distributions	O
)	O
can	O
be	O
rejected	O
,	O
and	O
the	O
alternative	B-General_Concept
hypothesis	I-General_Concept
(	O
=	O
there	O
is	O
a	O
difference	O
between	O
the	O
distributions	O
)	O
can	O
be	O
accepted	O
,	O
both	O
with	O
the	O
selected	O
level	O
of	O
confidence	O
.	O
</s>
<s>
If	O
the	O
test	B-General_Concept
statistic	I-General_Concept
falls	O
below	O
the	O
threshold	O
value	O
,	O
then	O
no	O
clear	O
conclusion	O
can	O
be	O
reached	O
,	O
and	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
is	O
sustained	O
(	O
we	O
fail	O
to	O
reject	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
)	O
,	O
though	O
not	O
necessarily	O
accepted	O
.	O
</s>
<s>
The	O
degrees	O
of	O
freedom	O
are	O
not	O
based	O
on	O
the	O
number	O
of	O
observations	O
as	O
with	O
a	O
Student	O
's	O
t	O
or	O
F-distribution	B-General_Concept
.	O
</s>
<s>
=	O
Pearson	O
's	O
cumulative	O
test	B-General_Concept
statistic	I-General_Concept
,	O
which	O
asymptotically	O
approaches	O
a	O
distribution	O
.	O
</s>
<s>
The	O
chi-squared	B-General_Concept
statistic	I-General_Concept
can	O
then	O
be	O
used	O
to	O
calculate	O
a	O
p-value	B-General_Concept
by	O
comparing	O
the	O
value	O
of	O
the	O
statistic	O
to	O
a	O
chi-squared	O
distribution	O
.	O
</s>
<s>
The	O
result	O
about	O
the	O
numbers	O
of	O
degrees	O
of	O
freedom	O
is	O
valid	O
when	O
the	O
original	O
data	O
are	O
multinomial	O
and	O
hence	O
the	O
estimated	O
parameters	O
are	O
efficient	O
for	O
minimizing	O
the	O
chi-squared	B-General_Concept
statistic	I-General_Concept
.	O
</s>
<s>
If	O
one	O
took	O
a	O
uniform	O
prior	O
,	O
then	O
the	O
maximum	O
likelihood	O
estimate	O
for	O
the	O
population	O
probability	O
is	O
the	O
observed	O
probability	O
,	O
and	O
one	O
may	O
compute	O
a	O
credible	B-General_Concept
region	I-General_Concept
around	O
this	O
or	O
another	O
estimate	O
.	O
</s>
<s>
In	O
this	O
case	O
,	O
an	O
"	O
observation	O
"	O
consists	O
of	O
the	O
values	O
of	O
two	O
outcomes	O
and	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
is	O
that	O
the	O
occurrence	O
of	O
these	O
outcomes	O
is	O
statistically	O
independent	O
.	O
</s>
<s>
Each	O
observation	O
is	O
allocated	O
to	O
one	O
cell	O
of	O
a	O
two-dimensional	O
array	O
of	O
cells	O
(	O
called	O
a	O
contingency	B-Application
table	I-Application
)	O
according	O
to	O
the	O
values	O
of	O
the	O
two	O
outcomes	O
.	O
</s>
<s>
For	O
the	O
test	O
of	O
independence	O
,	O
also	O
known	O
as	O
the	O
test	O
of	O
homogeneity	B-General_Concept
,	O
a	O
chi-squared	O
probability	O
of	O
less	O
than	O
or	O
equal	O
to	O
0.05	O
(	O
or	O
the	O
chi-squared	B-General_Concept
statistic	I-General_Concept
being	O
at	O
or	O
larger	O
than	O
the	O
0.05	O
critical	O
point	O
)	O
is	O
commonly	O
interpreted	O
by	O
applied	O
workers	O
as	O
justification	O
for	O
rejecting	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
that	O
the	O
row	O
variable	O
is	O
independent	O
of	O
the	O
column	O
variable	O
.	O
</s>
<s>
The	O
alternative	B-General_Concept
hypothesis	I-General_Concept
corresponds	O
to	O
the	O
variables	O
having	O
an	O
association	O
or	O
relationship	O
where	O
the	O
structure	O
of	O
this	O
relationship	O
is	O
not	O
specified	O
.	O
</s>
<s>
The	O
chi-squared	B-General_Concept
test	I-General_Concept
,	O
when	O
used	O
with	O
the	O
standard	O
approximation	O
that	O
a	O
chi-squared	O
distribution	O
is	O
applicable	O
,	O
has	O
the	O
following	O
assumptions	O
:	O
</s>
<s>
If	O
a	O
chi	B-General_Concept
squared	I-General_Concept
test	I-General_Concept
is	O
conducted	O
on	O
a	O
sample	O
with	O
a	O
smaller	O
size	O
,	O
then	O
the	O
chi	B-General_Concept
squared	I-General_Concept
test	I-General_Concept
will	O
yield	O
an	O
inaccurate	O
inference	O
.	O
</s>
<s>
The	O
researcher	O
,	O
by	O
using	O
chi	B-General_Concept
squared	I-General_Concept
test	I-General_Concept
on	O
small	O
samples	O
,	O
might	O
end	O
up	O
committing	O
a	O
Type	O
II	O
error	O
.	O
</s>
<s>
When	O
this	O
assumption	O
is	O
not	O
met	O
,	O
Yates	B-General_Concept
's	I-General_Concept
correction	I-General_Concept
is	O
applied	O
.	O
</s>
<s>
In	O
those	O
cases	O
,	O
McNemar	B-General_Concept
's	I-General_Concept
test	I-General_Concept
may	O
be	O
more	O
appropriate	O
.	O
</s>
<s>
A	O
test	O
that	O
relies	O
on	O
different	O
assumptions	O
is	O
Fisher	B-General_Concept
's	I-General_Concept
exact	I-General_Concept
test	I-General_Concept
;	O
if	O
its	O
assumption	O
of	O
fixed	O
marginal	O
distributions	O
is	O
met	O
it	O
is	O
substantially	O
more	O
accurate	O
in	O
obtaining	O
a	O
significance	B-General_Concept
level	I-General_Concept
,	O
especially	O
with	O
few	O
observations	O
.	O
</s>
<s>
In	O
the	O
vast	O
majority	O
of	O
applications	O
this	O
assumption	O
will	O
not	O
be	O
met	O
,	O
and	O
Fisher	B-General_Concept
's	I-General_Concept
exact	I-General_Concept
test	I-General_Concept
will	O
be	O
over	O
conservative	O
and	O
not	O
have	O
correct	O
coverage	O
.	O
</s>
<s>
This	O
approximation	O
arises	O
as	O
the	O
true	O
distribution	O
,	O
under	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
,	O
if	O
the	O
expected	O
value	O
is	O
given	O
by	O
a	O
multinomial	O
distribution	O
.	O
</s>
<s>
p	O
=	O
probability	O
,	O
under	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
,	O
</s>
<s>
If	O
n	O
is	O
sufficiently	O
large	O
,	O
the	O
above	O
binomial	O
distribution	O
may	O
be	O
approximated	O
by	O
a	O
Gaussian	O
(	O
normal	O
)	O
distribution	O
and	O
thus	O
the	O
Pearson	B-General_Concept
test	I-General_Concept
statistic	O
approximates	O
a	O
chi-squared	O
distribution	O
,	O
</s>
<s>
The	O
chi-squared	O
distribution	O
is	O
then	O
integrated	O
on	O
the	O
right	O
of	O
the	O
statistic	O
value	O
to	O
obtain	O
the	O
P-value	B-General_Concept
,	O
which	O
is	O
equal	O
to	O
the	O
probability	O
of	O
getting	O
a	O
statistic	O
equal	O
or	O
bigger	O
than	O
the	O
observed	O
one	O
,	O
assuming	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
.	O
</s>
<s>
When	O
the	O
test	O
is	O
applied	O
to	O
a	O
contingency	B-Application
table	I-Application
containing	O
two	O
rows	O
and	O
two	O
columns	O
,	O
the	O
test	O
is	O
equivalent	O
to	O
a	O
Z-test	B-General_Concept
of	O
proportions	O
.	O
</s>
<s>
One	O
may	O
apply	O
an	O
orthogonal	O
change	O
of	O
variables	O
to	O
turn	O
the	O
limiting	O
summands	O
in	O
the	O
test	B-General_Concept
statistic	I-General_Concept
into	O
one	O
fewer	O
squares	O
of	O
i.i.d.	O
</s>
<s>
Let	O
be	O
Pearson	O
's	O
cumulative	O
test	B-General_Concept
statistic	I-General_Concept
for	O
such	O
a	O
configuration	O
,	O
and	O
let	O
be	O
the	O
distribution	O
of	O
this	O
statistic	O
.	O
</s>
<s>
is	O
a	O
regular	O
symmetric	O
matrix	O
,	O
and	O
hence	O
diagonalizable	B-Algorithm
.	O
</s>
<s>
Is	O
the	O
die	O
biased	O
,	O
according	O
to	O
the	O
Pearson	B-General_Concept
's	I-General_Concept
chi-squared	I-General_Concept
test	I-General_Concept
at	O
a	O
significance	B-General_Concept
level	I-General_Concept
of	O
95%	O
and/or	O
99%	O
?	O
</s>
<s>
The	O
null	B-General_Concept
hypothesis	I-General_Concept
is	O
that	O
the	O
die	O
is	O
unbiased	O
,	O
hence	O
each	O
number	O
is	O
expected	O
to	O
occur	O
the	O
same	O
number	O
of	O
times	O
,	O
in	O
this	O
case	O
,	O
=	O
10	O
.	O
</s>
<s>
We	O
then	O
consult	O
an	O
Upper-tail	O
critical	O
values	O
of	O
chi-square	B-General_Concept
distribution	O
table	O
,	O
the	O
tabular	O
value	O
refers	O
to	O
the	O
sum	O
of	O
the	O
squared	O
variables	O
each	O
divided	O
by	O
the	O
expected	O
outcomes	O
.	O
</s>
<s>
The	O
experimental	O
sum	O
of	O
13.4	O
is	O
between	O
the	O
critical	O
values	O
of	O
97.5	O
%	O
and	O
99%	O
significance	O
or	O
confidence	O
(	O
p-value	B-General_Concept
)	O
.	O
</s>
<s>
In	O
this	O
context	O
,	O
the	O
frequencies	O
of	O
both	O
theoretical	O
and	O
empirical	O
distributions	O
are	O
unnormalised	O
counts	O
,	O
and	O
for	O
a	O
chi-squared	B-General_Concept
test	I-General_Concept
the	O
total	O
sample	O
sizes	O
of	O
both	O
these	O
distributions	O
(	O
sums	O
of	O
all	O
cells	O
of	O
the	O
corresponding	O
contingency	B-Application
tables	I-Application
)	O
have	O
to	O
be	O
the	O
same	O
.	O
</s>
<s>
If	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
is	O
true	O
(	O
i.e.	O
,	O
men	O
and	O
women	O
are	O
chosen	O
with	O
equal	O
probability	O
)	O
,	O
the	O
test	B-General_Concept
statistic	I-General_Concept
will	O
be	O
drawn	O
from	O
a	O
chi-squared	O
distribution	O
with	O
one	O
degree	O
of	O
freedom	O
(	O
because	O
if	O
the	O
male	O
frequency	O
is	O
known	O
,	O
then	O
the	O
female	O
frequency	O
is	O
determined	O
)	O
.	O
</s>
<s>
This	O
probability	O
is	O
higher	O
than	O
conventional	O
criteria	O
for	O
statistical	B-General_Concept
significance	I-General_Concept
(	O
0.01	O
or	O
0.05	O
)	O
,	O
so	O
normally	O
we	O
would	O
not	O
reject	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
that	O
the	O
number	O
of	O
men	O
in	O
the	O
population	O
is	O
the	O
same	O
as	O
the	O
number	O
of	O
women	O
(	O
i.e.	O
,	O
we	O
would	O
consider	O
our	O
sample	O
within	O
the	O
range	O
of	O
what	O
we	O
would	O
expect	O
for	O
a	O
50/50	O
male/female	O
ratio	O
.	O
)	O
</s>
<s>
In	O
this	O
case	O
,	O
a	O
better	O
approximation	O
can	O
be	O
obtained	O
by	O
reducing	O
the	O
absolute	O
value	O
of	O
each	O
difference	O
between	O
observed	O
and	O
expected	O
frequencies	O
by	O
0.5	O
before	O
squaring	O
;	O
this	O
is	O
called	O
Yates	B-General_Concept
's	I-General_Concept
correction	I-General_Concept
for	I-General_Concept
continuity	I-General_Concept
.	O
</s>
<s>
In	O
cases	O
where	O
the	O
expected	O
value	O
,	O
E	O
,	O
is	O
found	O
to	O
be	O
small	O
(	O
indicating	O
a	O
small	O
underlying	O
population	O
probability	O
,	O
and/or	O
a	O
small	O
number	O
of	O
observations	O
)	O
,	O
the	O
normal	O
approximation	O
of	O
the	O
multinomial	O
distribution	O
can	O
fail	O
,	O
and	O
in	O
such	O
cases	O
it	O
is	O
found	O
to	O
be	O
more	O
appropriate	O
to	O
use	O
the	O
G-test	B-General_Concept
,	O
a	O
likelihood	O
ratio-based	O
test	B-General_Concept
statistic	I-General_Concept
.	O
</s>
<s>
When	O
the	O
total	O
sample	O
size	O
is	O
small	O
,	O
it	O
is	O
necessary	O
to	O
use	O
an	O
appropriate	O
exact	O
test	O
,	O
typically	O
either	O
the	O
binomial	B-General_Concept
test	I-General_Concept
or	O
,	O
for	O
contingency	B-Application
tables	I-Application
,	O
Fisher	B-General_Concept
's	I-General_Concept
exact	I-General_Concept
test	I-General_Concept
.	O
</s>
<s>
This	O
test	O
uses	O
the	O
conditional	O
distribution	O
of	O
the	O
test	B-General_Concept
statistic	I-General_Concept
given	O
the	O
marginal	O
totals	O
,	O
and	O
thus	O
assumes	O
that	O
the	O
margins	O
were	O
determined	O
before	O
the	O
study	O
;	O
alternatives	O
such	O
as	O
Boschloo	B-General_Concept
's	I-General_Concept
test	I-General_Concept
which	O
do	O
not	O
make	O
this	O
assumption	O
are	O
uniformly	B-General_Concept
more	I-General_Concept
powerful	I-General_Concept
.	O
</s>
