# Applications of Chi-Square Tests

This morning, in our mathematical statistical class, we’ve seen the use of the chi-square test. The first one was related to some goodness of fit of a multinomial distribution. Assume that . In order to test  against , use the statistic

Under . For instance, we have the number of weddings, in a large city, per season,

> n=c(301,356,413,262)

We want to test if weddings are celebrated uniformely over the year, i.e. .

> np=rep(sum(n)/4,4)
> cbind(n,np)
n  np
[1,] 301 333
[2,] 356 333
[3,] 413 333
[4,] 262 333
> Q=sum( (n-np)^2/np  )
> Q
 39.02102

This quantity should be compared with the quantile of the chi-square distribution

> qchisq(.95,df=4-1)
 7.814728

but it is also possible to compute the p-value,

> 1-pchisq(Q,df=4-1)
 1.717959e-08

Here, we reject the assumption that weddings are celebrated uniformly over the year.

# Inference for the Multinomial Distribution

This morning, in our mathematical statistical class, we’ve seen briefly the multinomial distribution, and statistical inference.  has a  distribution if its probability function is

with  and .

The maximum likelihood estimator is then the optimum of

We use Lagrange multiplier to solve this constrained optimization problem,

First order conditions are here

and

Thus,

From

we can easily get that Lagrande multiplier is . And then

One can easily get that this maximum likelihood estimator is unbiased, since . Actually, we can easily prove that

and that , while . The trick to get the later is simple,

and . Thus, we can easily get the covariance. From that term, we can write that

with

while