Discussion 6 Hypothesis Test of Chi Square

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 19

LESSON 7:

Hypothesis test for


Chi-square
Try to answer the questions below:
• How many flavors of soda are there in the picture?
• From the soda flavors, how can you determine the preferences of
consumers in terms of soda flavors?
• What is categorical variables? 4
Chi-square

 also called as the goodness-of-fit test.


 used to compare categorical information against what we
would expect based on previous knowledge.
 it tests what are called observed frequencies (the frequency
with which participants fall into category) against expected
frequencies (the frequency expected in a category).

Categorical variables are data types that can be separated


into categories. Race, gender, age group, and educational
attainment are examples of categorical variables.

5
USING THE APPROPRIATE
TEST STATISTIC
(𝑂 − 𝐸 )2
𝒙 =∑𝟐

where:
𝐸
O = observed frequencies
= expected frequencies

Formula for expected frequencies

(𝑟𝑜𝑤 𝑡𝑜𝑡𝑎𝑙)(𝑐𝑜𝑙𝑢𝑚𝑛 𝑡𝑜𝑡𝑎𝑙)


𝑬=
𝑜𝑣𝑒𝑟𝑎𝑙𝑙 𝑡𝑜𝑡𝑎𝑙

6
EXAMPLE 1
The following table shows the results of a survey in which the subjects were a
sample of 300 adults residing in a certain metropolitan area. Each subject was asked
to indicate which of three policies they favored with respect to smoking in public
places. Can one conclude from these data that in the sampled population, there is a
relationship between the level of education and the attitude towards smoking in
public places?

7
EXAMPLE 1
STEP 1: Formulate the null and the alternative hypothesis (in words)

Ho: There is no significant relationship between the level of education and


the attitude towards smoking.

Ha: There is a significant relationship between the level of education and


the attitude towards smoking.

STEP 2: Decide on the level of significance and type of test

Level of significance:

8
EXAMPLE 1
STEP 3: Decide the test static to be used and determine the critical value/s (tabular
value/s) from the appropriate table.

Test statistic:
Chi-square

Degree of freedom (df):

Critical value: 12.592


9
EXAMPLE 1
STEP 4: Compute the test statistic
STEP 4.1: Determine the expected frequencies.
(𝑟𝑜𝑤 𝑡𝑜𝑡𝑎𝑙)(𝑐𝑜𝑙𝑢𝑚𝑛𝑡𝑜𝑡𝑎𝑙)
𝑬=
𝑜𝑣𝑒𝑟𝑎𝑙𝑙 𝑡𝑜𝑡𝑎𝑙

(70)(35) (150)(35) (80)(35)


𝑬= C =8.17 𝑬 = =17.50 𝑬= =9.33
300 300 300
10
EXAMPLE 1
2
(𝑶 − 𝑬 )
𝒙 =∑
STEP 4: Compute the test statistic 𝟐
STEP 4.2: Compute the chi-square value. 𝑬

𝟐 (5 −8.17)2 (44 − 42.93)2 (18 −14.70)2 (3 − 4 .20)2 (15 −17.50)2 (100 − 92)2
𝒙 = + + + + +
8.17 42.93 14.70 4.20 17.50 92
+(30 −31.50) (5− 9) (15 − 9.33) ( 40 −4 9.07) (15 − 16.80) (10 − 4.80)2
2 2 2 2 2
+ + + + +
31.50 9 9.33 49.07 16.80 4.80
11
𝒙 𝟐 ≈ 16.191
EXAMPLE 1
STEP 5: Make a decision
Observe that the computed chi-square value is greater than the critical
value and it is on the critical region (or falls on the rejection region). Thus,
we reject the null hypothesis (Ho).

𝒙𝟐 ≈ 𝟏𝟔. 𝟏𝟗𝟏

STEP 6: Interpret the result and make a conclusion 𝒕 𝒂=𝟏𝟐 .𝟓𝟗𝟐


At 5% level of significance, there is enough evidence to conclude that
there is a significant relationship between the level of education and the
attitude towards smoking.
12
EXAMPLE 2
In a recent survey conducted by ABC Company to determine the
effectiveness of its hair shampoo, five groups of female respondents were
given questionnaires. Compare the responses of the five groups using chi-
square. Their answers are as follows:

13
EXAMPLE 2
STEP 1: Formulate the null and the alternative hypothesis (in words)

Ho: There is no significant difference among the responses of the five


groups

Ha: There is a significant difference among the responses of the five


groups.

STEP 2: Decide on the level of significance and type of test

Level of significance:

14
EXAMPLE 2
STEP 3: Decide the test static to be used and determine the critical value/s (tabular
value/s) from the appropriate table.

Test statistic:
Chi-square

Degree of freedom (df):

Critical value: 21.026


15
EXAMPLE 2
STEP 4: Compute the test statistic
STEP 4.1: Determine the expected frequencies.
(𝑟𝑜𝑤 𝑡𝑜𝑡𝑎𝑙)(𝑐𝑜𝑙𝑢𝑚𝑛𝑡𝑜𝑡𝑎𝑙)
𝑬=
𝑜𝑣𝑒𝑟𝑎𝑙𝑙 𝑡𝑜𝑡𝑎𝑙

C C C C
C C C C
C C C C
C C C C
C C C C

( 40)(47) ( 44)(47 ) (34)( 47)


𝑬= C =9.08
C 𝑬= C =9.99
C 𝑬= C C
=7.72 16
207 207 207
EXAMPLE2
(𝑶 − 𝑬)2
𝒙 =∑
𝟐
STEP 4: Compute the test statistic 𝑬
STEP 4.2: Compute the chi-square value.

(12− 9.08)2 (5 −10.24 )2 (12 −10.82)2 (11− 9 .86)2 (5 − 9.99)2 (14 −11.27 )2
𝟐
𝒙 = + + + + +
9.08 10.24 10.82 9.86 9.99 11.27
+(14 −11.90) (11−10.84 ) (5 −7.72) (6 − 8.71) (12− 9.20) (11 −8.38)2
2 2 2 2 2
+ + + + +
11.90 10.84 7.72 8.71 9.20 8.38
+(10 −9.99) (8 −11.27) (13 − 11.90) (13 −10.84) (15 −10.22) (20 −11.52)2
2 2 2 2 2
+ + + + +
9.99 11.27 11.90 10.84 10.22 11.52
2 2
+(5 − 12.17) (5 − 11.09) 17
12.17
+
11.09
≈ 28.408
EXAMPLE 2
STEP 5: Make a decision
Observe that the computed chi-square value is greater than the critical
value and it is on the critical region (or falls on the rejection region). Thus,
we reject the null hypothesis (Ho).

𝒙𝟐 ≈ 𝟐𝟖 . 𝟒𝟎𝟖

STEP 6: Interpret the result and make a conclusion 𝒕 𝒂=𝟐𝟏 .𝟎𝟐𝟔


At 5% level of significance, there is enough evidence to conclude that
there is a significant difference among the responses of the five groups.

18
GENERALIZATION

19

When do we use the test of difference
and test of relationship in Chi-square
test?

20
QUESTIONS?
21

You might also like