Chi-Square Test Calculator

Enter observed counts, or a contingency table, to test whether they fit what you expect.

One count for each category, separated by commas or spaces.

Optional: one expected count for each category. Leave empty to expect an equal share in each.

Significance levelα\alpha

How unlikely a result must be, if the null hypothesis were true, before it is rejected.

Try

Result

You enteredO={25, 25, 25, 25}O = \left\{ 25,\ 25,\ 25,\ 25 \right\}

χ2=0, df=3, p=1, do not reject H0 at the 5% level\displaystyle \chi^2 = 0,\ \text{df} = 3,\ p = 1,\ \text{do not reject }H_0\text{ at the 5\% level}

p-value

1\displaystyle 1

Significance level

0.05\displaystyle 0.05

Decision

Do not reject H0\displaystyle \text{Do not reject } H_0
Show the work
  1. Null and alternative hypotheses

    The null hypothesis H0H_0 says every category is equally likely. The alternative hypothesis H1H_1 is what the test looks for, and it makes this a right-tailed test.

    H0:all categories are equally likelyH1:they are not all equally likely\begin{gathered} H_0: \text{all categories are equally likely} \\ H_1: \text{they are not all equally likely} \end{gathered}
  2. Expected counts

    If every one of the k=4k = 4 categories is equally likely, each expects an equal share of the total N=100N = 100.

    E=Nk=1004=25\begin{aligned} E &= \frac{N}{k} \\ &= \frac{100}{4} \\ &= 25 \end{aligned}
  3. Test statistic

    Each category contributes how far its observed count OO is from its expected count EE, squared and scaled by EE. There are k=4k = 4 categories, so ν=k−1=3\nu = k - 1 = 3 degrees of freedom.

    χ2=∑(O−E)2E=0+0+0+0=0\begin{aligned} \chi^2 &= \sum \frac{\left(O - E\right)^2}{E} \\ &= 0 + 0 + 0 + 0 \\ &= 0 \end{aligned}
  4. p-value

    The p-value is the probability, if H0H_0 were true, of a test statistic at least as extreme as the one observed. A chi-square test is always right-tailed: only a large statistic is evidence against the null hypothesis.

    p=P(χ32>0)=1\begin{aligned} p &= P\left(\chi^2_{3} > 0\right) \\ &= 1 \end{aligned}
  5. Decision

    Compare the p-value with the significance level α=0.05\alpha = 0.05: if p<αp < \alpha the result would be too unlikely under H0H_0, so reject it. Here it is not, so do not reject H0H_0: there is not enough evidence at the 5% level to say that the categories are not equally likely.

    p=1, α=0.05, p≥α⇒do not reject H0p = 1,\ \alpha = 0.05,\ p \ge \alpha \Rightarrow \text{do not reject } H_0
  6. Result

    So χ2=0\chi^2 = 0, p=1p = 1, and the null hypothesis is not rejected at the 5% level.

Worked examples