Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Pearson's chi-squared test
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Examples== ===Fairness of dice=== A 6-sided die is thrown 60 times. The number of times it lands with 1, 2, 3, 4, 5 and 6 face up is 5, 8, 9, 8, 10 and 20, respectively. Is the die biased, according to the Pearson's chi-squared test at a significance level of 95% and/or 99%? The null hypothesis is that the die is unbiased, hence each number is expected to occur the same number of times, in this case, {{sfrac|60|''n''}} = 10. The outcomes can be tabulated as follows: {| class="wikitable" style="text-align:center;" |- ! style="padding:0 1em;"|<math> i</math> ! style="padding:0 1em;"|<math> O_i</math> ! style="padding:0 1em;"|<math> E_i</math> !<math> O_i - E_i</math> !<math> (O_i - E_i)^2</math> |- | 1 || 5 || 10 || −5 || 25 |- | 2 || 8 || 10 || −2 || 4 |- | 3 || 9 || 10 || −1 || 1 |- | 4 || 8 || 10 || −2 || 4 |- | 5 || 10 || 10 || 0 || 0 |- | 6 || 20 || 10 || 10 || 100 |- | colspan="4" |Sum |134 |} We then consult an ''[https://www.itl.nist.gov/div898/handbook/eda/section3/eda3674.htm Upper-tail critical values of chi-square distribution]'' table, the tabular value refers to the sum of the squared variables each divided by the expected outcomes. For the present example, this means <math display="block">\chi^2 = \frac{25}{10} + \frac{4}{10} + \frac{1}{10} + \frac{4}{10} + \frac{0}{10} + \frac{100}{10} = 13.4 </math> This is the experimental result whose unlikeliness (with a fair die) we wish to estimate. {| class="wikitable" style="text-align:center;font-size:90%;line-height:0.9;" |- ! rowspan="2"|Degrees<br /> of<br />freedom ! colspan="5"|Probability less than the critical value |- ! 0.90 || ''0.95'' || 0.975 || ''0.99'' || 0.999 |- !5 | 9.236 || 11.070 || 12.833 || 15.086 || 20.515 |} The experimental sum of 13.4 is between the critical values of 97.5% and 99% significance or confidence ([[p-value]]). Specifically, getting 20 rolls of 6, when the expectation is only 10 such values, is unlikely with a fair die. ===Chi-squared goodness of fit test=== {{main|Goodness of fit}} In this context, the [[frequency distribution|frequencies]] of both theoretical and empirical distributions are unnormalised counts, and for a chi-squared test the total sample sizes <math>N</math> of both these distributions (sums of all cells of the corresponding [[contingency tables]]) have to be the same. For example, to test the hypothesis that a random sample of 100 people has been drawn from a population in which men and women are equal in frequency, the observed number of men and women would be compared to the theoretical frequencies of 50 men and 50 women. If there were 44 men in the sample and 56 women, then <math display="block"> \chi^2 = \frac{{\left(44 - 50\right)}^2}{50} + \frac{{\left(56 - 50\right)}^2}{50} = 1.44.</math> If the null hypothesis is true (i.e., men and women are chosen with equal probability), the test statistic will be drawn from a chi-squared distribution with one [[degrees of freedom (statistics)|degree of freedom]] (because if the male frequency is known, then the female frequency is determined). Consultation of the [[chi-squared distribution]] for 1 degree of freedom shows that the [[probability]] of observing this difference (or a more extreme difference than this) if men and women are equally numerous in the population is approximately 0.23. This probability is higher than conventional criteria for [[statistical significance]] (0.01 or 0.05), so normally we would not reject the null hypothesis that the number of men in the population is the same as the number of women (i.e., we would consider our sample within the range of what we would expect for a 50/50 male–female ratio.)
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)