# significance of difference between two counts

Is there a way to determine whether a difference between a count of road accidents at time 1 is significantly different from a count at time 2?

I have found different methods for determining the difference between groups of observations at different times (e.g. comparing poisson means) but not for comparing only two counts. Or is it invalid to even try? Any advice or direction would be appreciated. I am happy to follow up leads myself.

## 1 Answer

If you're happy to assume each count follows a Poisson distribution (with its own mean under the alternative hypothesis; with a common mean under the null) there's no problem—it's just that you can't check that assumption without replicates. Overdispersion can be quite common with count data.

An exact test given counts $x_1$ & $x_2$ is straightforward because the overall total of counts $n=x_1+x_2$ is ancillary; conditioning on it gives $X_1 \sim \mathrm{Bin}\left(\frac{1}{2},n\right)$ as the distribution of your test statistic under the null. It's an intuitive result: the overall count, reflecting perhaps how much time you could be bothered to spend observing the two Poisson processes, carries no information about their relative rates, but affects the power of your test; & therefore other overall counts you might've got are irrelevant.

See Likelihood-based hypothesis testing for the Wald test (an approximation).

† Each count $x_i$ has a Poisson distribution with mean $\lambda_i$ $$\newcommand{\e}{\mathrm{e}} f{_X}(x_i)=\frac{\lambda_i^{x_i}\e^{-\lambda_i}}{x_i!}\qquad i=1,2$$ Reparametrize as \begin{align} \theta&=\frac{\lambda_1}{\lambda_1+\lambda_2}\\ \phi&=\lambda_1+\lambda_2 \end{align} where $\theta$ is what you're interested in, & $\phi$ is a nuisance parameter. The joint mass function can then be re-written: \begin{align} f_{X_1,X_2}(x_1,x_2)&=\frac{\lambda_1^{x_1}\lambda_2^{x_2}\e^{-(\lambda_1+\lambda_2)}}{x_1!x_2!}\\ f_{X_1,N}(x_1,n)&=\frac{\theta^{x_1}(1-\theta)^{n-x_1}\cdot\phi^n\e^{-\phi}}{x_1!(n-x_1)!} \end{align} The total count $n$ is ancillary for $\theta$, having a Poisson distribution with mean $\phi$ \begin{align} f_N(n)&= \sum_{x_1=0}^{\infty}f_{X_1,N}(x_1,n)\\ &=\frac{\phi^n\e^{-\phi}}{n!}\sum_{x_1=0}^{\infty}\frac{n!}{x_1!(n-x_1)!}\theta^{x_1}(1-\theta)^{n-x_1}\\ &=\frac{\phi^n\e^{-\phi}}{n!} \end{align} while the conditional distribution of $X_1$ given $n$ is binomial with Bernoulli probability $\theta$ & no. trials $n$ \begin{align} f_{X_1|n}(x_1;n)&=\frac{f_{X_1,N}(x_1,n)}{f_N(n)}\\ &=\frac{\theta^{x_1}(1-\theta)^{n-x_1}\cdot\phi^n\e^{-\phi}}{x_1!(n-x_1)!}\cdot\frac{n!}{\phi^n\e^{-\phi}}\\ &=\frac{n!}{x_1!(n-x_1)!}\theta^{x_1}(1-\theta)^{n-x_1} \end{align}\\

• The total number of counts is a complete sufficient statistic, isn't it? How can it be ancillary? Have I misunderstood something? – JohnK Jun 4 '15 at 11:37
• @JohnK: The sufficient statistic is $(X_1,N)$, $N$ being the ancillary complement to $X_1$. Note the distribution of $N$ doesn't depend on $\theta$. – Scortchi Jun 4 '15 at 11:40