The earlier test had two requirements:

The chi-squared test cannot therefore be used directly to test whether the following data set is a random sample from a \(\PoissonDistn(\lambda=2)\) distribution, since the \(\{E_i\}\) are all 2.

1 3 2 2 5 4 5 2 0 2
2 4 3 5 2 3 1 4 2 6

Frequency table

We first summarise the data in a frequency table.

x 0 1 2 3 4 5 6+
Freq(x)  1 2 7 3 3 3 1

Treating these frequencies as our observed counts, \(\{O_i\}\), we can find expected counts from the Poisson distribution's probability function,

\[ p(x) \;\;=\;\; \frac{\lambda^x e^{-\lambda}}{x!}\]

Since \(n=20\) and \(\lambda=2\) when H0 holds,

\[ E_x \;\;=\;\; 20 \times p(x) \;\;=\;\; 20 \times \frac{2^x e^{-2}}{x!}\]

giving

x 0 1 2 3 4 5 6+
\(O_x\) 1 2 7 3 3 3 1
\(E_x\) 2.707 5.413 5.413 3.609 1.804 0.722 0.331

Combining cells

Since we still do not have all \(\{E_x\}\) ≥1 and 80% of them ≥5, cells in the table should be combined.

x 0,1 2 3+
\(O_x\) 3 7 10
\(E_x\) 8.120 5.413 6.466

Based on these three counts,

\[ \begin{align} X^2 \;&=\; \sum_{i=1}^{10} {\frac{\left(O_i - E_i\right)^2}{E_i}} \\ &=\; \frac{(3-8.120)^2}{8.120} + \frac{(7-5.413)^2}{5.413} + \frac{(10-6.466)^2}{6.466} \\ &=\; 5.624 \end{align} \]

P-value and conclusion

There are 3 categories (after grouping) and one constraint .

\[ \sum{E_i} \;=\; \sum{O_i} \;=\; 20 \]

The test should therefore be based on a chi-squared distribution with \((3-1) = 2\) degrees of freedom. The p-value here is

p-value = \(P(X^2 \ge 5.621) = 0.060\)

We conclude that there is only very weak evidence against H0 (that the original data set was a random sample from a \(\PoissonDistn(2)\) distribution).

(It is hardly surprising that a data set with only 20 values does not show up problems with a model — a larger data set would be more sensitive to any possible lack of fit of the model.)