Statistics/Testing Data/Chi-SquaredTest

From Wikibooks, open books for an open world
Jump to navigation Jump to search

General idea[edit | edit source]

Assume you have observed absolute frequencies and expected absolute frequencies under the Null hypothesis of your test then it holds

might denote a simple index running from or even a multiindex running from to .

The test statistics is approximately distributed, if

  1. for all absolute expected frequencies holds and
  2. for at least 80% of the absolute expected frequencies holds .

Note: In different books you might find different approximation conditions, please feel free to add further ones.

The degrees of freedom can be computed by the numbers of absolute observed frequencies which can be chosen freely. We know that the sum of absolute expected frequencies is

which means that the maximum number of degrees of freedom is . We might have to subtract from the number of degrees of freedom the number of parameters we need to estimate from the sample, since this implies further relationships between the observed frequencies.

Derivation of the distribution of the test statistic[edit | edit source]

Following Boero, Smith and Wallis (2002) we need knowledge about multivariate statistics to understand the derivation.

The random variable describing the absolute observed frequencies in a sample has a multinomial distribution with the number of observations in the sample, the unknown true probabilities. With certain approximation conditions (central limit theorem) it holds that

with the multivariate dimensional normal distribution, and

.

The covariance matrix has only rank , since .

If we considered the generalized inverse then it holds that

distributed (for a proof see Pringle and Rayner, 1971).

Since the multinomial distribution is approximately multivariate normal distributed, the term is

distributed. If further relations between the observed probabilities are there then the rank of will decrease further.

A common situation is that parameters on which the expected probabilities depend needs to be estimated from the observed data. As said above, usually is stated that the degrees of freedom for the chi square distribution is with the number of estimated parameters. In case of parameter estimation with the maximum-likelihood method this is only true if the estimator is efficient (Chernoff and Lehmann, 1954). In general it holds that degrees of freedom are somewhere between and .

Examples[edit | edit source]

The most famous examples will be handled in detail at further sections: test for independence, test for homogeneity and test for distributions.

The test can be used to generate "quick and dirty" test, e.g.

The random variable is symmetrically distributed versus

the random variable is not symmetrically distributed.

We know that in case of a symmetrical distribution the arithmetic mean and median should be nearly the same. So a simple way to test this hypothesis would be to count how many observations are less than the mean ()and how many observations are larger than the arithmetic mean (). If mean and median are the same than 50% of the observation should smaller than the mean and 50% should be larger than the mean. It holds

.

References[edit | edit source]

  • Boero, G., Smith, J., Wallis, K.F. (2002). The properties of some goodness-of-fit test, University of Warwick, Department of Economics, The Warwick Economics Research Paper Series 653, http://www2.warwick.ac.uk/fac/soc/economics/research/papers/twerp653.pdf
  • Chernoff H, Lehmann E.L. (1952). The use of maximum likelihood estimates in tests for goodness-of-fit. The Annals of Mathematical Statistics; 25:576-586.
  • Pringle, R.M., Rayner, A.A. (1971). Generalized Inverse Matrices with Applications to Statistics. London: Charles Griffin.
  • Wikipedia, Pearson's chi-square test: http://en.wikipedia.org/wiki/Pearson%27s_chi-square_test