The expected value, E, for each category, i, is calculated as:
Term | Description |
---|---|
pi | test proportion for the i th category, which equals 1/k or the value you provide |
k | number of distinct categories |
N | total observed values (O1 + ... + Ok) |
Oi | observed value for the i th category |
The chi-square test statistic is calculated as:
Term | Description |
---|---|
k | number of distinct categories |
Oi | observed value for the i th category |
Ei | expected value for the i th category |
Contribution of the i th category to the chi-square value is:
Term | Description |
---|---|
Oi | observed value for the i th category |
Ei | expected value for the i th category |
The degrees of freedom (DF) is calculated as:
Term | Description |
---|---|
DF | degrees of freedom |
k | number of categories |
The p-value is calculated as: Prob (Χ > Test statistic)
Term | Description |
---|---|
X | follows a chi-square distribution with k – 1 degrees of freedom |
Category i | Observed Oi | Test proportions pi |
---|---|---|
A | 5 | 0.1 |
B | 15 | 0.2 |
C | 10 | 0.3 |
D | 10 | 0.4 |
N=40 |
Category i | Expected value
Ei = (pi * N) |
Contribution to chi-square
(Oi- Ei)2 / Ei |
---|---|---|
A | 0.1 * 40 = 4 | (5 – 4)2 / 4 = 0.2500 |
B | 0.2 * 40 = 8 | (15 – 8)2 / 8 = 6.1250 |
C | 0.3 * 40 = 12 | (10 – 12)2 / 12 = 0.3333 |
D | 0.4 * 40 = 16 | (10 – 16)2 / 16 = 2.2500 |
χ2 = 0.2500 + 6.1250 + 2.2500 + 0.3333 = 8.9583
DF = k – 1 = 3
p-value = Prob (Χ > 8.9583) = 0.0299
Term | Description |
---|---|
DF | degrees of freedom |
k | number of categories |