You are on page 1of 14

CHI SQUARE TESTS

GOODNESS OF FIT TESTS


CONTINGENCY TABLE TESTS
Goodness of Fit Tests (G.O.F)
Objective: Test hypotheses that a particular
probability distribution satisfies a population
model
Types of data:
Frequency distribution, Probability distribution (any type,
eg. Ratio, percentage etc)
e
Outcome 0 1 2 3
Observed Frequency, Oi 32 15 9 4

Category A B C D
Observed Frequency, Oi 130 35 30 5
Probability 0.6 0.2 0.15 0.05
How to conduct the test procedure?
-Requires a random sample of size n from the
population whose probability distribution is unknown.
-These n observations are arranged in a frequency
distribution.
Goodness of Fit Tests (G.O.F)

H0: Data follows the _________distribution


H1: Data do not follow _________ distribution

If H0 is true, using the probability of the


distribution, we can find the expected frequency, Ei
for each outcome
i.e.
Ei  nP( X i )
Goodness of Fit Tests (G.O.F)

Test Statistics*:  2

k
Oi  Ei 
2
~  ,k  p 1
2
Test

i 1 Ei
k=number of categories
p=number of unknown parameters needed to be estimated from data

This is a 1-tailed test, i.e. H0 is rejected at 


significance level when
 2
Test   ,k  p 1
2

* Only when expected frequency, Ei  5 (Otherwise, need to combine


categories)
Goodness of Fit Tests (G.O.F):
Ex.9-7 (p.332)
Consider the following frequency table of observations
on the random variable X.
Values 0 1 2 3 4
Observed 24 30 31 11 4
Frequency

(a) Based on these 100 observations, is a Poisson distribution with a mean of 1.5 an
appropriate model? Perform a goodness-of-fit procedure with =0.05.

(b) Based on these 100 observations, is a Poisson distribution with a mean of 1.2 an
appropriate model? Perform a goodness-of-fit procedure with
=0.05.

(c) Based on these 100 observations, is a Poisson distribution an appropriate model?
Perform a goodness-of-fit procedure with =0.05.
e   x
(a) Use: P( X  x)  where λ = 1.5 (given)
x!
Values Oi P(X=i) Ei

0 24 P(X=0)=? 22.31

1 30 P(X=1)=? 33.47

2 31 P(X=2)=? 25.1

3 11 P(X=3)=? 12.55
k 1

4 4 1   P( X  i ) 6.57 The degrees of freedom


i 1

Total 100 1 are

k−p−1=5−0−1=4
H0: Data follows a Poisson distribution with mean=1.5
H1: Data does not follow a Poisson distribution with mean 1.5

At α = 0.05
The test statistic is
 2

k
Oi  Ei 
2
 3.0714
Test

i Ei

Reject H0 if 2  2
Test 0.05, 4  9.488

Since 3.0714 < 9.488,


We do not reject H0 at 5% significance level.
 We are unable to reject the null hypothesis that the
distribution of X is Poisson with mean=1.5.
e   x
(b) Use: P( X  x)  where λ = 1.2 (given)
x!
Values Oi P(X=i) Ei

0 24 P(X=0)=? 30.12

1 30 P(X=1)=? 36.14

2 31 P(X=2)=? 21.69

3 11 P(X=3)=? 8.67
k 1

4 4 1   P( X  i ) 3.38
i 1

Total 100 1
e   x
Use: P( X  x)  where λ = 1.2 (given)
x!
Values Oi P(X=i) Ei
Values Oi P(X=i) Ei
0 24 P(X=0) 30.12 0 24 P(X=0) 30.12
1 30 P(X=1) 36.14
1 30 P(X=1) 36.14
2 31 P(X=2)
k 1
21.69
2 31 P(X=2) 21.69 1   P( X  i )
3 15 i 1
12.05
3 11 P(X=3) 8.67 100 1
k 1
4 4 1   P( X  i ) 3.38
i 1

100 1
The degrees of freedom
Since category, value 4 has an expected are
frequency less than 5,
combine this category with
the previous category: k−p−1=4−0−1=3
H0: Data follows a Poisson distribution with mean=1.2
H1: Data does not follow a Poisson distribution with mean 1.2

At α = 0.05
The test statistic is
 2
k

Oi  Ei 
2
?
Test

i Ei
Reject H0 if 2  2
Test 0.05, 3  7.815

Since ____________,
………………………….
 ……………………………………………….
e   x
(c) Use: P( X  x)  where λ = (not given)
x!
λ = ?? (answer=1.41)
Values Oi P(X=i) Ei

0 24 P(X=0)=? ?

1 30 P(X=1)=? ?

2 31 P(X=2)=? ?

3 11 P(X=3)=? ?
k 1

4 4 1   P( X  i ) ?
i 1
The degrees of freedom
Total 100 1 are

k−p−1=5−1−1=3
H0: Data follows a Poisson distribution
H1: Data does not follow a Poisson distribution

At α = 0.05  2
k

Oi  Ei 
2
?
Test
The test statistic is i Ei

Reject H0 if 2  2
Test 0.05, 3  7.815

Since ____________,
………………………….
 ……………………………………………….
Consider the following frequency table of observations on
the random variable X:

Values 0 1 2 3 >= 4
Frequency 4 21 10 13 2

Based on these 50 observations, is a binomial distribution


with n = 6 and p = 0.25 an appropriate model? Perform a
goodness-of-fit procedure with   0.05.

You might also like