This statistics calculator is intended for evaluation of the extent of difference between observed and expected frequencies. Enter the observed and expected values in the appropriate fields of this Chi Square Calculator and calculate the values of degrees of freedom, chi-square and corresponding P-value (right tail or left tail). You can paste the input data copied from a spreadsheet or csv-file or enter manually using comma, space or ‘enter’ as separators.
Chi Square Test
In probability theory and statistics, the chi-square distribution (also known as chi-squared or \({ \chi }^{ 2 }\)-distribution) with \(k\) degrees of freedom is the distribution of a sum of the squares of \(k\) independent standard normal random variables.
The expression for Pearson’s cumulative test statistic, which asymptotically approaches a \({ \chi } ^{2}\)-distribution, is as follows:
$${\displaystyle \chi ^{2}=\sum _{i=1}^{n}{\frac {(O_{i}-E_{i})^{2}}{E_{i}}}},$$
where \(O_{i}\) is the number of observations of type \(i\), \(E_{i}\) is the expected (theoretical) frequency of type \(i\), and \(n = k + 1\) is the number of types (categories) of observations. It’s evident from this equation that the closer the measured values are to those expected, the lower the chi-square sum will be.
The probability \(Q\) that a \({ \chi } ^{2}\) value calculated for an experiment with \(k\) degrees of freedom is due to chance (or, in other words, is consistent with the so called null hypothesis) is:
$${ Q }_{ { \chi }^{ 2 },k }={ \left[ { 2 }^{ k/2 }\Gamma \left( \frac { k }{ 2 } \right) \right] }^{ -1 }\int _{ { \chi }^{ 2 } }^{ \infty }{ { \left( t \right) }^{ \frac { k }{ 2 } -1 }{ e }^{ -\frac { t }{ 2 } }dt }, $$
where \(Γ\) is the gamma function, which is the generalization of the factorial function to real and complex arguments:
$$\Gamma \left( x \right) =\int _{ 0 }^{ \infty }{ { t }^{ x-1 }{ e }^{ -t }dt }. $$
In null hypothesis significance testing, the P-value is the probability of obtaining test results at least as extreme as the results actually observed, under the assumption that the null hypothesis is correct. A very small P-value means that such an extreme observed outcome would be very unlikely under the null hypothesis.
For a given test statistic \({ \chi } ^{2}\) the right-tail P-value is defined as:
$${ P }_{ right }\left( { \chi }^{ 2 },k \right) = { Q }_{ { \chi }^{ 2 },k },$$
and the left-tail P-value is defined as:
$${ P }_{ left }\left( { \chi }^{ 2 },k \right) = 1 – { Q }_{ { \chi }^{ 2 },k }.$$
So, this Chi-Square calculator can be used for Chi-Square goodness of fit test or simply to compare the observed sample distribution with the expected probability distribution. Generally speaking, if the right-tail P-value found for the calculated \({ \chi } ^{2}\) is higher than conventional criteria for statistical significance (0.001-0.05), we usually do not reject the null hypothesis and assume that all the differences are due to chance.
Related calculators
Check out our other statistics calculators such as Frequency Distribution Calculator or P-value Calculator.