Multinomial test

In statistics, the multinomial test is the test of the null hypothesis that the parameters of a multinomial distribution equal specified values; it is used for categorical data.

Beginning with a sample of $$~ N ~$$ items each of which has been observed to fall into one of $$ k $$ categories. It is possible to define $$~ \mathbf{x} = (x_1, x_2, \dots, x_k) ~$$ as the observed numbers of items in each cell. Hence $$~ \sum_{i=1}^k x_{i} = N ~.$$

Next, defining a vector of parameters $$~ H_0: \boldsymbol{\pi} = (\pi_{1}, \pi_{2}, \ldots, \pi_{k}) ~,$$ where: $$~ \sum_{i=1}^k \pi_{i} = 1 ~.$$ These are the parameter values under the null hypothesis.

The exact probability of the observed configuration $$~ \mathbf{x} ~$$ under the null hypothesis is given by


 * $$~ \operatorname\mathbb{P}\left( \mathbf{x}\right )_0 = N! \, \prod_{i=1}^k \frac{\pi_{i}^{x_i}}{x_i!} ~.$$

The significance probability for the test is the probability of occurrence of the data set observed, or of a data set less likely than that observed, if the null hypothesis is true. Using an exact test, this is calculated as


 * $$~ p_\mathcal{[sig]} = \sum_{ \mathbf{y} \, : \; \operatorname{\mathbb{P}}\left( \mathbf{y} \right) \, \le \, \operatorname{\mathbb{P}}\left( \mathbf{x} \right)_0 } \operatorname\mathbb{P}\left( \mathbf{y}\right) ~$$

where the sum ranges over all outcomes as likely as, or less likely than, that observed. In practice this becomes computationally onerous as $$~ k ~$$ and $$~ N ~$$ increase so it is probably only worth using exact tests for small samples. For larger samples, asymptotic approximations are accurate enough and easier to calculate.

One of these approximations is the likelihood ratio. An alternative hypothesis can be defined under which each value $$~ \pi_{i} ~$$ is replaced by its maximum likelihood estimate $$~ p_{i}=\frac{\;x_i\,}{N} ~.$$ The exact probability of the observed configuration $$~ \mathbf{x} ~$$ under the alternative hypothesis is given by


 * $$~ \operatorname\mathbb{P}\left(\mathbf{x}\right)_A = N! \; \prod_{i=1}^k \frac{\;p_{i}^{x_i}\,}{x_i!} ~.$$

The natural logarithm of the likelihood ratio, $$~[\mathcal{LR}]~,$$ between these two probabilities, multiplied by $$~ -2 ~,$$ is then the statistic for the likelihood ratio test


 * $$~ -2\ln([\mathcal{LR}]) = -2 \; \sum_{i=1}^k x_{i}\ln\left( \frac{\pi_i}{p_i}\right) ~.$$

(The factor $$~ -2 ~$$ is chosen to make the statistic asymptotically chi-squared distributed, for convenient comparison to a familiar statistic commonly used for the same application.)

If the null hypothesis is true, then as $$~ N ~$$ increases, the distribution of $$~ -2\ln([\mathcal{LR}]) ~$$ converges to that of chi-squared with $$~ k - 1 ~$$ degrees of freedom. However it has long been known (e.g. Lawley ) that for finite sample sizes, the moments of $$~ -2\ln([\mathcal{LR}]) ~$$ are greater than those of chi-squared, thus inflating the probability of type I errors (false positives). The difference between the moments of chi-squared and those of the test statistic are a function of $$~ N^{-1} ~.$$ Williams showed that the first moment can be matched as far as $$~ N^{-2} ~$$ if the test statistic is divided by a factor given by


 * $$~ q_1 = 1 + \frac{\;\sum_{i=1}^k \pi_{i}^{-1} \,-\, 1\;}{6N(k-1)} ~.$$

In the special case where the null hypothesis is that all the values $$\pi_{i}$$ are equal to $$~ 1 / k ~$$ (i.e. it stipulates a uniform distribution), this simplifies to


 * $$~ q_1 = 1 + \frac{\,k+1\,}{\,6N\,} ~.$$

Subsequently, Smith et al. derived a dividing factor which matches the first moment as far as $$~ N^{-3} ~.$$ For the case of equal values of $$~ \pi_{i} ~,$$ this factor is


 * $$~ q_2 = 1 + \frac{\,k+1\,}{\,6N\,}+\frac{\;k^2\,}{\;6N^2\,} ~.$$

The null hypothesis can also be tested by using Pearson's chi-squared test


 * $$~ \chi^2 = \sum_{i=1}^{k} \frac{\;(x_i - E_i)^2\,}{E_i} ~$$

where $$~ E_i = N \pi_i ~$$ is the expected number of cases in category $$~ i ~$$ under the null hypothesis. This statistic also converges to a chi-squared distribution with $$~ k - 1 ~$$ degrees of freedom when the null hypothesis is true but does so from below, as it were, rather than from above as $$~ -2\ln([\mathcal{LR}]) ~$$ does, so may be preferable to the uncorrected version of $$~ -2\ln([\mathcal{LR}]) ~$$ for small samples.