Skip to content

Commit

Permalink
DOC: Broaden Exact Test Reference
Browse files Browse the repository at this point in the history
* Broadens reference to exact tests.
* Adds Barnard's Exact as a less conservative, unconditional alternative to Fisher's Exact.

Co-authored-by: Tirth Patel <tirthasheshpatel@gmail.com>
Co-authored-by: Daniel Scott <info@synapseproduction.com>
Co-authored-by: Pamphile ROY <roy.pamphile@gmail.com>
  • Loading branch information
4 people committed May 18, 2021
1 parent 6667d4b commit e2b0a21
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scipy/stats/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -6663,18 +6663,18 @@ def chisquare(f_obs, f_exp=None, ddof=0, axis=0):
See Also
--------
scipy.stats.power_divergence
scipy.stats.fisher_exact : A more powerful alternative to the chisquare
test if any of the frequencies are less than 5.
scipy.stats.fisher_exact : Fisher exact test on a 2x2 contingency table.
scipy.stats.barnard_exact : An unconditional exact test. An alternative
to chi-squared test for small sample sizes.
Notes
-----
This test is invalid when the observed or expected frequencies in each
category are too small. A typical rule is that all of the observed
and expected frequencies should be at least 5. If one or more frequencies
are less than 5, Fisher's Exact Test can be used with greater statistical
power. According to [3]_, the total number of samples is recommended to be
greater than 13, otherwise a table-based method of obtaining p-values is
recommended.
and expected frequencies should be at least 5. According to [3]_, the
total number of samples is recommended to be greater than 13,
otherwise exact tests (such as Barnard's Exact test) should be used
because they do not overreject.
Also, the sum of the observed and expected frequencies must be the same
for the test to be valid; `chisquare` raises an error if the sums do not
Expand All @@ -6696,7 +6696,7 @@ def chisquare(f_obs, f_exp=None, ddof=0, axis=0):
.. [2] "Chi-squared test", https://en.wikipedia.org/wiki/Chi-squared_test
.. [3] Pearson, Karl. "On the criterion that a given system of deviations from the probable
in the case of a correlated system of variables is such that it can be reasonably
supposed to have arisen from random sampling", Philosophical Magazine. Series 5. 50
supposed to have arisen from random sampling", Philosophical Magazine. Series 5. 50
(1900), pp. 157-175.
Examples
Expand Down

0 comments on commit e2b0a21

Please sign in to comment.