You are on page 1of 4

Chi-square test

When the chi-square test is mentioned without any modiers or without other precluding context, this test is often
meant (for an exact test used in place of 2 , see Fishers
exact test).

1.2 Yatess correction for continuity


Main article: Yatess correction for continuity
Using the chi-square distribution to interpret Pearsons
chi-square statistic requires one to assume that the
discrete probability of observed binomial frequencies in
the table can be approximated by the continuous chisquare distribution. This assumption is not quite correct,
and introduces some error.

Chi-square distribution, showing X2 on the x-axis and P-value


on the y-axis.

To reduce the error in approximation, Frank Yates, an


English statistician, suggested a correction for continuity that adjusts the formula for Pearsons chi-square test
by subtracting 0.5 from the dierence between each observed value and its expected value in a 2 2 contingency
table.[1] This reduces the chi-square value obtained and
thus increases its p-value.

A chi-square test, also referred to as 2 test (infrequently as the chi-squared test), is any statistical
hypothesis test in which the sampling distribution of the
test statistic is a chi-square distribution when the null hypothesis is true. Also considered a chi-square test is a test
in which this is asymptotically true, meaning that the sampling distribution (if the null hypothesis is true) can be
made to approximate a chi-square distribution as closely
as desired by making the sample size large enough. The
chi-square (I) test is used to determine whether there is a
signicant dierence between the expected frequencies
and the observed frequencies in one or more categories.
Does the number of individuals or objects that fall in each
category dier signicantly from the number you would
expect? Is this dierence between the expected and observed due to sampling variation, or is it a real dierence?

1.3 Other chi-square tests


CochranMantelHaenszel chi-square test.
McNemars test, used in certain 2 2 tables with
pairing
Tukeys test of additivity
The portmanteau test in time-series analysis, testing
for the presence of autocorrelation
Likelihood-ratio tests in general statistical modelling, for testing whether there is evidence of the
need to move from a simple model to a more complicated one (where the simple model is nested within
the complicated one).

Examples of chi-square tests


with samples

The following are examples of chi-square tests where the


chi-square distribution is approximately valid:

2 Exact chi-square distribution


1.1

Pearsons chi-square test

One case where the distribution of the test statistic is an


exact chi-square distribution is the test that the variance
Main article: Pearsons chi-square test
of a normally distributed population has a given value
based on a sample variance. Such a test is uncommon
Pearsons chi-square test, also known as the chi-square in practice because values of variances to test against are
goodness-of-t test or chi-square test for independence. seldom known exactly.
1

REFERENCES

Chi-square test for variance in a


normal population

If the test statistic is improbably large according to that


chi-square distribution, then one rejects the null hypothesis of independence.

If a sample of size n is taken from a population having a


normal distribution, then there is a result (see distribution
of the sample variance) which allows a test to be made
of whether the variance of the population has a predetermined value. For example, a manufacturing process
might have been in stable condition for a long period, allowing a value for the variance to be determined essentially without error. Suppose that a variant of the process
is being tested, giving rise to a small sample of n product
items whose variation is to be tested. The test statistic
T in this instance could be set to be the sum of squares
about the sample mean, divided by the nominal value for
the variance (i.e. the value to be tested as holding). Then
T has a chi-square distribution with n 1 degrees of freedom. For example if the sample size is 21, the acceptance
region for T for a signicance level of 5% is the interval
9.59 to 34.17.

A related issue is a test of homogeneity. Suppose that


instead of giving every resident of each of the four neighborhoods an equal chance of inclusion in the sample, we
decide in advance how many residents of each neighborhood to include. Then each resident has the same chance
of being chosen as do all residents of the same neighborhood, but residents of dierent neighborhoods would
have dierent probabilities of being chosen if the four
sample sizes are not proportional to the populations of
the four neighborhoods. In such a case, we would be
testing homogeneity rather than independence. The
question is whether the proportions of blue-collar, whitecollar, and service workers in the four neighborhoods are
the same. However, the test is done in the same way.

5 Applications

In cryptanalysis, chi-square test is used to compare


4 Chi-square test for independence the distribution of plaintext and (possibly) decrypted
ciphertext. The lowest value of the test means that the
and homogeneity in tables
decryption was successful with high probability.[2][3] This
method can be generalized for solving modern cryptoSuppose a random sample of 650 of the 1 million resi- graphic problems.[4]
dents of a city is taken, in which every resident of each of
four neighborhoods, A, B, C, and D, is equally likely to
be chosen. A null hypothesis says the randomly chosen 6 See also
persons neighborhood of residence is independent of the
persons occupational classication, which is either blue
Chi-square test nomogram
collar, white collar, or service. The data are tabulated:
G-test
Let us take the sample proportion living in neighborhood
A, 150/650, to estimate what proportion of the whole 1
million people live in neighborhood A. Similarly we take
349/650 to estimate what proportion of the 1 million people are blue-collar workers. Then the null hypothesis independence tells us that we should expect the number
of blue-collar workers in neighborhood A to be
150 349

650 80.54.
650 650
Then in that cell of the table, we have
(90 80.54)2
(observed expected)2
=
.
expected
80.54
The sum of these quantities over all of the cells is the test
statistic. Under the null hypothesis, it has approximately a
chi-square distribution whose number of degrees of freedom is

Minimum chi-square estimation


The Wald test can be evaluated against a chi-square
distribution.

7 References
[1] Yates, F (1934). Contingency table involving small numbers and the 2 test. Supplement to the Journal of the
Royal Statistical Society 1(2): 217235. JSTOR 2983604
[2] Chi-squared Statistic. Practical Cryptography.
trieved 18 February 2015.

Re-

[3] Using Chi Squared to Crack Codes. IB Maths Resources.


British International School Phuket.
[4] Ryabko, B.Ya.; Stognienko, V.S.; Shokin, Yu.I. (2004).
A new test for randomness and its application to some
cryptographic problems. Journal of Statistical Planning
and Inference 123: 365 376. Retrieved 18 February
2015.

(rows of number1)(columns of number1) = (31)(41)=Weisstein,


6.
Eric W., Chi-Square Test, MathWorld.

3
Corder, G.W. & Foreman, D.I. (2014). Nonparametric Statistics: A Step-by-Step Approach. Wiley,
New York. ISBN 978-1118840313
Greenwood, P.E., Nikulin, M.S. (1996) A guide to
chi-square testing. Wiley, New York. ISBN 0-47155779-X
Nikulin, M.S. (1973). Chi-square test for normality. In: Proceedings of the International Vilnius
Conference on Probability Theory and Mathematical Statistics, v.2, pp. 119122.
Bagdonavicius, V., Nikulin, M.S. (2011) Chisquare goodness-of-t test for right censored data.
The International Journal of Applied Mathematics
and Statistics, p. 30-50.

8 TEXT AND IMAGE SOURCES, CONTRIBUTORS, AND LICENSES

Text and image sources, contributors, and licenses

8.1

Text

Chi-square test Source: http://en.wikipedia.org/wiki/Chi-square%20test?oldid=651972639 Contributors: The Anome, Matusz, Michael


Hardy, Tomi, Karada, Ronz, Ciphergoth, Jtzg, Mxn, Silversh, Crissov, Robbot, Giftlite, Andris, Matt Crypto, MarkSweep, Piotrus,
Elektron, Rich Farmbrough, Cap'n Refsmmat, Kwamikagami, Smalljim, PAR, Stefan.karpinski, Spangineer, Wtmitchell, Falcorian, Bluemoose, Aatombomb, Strait, MZMcBride, JoseMires, Intgr, Pstevens, YurikBot, Wavelength, Darker Dreams, DYLAN LENNON, Avraham, Arthur Rubin, Reyk, SmackBot, Turadg, Nbarth, Scwlong, Whpq, Bowlhover, G716, Lambiam, Cronholm144, Loodog, Tim bates,
Smith609, Beetstra, Chris53516, Usgnus, Dgw, Requestion, WeggeBot, Steel, Karuna8, Talgalili, Thijs!bot, Adjespers, Itsmejudith, AntiVandalBot, ReviewDude, Seaphoto, Johannes Simon, Ranger2006, Baccyak4H, KenyaSong, Serviscope Minor, MartinBot, Poeloq, Lbeaumont, Khatterj, JoshuaEyer, STBotD, VolkovBot, Pleasantville, Grotendeels Onschadelijk, Synthebot, Ignoscient, SieBot, Matthew Yeager,
Quest for Truth, Svick, Melcombe, Digisus, Tuxa, Animeronin, ClueBot, Muhandes, Qwfp, Tdslk, WikHead, SilvonenBot, Sindbad72,
Tayste, Addbot, Luzingit, Doronp, MrOllie, Bhdavis1978, Legobot, Luckas-bot, Yobot, Amirobot, AnomieBOT, Walter Grassroot, Unara,
Jtamad, KuRiZu, GrouchoBot, Joxemai, Thehelpfulbot, Pinethicket, I dream of horses, Madonius, Kastchei, EmausBot, Kgwet, Lolcatsdeamon13, Orange Suede Sofa, ClueBot NG, Ion vasilief, Epfuerst, Helpful Pixie Bot, Evcifreo, Chafe66, Jf.alcover, Aymankamelwiki,
Brirush, RichardMarioFratini, MNikulin, EJM86, BethNaught, Hannasnow, Iwilsonp, Pentaquark and Anonymous: 137

8.2

Images

File:Chi-square_distributionCDF-English.png
Source:
http://upload.wikimedia.org/wikipedia/commons/8/8e/Chi-square_
distributionCDF-English.png License: Public domain Contributors: File:Chi-square distributionCDF.png Original artist: Mikael
Hggstrm
File:Commons-logo.svg Source: http://upload.wikimedia.org/wikipedia/en/4/4a/Commons-logo.svg License: ? Contributors: ? Original
artist: ?
File:Fisher_iris_versicolor_sepalwidth.svg Source: http://upload.wikimedia.org/wikipedia/commons/4/40/Fisher_iris_versicolor_
sepalwidth.svg License: CC BY-SA 3.0 Contributors: en:Image:Fisher iris versicolor sepalwidth.png Original artist: en:User:Qwfp (original); Pbroks13 (talk) (redraw)
File:Folder_Hexagonal_Icon.svg Source: http://upload.wikimedia.org/wikipedia/en/4/48/Folder_Hexagonal_Icon.svg License: Cc-bysa-3.0 Contributors: ? Original artist: ?
File:People_icon.svg Source: http://upload.wikimedia.org/wikipedia/commons/3/37/People_icon.svg License: CC0 Contributors: OpenClipart Original artist: OpenClipart
File:Portal-puzzle.svg Source: http://upload.wikimedia.org/wikipedia/en/f/fd/Portal-puzzle.svg License: Public domain Contributors: ?
Original artist: ?
File:Text_document_with_red_question_mark.svg Source: http://upload.wikimedia.org/wikipedia/commons/a/a4/Text_document_
with_red_question_mark.svg License: Public domain Contributors: Created by bdesham with Inkscape; based upon Text-x-generic.svg
from the Tango project. Original artist: Benjamin D. Esham (bdesham)

8.3

Content license

Creative Commons Attribution-Share Alike 3.0

You might also like