Statistics/Testing Data/Chi-SquaredTest: Difference between revisions

From testwiki
Jump to navigation Jump to search
imported>Pi zero
normalizing book category
 
(No difference)

Latest revision as of 00:54, 16 November 2016

General idea

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

V=i(oiei)2eiχf2.

i might denote a simple index running from 1,...,I or even a multiindex (i1,...,ip) running from (1,...,1) to (I1,...,Ip).

The test statistics V is approximately χ2 distributed, if

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

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

ioi=n

which means that the maximum number of degrees of freedom is I1. 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

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

The random variable O describing the absolute observed frequencies (o1,...,ok) in a sample has a multinomial distribution OM(n;p1,...,pk) with n the number of observations in the sample, pi the unknown true probabilities. With certain approximation conditions (central limit theorem) it holds that

OM(n;p1,...,pk)Nk(μ;Σ)

with Nk the multivariate k dimensional normal distribution, μ=(np1,...,npk) and

Σ=(σij)i,j=1,...,k={npipj,if ijnpi(1pi)otherwise.

The covariance matrix Σ has only rank k1, since p1+...+pk=1.

If we considered the generalized inverse Σ then it holds that

(Oμ)TΣ(Oμ)=i(oiei)2eiχk12

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

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

i(oiei)2eiχk12

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 k1r with r 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 k1r and k1.

Examples

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

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

H0: The random variable X is symmetrically distributed versus

H1: the random variable X is not symmetrically distributed.

We know that in case of a symmetrical distribution the arithmetic mean x¯ 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 (n)and how many observations are larger than the arithmetic mean (n+). 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

V=(nn/2)2n/2+(n+n/2)2n/2χ12.

References

Template:BookCat