tests of homogeneity and independence -

39
Tests of Homogeneity and Independence Robb T. Koether Homework Review The Test of Homogeneity (or Indepen- dence) The Expected Counts The Test of Homogeneity (or Indepen- dence) on the TI-83 The Richmond Crime Example Assignment Answers to Tests of Homogeneity and Independence Lecture 51 Sections 14.4 - 14.5 Robb T. Koether Hampden-Sydney College Fri, Dec 4, 2009

Upload: others

Post on 03-Feb-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Tests of Homogeneity and IndependenceLecture 51

Sections 14.4 - 14.5

Robb T. Koether

Hampden-Sydney College

Fri, Dec 4, 2009

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Outline

1 Homework Review

2 The Test of Homogeneity (or Independence)

3 The Expected Counts

4 The Test of Homogeneity (or Independence) on the TI-83

5 The Richmond Crime Example

6 Assignment

7 Answers to Even-Numbered Problems

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Outline

1 Homework Review

2 The Test of Homogeneity (or Independence)

3 The Expected Counts

4 The Test of Homogeneity (or Independence) on the TI-83

5 The Richmond Crime Example

6 Assignment

7 Answers to Even-Numbered Problems

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Homework Review

Exercise 14.5, page 929.

Suppose count data on two categorical variables wereobtained for performing a chi-square test ofindependence.The χ2 test statistic follows approximately a chi-squaredistribution with three degrees of freedom under thenull hypothesis of no association in the population.Recall the properties for a chi-square distribution frompage 924.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Homework Review

Exercise 14.5, page 929.

(a) If there was no association between the two variables inthe population, what would be the mean or expectedvalue for the test statistic?

(b) If there was no association between the two variables inthe population, what would be the standard deviation forthe test statistic?

(c) Suppose the observed test statistic value was χ2 = 15.How many standard deviations above the mean is thevalue of 15?

(d) Based on your answer to part (c), would you reject or failto reject the null hypothesis at the 5% significance level?

(e) Check your answer to part (d) by computing the p-valueand giving the decision at a 5% significance level.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Homework Review

Solution(a) We know that µχ2 = df , so the mean is 3.(b) We know that σχ2 =

√2× df , so the standard deviation

is√

6 = 2.449.(c) The observed value of 15 has a deviation of 15− 3 = 12

from the mean. The number of standard deviations is12

2.449 = 4.899.(d) I would reject H0 because the observed value is nearly

5 standard deviations away from what was expected.(e) p-value = χ2cdf(15,E99,3) = 0.0018. So reject H0.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Outline

1 Homework Review

2 The Test of Homogeneity (or Independence)

3 The Expected Counts

4 The Test of Homogeneity (or Independence) on the TI-83

5 The Richmond Crime Example

6 Assignment

7 Answers to Even-Numbered Problems

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

An Example

Example (Test of Homogeneity)We will work an example involving two teachingmethods: Method I and Method II.Does one method produce a different distribution ofgrades than the other method?In other words, are the populations of gradeshomogeneous.

A B C D FMethod I 5 8 36 16 7Method II 7 10 18 8 5

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

An Example

Example (Test of Homogeneity)

(1) H0 : The populations are homogeneous.H1 : The populations are not homogeneous.

(2) α = 0.05.(3) The test statistic is

χ2 =∑

all cells

(O − E)2

E.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Outline

1 Homework Review

2 The Test of Homogeneity (or Independence)

3 The Expected Counts

4 The Test of Homogeneity (or Independence) on the TI-83

5 The Richmond Crime Example

6 Assignment

7 Answers to Even-Numbered Problems

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Expected Counts

The question now is, how do we find the expectedcounts?Under the assumption of homogeneity (H0), thedifferent rows should exhibit the same proportions.We can get the best estimate of those proportions bypooling the rows.That is, find the column totals then compute theproportions from them.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Row and Column Proportions

A B C D FMethod I 5 8 36 16 7Method II 7 10 18 8 5Col TotalPercent

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Row and Column Proportions

A B C D FMethod I 5 8 36 16 7Method II 7 10 18 8 5Col Total 12 18 54 24 12Percent

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Row and Column Proportions

A B C D FMethod I 5 8 36 16 7Method II 7 10 18 8 5Col Total 12 18 54 24 12Percent 10% 15% 45% 20% 10%

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Expected Counts

Similarly, the columns should exhibit the similarproportions, so we can get the best estimate of them bypooling the columns.That is, find the row totals and then compute the rowproportions from them.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Row and Column Proportions

A B C D F Row Tot %Method I 5 8 36 16 7Method II 7 10 18 8 5

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Row and Column Proportions

A B C D F Row Tot %Method I 5 8 36 16 7 72Method II 7 10 18 8 5 48

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Row and Column Proportions

A B C D F Row Tot %Method I 5 8 36 16 7 72 60%Method II 7 10 18 8 5 48 40%

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Row and Column Totals

We summarize all of this.

A B C D F Row Tot %Method I 5 8 36 16 7 72 60%Method II 7 10 18 8 5 48 40%Col Total 12 18 54 24 12 120Percent 10% 15% 45% 20% 10%

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Expected Counts

Now apply the appropriate row and column proportionsto each cell to get the expected count.For example, in the upper-left cell, according to the rowand column proportions, it should contain

60% of 10% of 120.

That is, the expected count is

0.60× 0.10× 120 = 7.2.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Expected Counts

This is the same as(72120

)×(

12120

)× 120 =

72× 12120

= 7.2.

Therefore, the quick formula is

Expected Count =Row Total× Column Total

Grand Total.

Apply that formula to each cell to find the expectedcounts and add them to the table.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Expected Counts

Example (Test of Homogeneity)

(4)

A B C D FMethod I 5 8 36 16 7

(7.2) (10.8) (32.4) (14.4) (7.2)Method II 7 10 18 8 5

(4.8) (7.2) (21.6) (9.6) (4.8)

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

The Test Statistic

Example (Test of Homogeneity)

Now compute χ2 in the usual way:

χ2 =(5− 7.2)2

7.2+

(8− 10.8)2

10.8+

(36− 32.4)2

32.4

+(16− 14.4)2

14.4+

(7− 7.2)2

7.2+

(7− 4.8)2

4.8

+(10− 7.2)2

7.2+

(18− 21.6)2

21.6+

(8− 9.6)2

9.6

+(5− 4.8)2

4.8= 4.954.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Degrees of Freedom

Example (Test of Homogeneity)

(5) The number of degrees of freedom is

df = (No. of rows− 1)× (No. of cols− 1).

In this example, df = (2− 1)× (5− 1) = 4.So the p-value is

p-value = χ2cdf(4.954,E99,4) = 0.2921.

(6) Accept H0.(7) The grade distributions from Method I and Method II are

not significantly different.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Outline

1 Homework Review

2 The Test of Homogeneity (or Independence)

3 The Expected Counts

4 The Test of Homogeneity (or Independence) on the TI-83

5 The Richmond Crime Example

6 Assignment

7 Answers to Even-Numbered Problems

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

TI-83 - Test of Homogeneity or Independence

Now we will perform the test on the TI-83.One problem: The tables in these examples are notlists, so we can’t use the lists in the TI-83.Instead, the tables are matrices.That’s ok. The TI-83 can handle matrices.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

TI-83 - Test of Homogeneity or Independence

TI-83 Test of Homogeneity or IndependenceTo enter the observed counts into a matrix:

Press MATRIX.Select EDIT.Use the arrow keys to select the matrix to edit, e.g.,[A].Press ENTER to edit that matrix.Enter the number of rows and columns. (Press ENTERto advance.)Enter the observed counts in the cells.Press 2nd Quit to exit the matrix editor.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

TI-83 - Test of Homogeneity or Independence

TI-83 Test of Homogeneity or Independence

To perform the test of homogeneity.Select STATS > TESTS > χ2-Test. . .Press ENTER.Use the MATRIX button to enter the name of the matrixof observed counts.Enter the name, e.g., [E], of a matrix for the expectedcounts. These will be computed for you by the TI-83.Select Calculate.Press ENTER.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

TI-83 - Test of Homogeneity or Independence

TI-83 Test of Homogeneity or IndependenceThe window displays:

The title χ2-Test.The value of χ2.The p-value.The number of degrees of freedom.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

TI-83 - Test of Homogeneity or Independence

TI-83 Test of Homogeneity or Independence

To see the matrix of expected counts:Press MATRIX.Select matrix [E].Press ENTER.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Outline

1 Homework Review

2 The Test of Homogeneity (or Independence)

3 The Expected Counts

4 The Test of Homogeneity (or Independence) on the TI-83

5 The Richmond Crime Example

6 Assignment

7 Answers to Even-Numbered Problems

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

The Richmond Crime Example

Example (The Richmond Crime Example)The Richmond crime data data are shown below.Do the distributions appear to be different?

Ho Rp Rb As Ar Bu La Au2008 11 10 135 132 21 334 930 2342009 9 8 150 143 10 284 1032 208

Test the hypotheses at the 5% level.Show the expected counts.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Outline

1 Homework Review

2 The Test of Homogeneity (or Independence)

3 The Expected Counts

4 The Test of Homogeneity (or Independence) on the TI-83

5 The Richmond Crime Example

6 Assignment

7 Answers to Even-Numbered Problems

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Assignment

HomeworkRead Section 14.4, pages 940 - 947.Let’s Do It! 14.4, 14.5.Exercises 17 - 22, page 948.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Outline

1 Homework Review

2 The Test of Homogeneity (or Independence)

3 The Expected Counts

4 The Test of Homogeneity (or Independence) on the TI-83

5 The Richmond Crime Example

6 Assignment

7 Answers to Even-Numbered Problems

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Answers to Even-Numbered Problems

Homework14.18 (a) It means that neither the subjects nor the

observers know who is in which group.(b) H0 : The populations are homogeneous.

H1 : The populations are nothomogeneous.

(c) 28.(d) χ2 = 6.349; p-value = 00117; Reject H0;

The populations are not homogeneous.That is, the drug does affect the likelihoodthat someone (who takes the drug) will fallasleep within the first hour.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Answers to Even-Numbered Problems

Homework14.20 1. H0 : The populations are homogeneous.

H1 : The populations are nothomogeneous.

2. α = 0.01.

3. χ2 =∑

all cells

(O − E)2

E.

4. χ2 = 2.122.5. p-value = 0.1452.6. Accept H0.7. The populations are homogenous.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Answers to Even-Numbered Problems

Homework14.22 (a)

All the time Usually Sometimes NeverYoung 32% 18% 35% 15%Old 15% 9% 30% 46%

(b) You need to know how many were young (8 - 12) andhow many were old (13 - 18).

(c) Here are the seven steps:1. H0 : The populations are homogeneous.

H1 : The populations are not homogeneous.2. α = 0.05.

3. χ2 =∑

all cells

(O − E)2

E.

Tests ofHomogeneity

andIndependence

Robb T.Koether

HomeworkReview

The Test ofHomogeneity(or Indepen-dence)

The ExpectedCounts

The Test ofHomogeneity(or Indepen-dence) on theTI-83

TheRichmondCrimeExample

Assignment

Answers toEven-NumberedProblems

Answers to Even-Numbered Problems

Homework14.22 (c) The seven steps continued:

4.All the time Usually Sometimes Never

Young 192 108 210 90(145.6) (83.5) (196.4) (174.5)

Old 75 45 150 230(121.4) (69.5) (163.6) (145.5)

χ2 = 140.5.5. p-value = 2.903× 10−30.6. Reject H0.7. The populations are not homogenous.