35
HYPOTHESIS TESTING: THE CHI-SQUARE STATISTIC 1

Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

HYPOTHESIS TESTING:

THE CHI-SQUARE

STATISTIC

1

Page 2: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

7 steps of Hypothesis Testing

1. State the hypotheses

2. Identify level of significant

3. Identify the critical values

4. Calculate test statistics

5. Compare critical values with test statistics

6. Conclusion

7. Conclusion in words

Page 3: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Parametric and Nonparametric Tests

• Two non-parametric hypothesis tests using the chi-

square statistic:

• the chi-square test for goodness of fit

• the chi-square test for independence

3

Page 4: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Parametric and Nonparametric Tests

(cont.) • The term "non-parametric" refers to the fact that

the chi-square tests do not require assumptions

about population parameters nor do they test

hypotheses about population parameters.

• For chi-square, the data are frequencies rather

than numerical scores.

4

Page 5: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

The Chi-Square Test for Goodness-of-Fit

• The chi-square test for goodness-of-fit uses frequency

data from a sample to test hypotheses about the shape or

proportions of a population.

• Each individual in the sample is classified into one

category on the scale of measurement.

• The data, called observed frequencies, simply count

how many individuals from the sample are in each

category.

5

Page 6: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

The Chi-Square Test for Goodness-of-Fit

(cont.) • The null hypothesis specifies the proportion of the

population that should be in each category.

• The proportions from the null hypothesis are used to

compute expected frequencies that describe how the

sample would appear if it were in perfect agreement with

the null hypothesis.

6

Page 7: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Example 1

Test the hypothesis that eye colors spread evenly for each type at 1% level

of significant

Page 8: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 1 State Hypothesis

• H0: The eyes color spread evenly for each type

• H1: The eyes color not spread evenly for each type

Page 9: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 2 & 3 : Level of significant and

Critical Values Step 2

Alpha = 0.01

Step 3

df = n – 1

Df = 4-1=3

𝜒2 = 4.541

Page 10: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 4:Calculate the Test Statistic

Formula to find 𝜒2 test statistics

Since, total of observation is equal to 40 with 4 category.

𝑓𝑒 =40

4= 10

e

oe

f

ff 22 )(

Page 11: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 4:Calculate the Test Statistic

• A computational table helps organize the

computations.

fo fe fo - fe (fo - fe)2 (fo - fe)

2 /fe

12 10

21 10

3 10

4 10

40 40

Page 12: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 4:Calculate the Test Statistic

• Subtract each fe from each fo. The total of this

column must be zero.

fo fe fo - fe (fo - fe)2 (fo - fe)

2 /fe

12 10 2

21 10 11

3 10 -7

4 10 -6

40 40 0

Page 13: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 4:Calculate the Test Statistic

• Square each of these values

fo fe fo - fe (fo - fe)2 (fo - fe)

2 /fe

12 10 2 4

21 10 11 121

3 10 -7 49

4 10 -6 36

40 40 0

Page 14: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 4:Calculate the Test Statistic

• Divide each of the squared values by the fe for that cell. The

sum of this column is chi square

fo fe fo - fe (fo - fe)2 (fo - fe)

2 /fe

12 10 2 4 0.4

21 10 11 121 12.1

3 10 -7 49 4.9

4 10 -6 36 3.6

40 40 0 χ2 = 21

Page 15: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 5 & 6: Compare and Conclude

• Reject H0 ,when test statistics value > critical value

• Fail to Reject H0 ,when test statistics value < critical value

Critical value

Page 16: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 5 & 6: Compare and Conclude

• χ2 (critical value) = 4.541

• χ2 (test statistics) = 21

• The test statistic is in the Critical Region. Reject the H0.

• There is enough evidence to conclude that the eyes color

are differ for each types.

Page 17: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

The Chi-Square Test for Independence

• Can be used and interpreted in two different ways:

1. Testing hypotheses about the relationship between two variables in a population, or

2. Testing hypotheses about differences between proportions for two or more populations.

17

Page 18: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

The Chi-Square Test for Independence

(cont.)

Testing hypotheses about the relationship between two

variables in a population

The null hypothesis :

There is no relationship between the two variables; that is,

the two variables are independent.

18

Page 19: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

The Chi-Square Test for Independence

(cont.)

Testing hypotheses about differences between proportions

for two or more populations

The null hypothesis:

The proportions (the distribution across categories) are the

same for all of the populations

19

Page 20: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

The Chi-Square Test for Independence (cont.)

• The data (observed frequencies), show how many

individuals are in each cell of the matrix.

• Both chi-square tests use the same test statistic.

Page 21: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

The relationship of homicide rate and gun sales

Low homicide

High homicide

Totals

Low gun sales

8 5 13

High gun sales

4 8 12

Totals 12 13 25

Page 22: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Tables

Notice the following about these tables

1. Table must have a title

2. Independent variable must go into columns

3. Subtotals are called marginals.

4. N is reported at the intersection of row and

column marginals.

Page 23: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Tables

Title

Rows Column 1 Column 2

Row 1 cell a cell b Row Marginal 1

Row 2 cell c cell d Row Marginal 2

Column Marginal 1

Column Marginal 2

N

Page 24: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Example 2

Test association the homicide rate and volume of gun sales related

for a sample of 25 cities, with 5% level of significant?

Low High

High 8 5 13

Low 4 8 12

12 13 25

Page 25: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 1 State Hypothesis

• H0: The variables are independent

Another way to state the H0: There is no

relationship between the two variables

•H1: The variables are dependent

Another way to state the H1: There is a

relationship between the two variables

Page 26: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 2 & 3 : Level of significant and

Critical Values Step 2

Alpha = 0.05

Step 3

df = (r – 1)(c – 1) where

r = the number of rows

c = the number of columns

Df = (2-1)(2-1)=1

𝜒2 = 3.841

Page 27: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 4:Calculate the Test Statistic

Formula to find 𝜒2 test statistics

e

oe

f

ff 2

2 )(

Page 28: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 4:Calculate the Test Statistic

fe = (column marginal)(row marginal)

N

Page 29: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 4:Calculate the Test Statistic

• Expected frequencies:

Low High

High 6.24 6.76 13

Low 5.76 6.24 12

12 13 25

Page 30: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 4:Calculate the Test Statistic

• A computational table helps organize the

computations.

fo fe fo - fe (fo - fe)2 (fo - fe)

2 /fe

8 6.24

5 6.76

4 5.76

8 6.24

25 25

Page 31: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 4:Calculate the Test Statistic

• Subtract each fe from each fo. The total of this

column must be zero.

fo fe fo - fe (fo - fe)2 (fo - fe)

2 /fe

8 6.24 1.76

5 6.76 -1.76

4 5.76 -1.76

8 6.24 1.76

25 25 0

Page 32: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 4:Calculate the Test Statistic

• Square each of these values

fo fe fo - fe (fo - fe)2 (fo - fe)

2 /fe

8 6.24 1.76 3.10

5 6.76 -1.76 3.10

4 5.76 -1.76 3.10

8 6.24 1.76 3.10

25 25 0

Page 33: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 4:Calculate the Test Statistic

• Divide each of the squared values by the fe for that cell. The

sum of this column is chi square

fo fe fo - fe (fo - fe)2 (fo - fe)

2 /fe

8 6.24 1.76 3.10 .50

5 6.76 -1.76 3.10 .46

4 5.76 -1.76 3.10 .54

8 6.24 1.76 3.10 .50

25 25 0 χ2 = 2.00

Page 34: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 5 & 6: Compare and Conclude

• Reject H0 ,when test statistics value > critical value

• Fail to Reject H0 ,when test statistics value < critical value

Critical value

Page 35: Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the hypotheses 2. Identify level of significant 3. Identify the critical values 4. Calculate

Step 5 & 6: Compare and Conclude

• χ2 (critical value) = 3.841

• χ2 (test statistics) = 2.00

• The test statistic is not in the Critical Region. Fail to reject

the H0.

• There is no significant relationship between homicide rate

and gun sales.