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 formula_1 items each of which has been observed to fall into one of formula_2 categories. It is possible to define formula_3 as the observed numbers of items in each cell. Hence formula_4 Next, defining a vector of parameters formula_5 where: formula_6 These are the parameter values under the null hypothesis. The exact probability of the observed configuration formula_7 under the null hypothesis is given by  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 where the sum ranges over all outcomes as likely as, or less likely than, that observed. In practice this becomes computationally onerous as formula_10 and formula_1 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 formula_12 is replaced by its maximum likelihood estimate formula_13 The exact probability of the observed configuration formula_7 under the alternative hypothesis is given by The natural logarithm of the likelihood ratio, formula_16 between these two probabilities, multiplied by formula_17 is then the statistic for the likelihood ratio test (The factor formula_19 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 formula_1 increases, the distribution of formula_21 converges to that  of chi-squared with formula_22 degrees of freedom. However it has long been known (e.g. Lawley) that for finite sample sizes, the moments of formula_21 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 formula_24 Williams showed that the first moment can be matched as far as formula_25 if the test statistic is divided by a factor given by In the special case where the null hypothesis is that all the values formula_27 are  equal to formula_28 (i.e. it stipulates a uniform distribution), this simplifies to Subsequently, Smith "et al". derived a dividing factor which matches the first moment as far as formula_30 For the case of equal values of formula_31 this factor is The null hypothesis can also be tested by using Pearson's chi-squared test where formula_34 is the expected number of cases in category formula_35 under the null hypothesis. This statistic also converges to a chi-squared distribution with formula_22 degrees of freedom when the null hypothesis is true but does so from below, as it were, rather than from  above as formula_21 does, so may be preferable to the uncorrected version of formula_21 for small samples.