Anda di halaman 1dari 21

CHAPTER 5

BKU2032

GOODNESS OF FIT TEST &


CONTINGENCY TABLE
5.1 Introduction

5.2 Goodness of Fit Test

5.3 Contingency Table


Lesson outcomes:
By the end of this topic you should be able to:

Define the main situations when a chi-


square distribution and significance test is
used.
1. Find confidence Interval for a variance or standard
deviation

2. Test a hypothesis about a single variance or standard


deviation

3. Tests concerning frequency distributions (Goodness of Fit)

4. Test the Independence of two variables (Contingency


Table)

5. Test the homogeneity of proportions (Contingency Table)


Lesson outcomes:
By the end of this topic you should be able to:

Test a distribution for goodness of fit


using Chi-square
 When you have some practical data and you want
to know how well a particular statistical
distribution (such as binomial or normal) or any
distributions, models the data.

 Example:
To meet customer demands, a manufacturer of running
shoes may wish to see whether buyers show a
preference for a specific style. If there were no
preference, one would expect each style to be selected
with equal frequency.
1. H0 : There is No difference or no change
 Example: Buyers show no preference for a
specific style.

2. H1 : There is a difference or change


 Example: Buyers show a preference for a
specific style.
O  E 
2

 Formula  2
test 
E
 Where O = observed frequency
E = expected frequency (equal frequency = n/category)
 With degree of freedom equal to the number of categories
minus 1

 Assumptions
1. The data are obtained from a random sample
2. The expected frequency for each category must be 5 or more
1. State the hypothesis and identify the claim,
 O  E
2
2. Compute the test value. test
2

E
3. Find the critical value. The test is always right-
tailed since O – E are square and always
positive.

Make the decision – reject Ho if    ,Category 1


2 2
4. test

5. Summarize the result.


 A market analyst whished to see whether consumers
have any preference among five flavors of a new fruit
soda. A sample of 100 people provided these data.
Cherry Strawberry Orange Lime Grape
32 28 16 14 10

Is there enough evidence to reject the claim that


there is no preference in the selection of fruit soda
flavors at 0.05 significance level?
 If the graph between observed values and expected values is
fitted, one can see whether the values are close together or far
apart.

 When observed values and expected values are close together:


 the chi-square test value will be small.
 Decision must be not reject Ho (accept Ho).
 Hence there is a “good fit”.

 When observed values and expected values are far apart:


 the chi-square test value will be large.
 Decision must be reject Ho (accept H1).
 Hence there is a “not a good fit”.
1. H0 is that the particular distributions does
provide a model for the data.
 Example: state the claim distribution

2. H1 is that it does not.


 Example: The distribution is not same as stated
in the null hypothesis

Expected value (E) = given percentage × sample size


 The adviser of an ecology club at a college believes
that the group consists of 10% freshmen, 20%
sophomores, 40% juniors, and 30% seniors.

The membership for the club this year consisted of


14 freshmen, 19 sophomores, 51 juniors, and 16
seniors.

At α = 0. 10, test the adviser’s conjecture.


 According to a particular genetic theory, the colour
of strains (pink, white and blue) in a certain flower
should appear in the ratio 3:2:5.

In 200 randomly chosen plants, the corresponding


numbers of each colour were 48, 28 and 124.

Test at the 1% significance level, whether the theory


is true.
 Insert – functions - CHITEST

P-value

Reject H0
if P-value ≤ α
Lesson outcomes:
By the end of this topic you should be able to:

Test two variables for independence using


Chi-square
 To test the independence of two tests
I = ROW (x)
 H0 : The tests are independent
(x has no relationship with y) J =COLUMN (y)

 H1 : The tests are not independent Row sum


(x has relationship with y)
Column sum
 Reject H0 if  2
test   ,( I 1)( J 1)
2

 nij  Eij 
2
ni.  n. j
where  test
2
  and Eij 
Eij n.. Grand total

Observed values Expected values


 The data below shows the number of insomnia patient
according to their smoking habit in Malaysia.

Habit

Smoking Not smoking

Insomnia 20 40

Not insomnia 10 80

At α = 0.01, Can we say that insomnia is independent with


smoking habit?
Example 5: Chi-Square Independence Test

 A researcher wishes to see if the way of people obtain


information is not related with their educational
background. A survey of 400 high school and college
graduates yielded the following information.
Television Newspaper Other sources

High School 159 90 51

College 27 42 31

At α = 0.05, can the researcher conclude that the way


people obtain information is not related with their
educational background?
 A sociologist wishes to see whether the number of years
of college a person has completed is related to his or her
place of residence. A sample of 88 people is selected and
classified as shown. At 0.05 significance level, can the
sociologist conclude that the years of college education
are dependent on the person’s location?
Location No college 4 year degree Advanced degree
Urban 15 12 8
Suburban 8 15 9
Rural 6 8 7
 Three uses of the Chi-Square distribution were
explained in this chapter:

1. Test a distribution for goodness of fit using Chi-


square
2. Test two variables for independence using Chi-
square

 The test is always a right tailed test:

Thank You

Anda mungkin juga menyukai