# 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; see Read and Cressie.[1]

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

Next, defining a vector of parameters ${\displaystyle H_{0}:\mathbf {\pi } =(\pi _{1},\pi _{2},\dots ,\pi _{k})}$, where :${\displaystyle \textstyle \sum _{i=1}^{k}\pi _{i}=1}$. These are the parameter values under the null hypothesis.

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

${\displaystyle \Pr(\mathbf {x)_{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

${\displaystyle \Pr(\mathbf {sig} )=\sum _{y:Pr(\mathbf {y} )\leq Pr(\mathbf {x)_{0}} }\Pr(\mathbf {y} )}$

where the sum ranges over all outcomes as likely as, or less likely than, that observed. In practice this becomes computationally onerous as ${\displaystyle k}$ and ${\displaystyle 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 ${\displaystyle \pi _{i}}$ is replaced by its maximum likelihood estimate ${\displaystyle p_{i}=x_{i}/N}$. The exact probability of the observed configuration ${\displaystyle \mathbf {x} }$ under the alternative hypothesis is given by

${\displaystyle \Pr(\mathbf {x)_{A}} =N!\prod _{i=1}^{k}{\frac {p_{i}^{x_{i}}}{x_{i}!}}.}$

The natural logarithm of the ratio between these two probabilities multiplied by ${\displaystyle -2}$ is then the statistic for the likelihood ratio test

${\displaystyle -2\ln(L/R)=\textstyle -2\sum _{i=1}^{k}x_{i}\ln(\pi _{i}/p_{i}).}$

If the null hypothesis is true, then as ${\displaystyle N}$ increases, the distribution of ${\displaystyle -2\ln(LR)}$ converges to that of chi-squared with ${\displaystyle k-1}$ degrees of freedom. However it has long been known (e.g. Lawley 1956) that for finite sample sizes, the moments of ${\displaystyle -2\ln(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 ${\displaystyle N^{-1}}$. Williams (1976) showed that the first moment can be matched as far as ${\displaystyle N^{-2}}$ if the test statistic is divided by a factor given by

${\displaystyle 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 ${\displaystyle \pi _{i}}$ are equal to ${\displaystyle 1/k}$ (i.e. it stipulates a uniform distribution), this simplifies to

${\displaystyle q_{1}=1+{\frac {k+1}{6N}}.}$

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

${\displaystyle 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

${\displaystyle \chi ^{2}=\sum _{i=1}^{k}{(x_{i}-E_{i})^{2} \over E_{i}}}$

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

## References

1. ^ Read, T. R. C. and Cressie, N. A. C. (1988). Goodness-of-fit statistics for discrete multivariate data. New York: Springer-Verlag. ISBN 0-387-96682-X.
• Lawley, D. N. (1956). "A General Method of Approximating to the Distribution of Likelihood Ratio Criteria". Biometrika. 43: 295–303. doi:10.1093/biomet/43.3-4.295.
• Smith, P. J., Rae, D. S., Manderscheid, R. W. and Silbergeld, S. (1981). "Approximating the Moments and Distribution of the Likelihood Ratio Statistic for Multinomial Goodness of Fit". Journal of the American Statistical Association. American Statistical Association. 76 (375): 737–740. doi:10.2307/2287541. JSTOR 2287541.
• Williams, D. A. (1976). "Improved Likelihood Ratio Tests for Complete Contingency Tables". Biometrika. 63: 33–37. doi:10.1093/biomet/63.1.33.