Home

ChiQuadratTest

ChiQuadratTest, commonly referred to as the chi-squared test, is a statistical hypothesis test used for categorical data to assess how well observed frequencies match expected frequencies under a null hypothesis. It is employed in two main settings: goodness-of-fit tests, where a single categorical distribution is compared to a specified model, and tests of independence, where the relationship between two categorical variables is evaluated in a contingency table.

The test statistic is X^2 = sum over all categories of (O_i − E_i)^2 / E_i, where O_i are

Key assumptions include independent observations, mutually exclusive categories, and adequately large expected counts (commonly E_i ≥ 5).

observed
counts
and
E_i
are
expected
counts
under
the
null
hypothesis.
The
chi-squared
distribution
is
used
to
approximate
the
sampling
distribution
of
X^2
for
sufficiently
large
sample
sizes.
Degrees
of
freedom
depend
on
the
context:
for
goodness-of-fit,
df
=
k
−
1
with
k
categories;
for
a
contingency
table
with
r
rows
and
c
columns,
df
=
(r
−
1)(c
−
1).
A
p-value
derived
from
the
chi-squared
distribution
indicates
whether
to
reject
the
null
hypothesis
at
a
chosen
significance
level.
The
test
is
approximate;
for
small
samples
or
many
cells
with
low
expected
counts,
Fisher’s
exact
test
or
exact
methods
may
be
preferred.
Variants
include
the
Yates
continuity
correction
for
2×2
tables
and
the
likelihood-ratio
chi-squared
statistic.
Effect
size
measures
such
as
Cramér’s
V
or
the
phi
coefficient
provide
a
sense
of
practical
association.
ChiQuadratTest
is
implemented
in
statistical
software
under
functions
such
as
chi-squared
tests
for
goodness-of-fit
and
tests
of
independence.