test of goodness of fit - lecture 42 section...

55
Test of Goodness of Fit Robb T. Koether Homework Review The Goodness-of- Fit Test The Chi-Square Statistic Goodness-of- Fit Test on the TI-83 Male vs. Female Births Again Assignment Test of Goodness of Fit Lecture 42 Section 14.3 Robb T. Koether Hampden-Sydney College Fri, Nov 14, 2008

Upload: others

Post on 04-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Test of Goodness of FitLecture 42

Section 14.3

Robb T. Koether

Hampden-Sydney College

Fri, Nov 14, 2008

Page 2: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Outline

1 Homework Review

2 The Goodness-of-Fit Test

3 The Chi-Square Statistic

4 Goodness-of-Fit Test on the TI-83

5 Male vs. Female Births Again

6 Assignment

Page 3: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

Homework ReviewSix basic questions.

Are we testing hypotheses or finding a confidenceinterval?Does the problem concern means or proportions?Is there one sample or are there two samples?

If the problem concerns means, then the next twoquestions are:

Is σ known?Is the population normal?

Finally,Is the sample size large?

Page 4: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

Homework ReviewSix basic questions.

Are we testing hypotheses or finding a confidenceinterval?Does the problem concern means or proportions?Is there one sample or are there two samples?

If the problem concerns means, then the next twoquestions are:

Is σ known?Is the population normal?

Finally,Is the sample size large?

Page 5: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

Homework ReviewSix basic questions.

Are we testing hypotheses or finding a confidenceinterval?Does the problem concern means or proportions?Is there one sample or are there two samples?

If the problem concerns means, then the next twoquestions are:

Is σ known?Is the population normal?

Finally,Is the sample size large?

Page 6: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

Homework ReviewSix basic questions.

Are we testing hypotheses or finding a confidenceinterval?Does the problem concern means or proportions?Is there one sample or are there two samples?

If the problem concerns means, then the next twoquestions are:

Is σ known?Is the population normal?

Finally,Is the sample size large?

Page 7: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

Homework ReviewSix basic questions.

Are we testing hypotheses or finding a confidenceinterval?Does the problem concern means or proportions?Is there one sample or are there two samples?

If the problem concerns means, then the next twoquestions are:

Is σ known?Is the population normal?

Finally,Is the sample size large?

Page 8: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

Homework ReviewSix basic questions.

Are we testing hypotheses or finding a confidenceinterval?Does the problem concern means or proportions?Is there one sample or are there two samples?

If the problem concerns means, then the next twoquestions are:

Is σ known?Is the population normal?

Finally,Is the sample size large?

Page 9: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

Homework ReviewSix basic questions.

Are we testing hypotheses or finding a confidenceinterval?Does the problem concern means or proportions?Is there one sample or are there two samples?

If the problem concerns means, then the next twoquestions are:

Is σ known?Is the population normal?

Finally,Is the sample size large?

Page 10: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

Homework ReviewSix basic questions.

Are we testing hypotheses or finding a confidenceinterval?Does the problem concern means or proportions?Is there one sample or are there two samples?

If the problem concerns means, then the next twoquestions are:

Is σ known?Is the population normal?

Finally,Is the sample size large?

Page 11: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

Exercise 11.28, page 712.

A toothpaste manufacturer claims that childrenbrushing their teeth daily with his company’s newtoothpaste product will have fewer cavities than childrenusing a competitor’s brand.In a carefully supervised study in which children wererandomly assigned to one of the two brands oftoothpaste for a 2-year period, the number of cavitiesfor children using the new brand was compared withthe number of cavities for children using thecompetitor’s brand.

Page 12: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

Exercise 11.28, page 712.

The results are as follows:New Brand: 2 1 1 2 3 1 2 3 4 1 2

Competitor Brand: 3 1 1 4 0 7 1 1 4 6 1

Test the manufacturer’s claim using a significance levelof 0.01.

Page 13: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

SolutionAre we testing hypotheses or finding a confidenceinterval?

Z-Test ZIntervalT-Test TInterval2-SampZTest 2-SampZInt2-SampTTest 2-SampTInt1-PropZTest 1-PropZInt2-PropZTest 2-PropZInt

Page 14: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

SolutionAre we testing hypotheses or finding a confidenceinterval?

Z-Test ZIntervalT-Test TInterval2-SampZTest 2-SampZInt2-SampTTest 2-SampTInt1-PropZTest 1-PropZInt2-PropZTest 2-PropZInt

Page 15: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

SolutionDoes the problem concern means or does it concernproportions?

Z-Test 1-PropZTestT-Test 2-PropZTest2-SampZTest2-SampTTest

Page 16: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

SolutionDoes the problem concern means or does it concernproportions?

Z-Test 1-PropZTestT-Test 2-PropZTest2-SampZTest2-SampTTest

Page 17: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

SolutionDoes the problem involve one sample or two samples?

Z-Test 2-SampZTestT-Test 2-SampTTest

Page 18: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

SolutionDoes the problem involve one sample or two samples?

Z-Test 2-SampZTestT-Test 2-SampTTest

Page 19: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

SolutionTo choose between 2-SampZTest and 2-SampTTest,we need to know

Are σ1 and σ2 not known?Are the populations normal?Are the sample sizes small?

2-SampZTest 2-SampTTest

Page 20: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Homework Review

SolutionTo choose between 2-SampZTest and 2-SampTTest,we need to know

Are σ1 and σ2 not known? YESAre the populations normal? YES (QQ Plot)Are the sample sizes small? YES

2-SampZTest 2-SampTTest

Page 21: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

The Hypotheses

Example (Goodness-of-Fit Test)We are testing the hypothesis that the distributions ofcolors in plain M&Ms is

HypotheticalColor ProportionsBlue 24%Orange 20%Green 16%Yellow 14%Brown 13%Red 13%

Page 22: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

The Hypotheses

Example (Goodness-of-Fit Test)From two packages of plain M&Ms, we obtained thefollowing data.

ObservedColor CountsBlue 20Orange 24Green 25Yellow 23Brown 12Red 10

Page 23: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

The Hypotheses

The null hypothesis specifies the probability (orproportion) for each color.The null hypothesis is

H0 : p1 = 0.24, p2 = 0.20, p3 = 0.16,p4 = 0.14, p5 = 0.13, p6 = 0.13.

The alternative hypothesis will always be a simplenegation of H0:

H1 : H0 is false.Let α = 0.05.

Page 24: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Expected Counts

The test statistic will involve the observed and theexpected counts.To find the expected counts, we apply the hypotheticalproportions to the sample size.For example, the hypothetical proportion for red is 24%,so we compute 24% of 114:

0.24× 114 = 27.36.

Do not round the values off to whole numbers.

Page 25: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

The Test Statistic

Make a chart showing both the observed counts andthe expected counts (in parentheses).

Color Blue Orange Green Yellow Brown RedObserved 20 24 25 23 12 10(Expected) (27.36) (22.80) (18.24) (15.96) (14.82) (14.82)

Page 26: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

The Test Statistic

Denote the observed counts by O and the expectedcounts by E.Define the chi-square (χ2) statistic to be

χ2 =∑

all cells

(O− E)2

E.

Page 27: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

The Value of the Test Statistic

Clearly, if all of the deviations O− E are small, then χ2

will be small.But if even a few the deviations O− E are large, then χ2

will be large.

Page 28: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

The Value of the Test Statistic

Now calculate χ2.

χ2 =(20− 27.36)2

27.36+

(24− 22.80)2

22.80+

(25− 18.24)2

18.24

+(23− 15.96)2

15.96+

(12− 14.82)2

14.82+

(10− 14.82)2

14.82= 1.9799 + 0.0632 + 2.5054

+3.1054 + 0.5366 + 1.5676

= 9.7581.

Page 29: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Compute the p-Value

The p-value is the likelihood of observing a χ2 value aslarge at 9.7581.To find that value, we need to know something aboutthe distribution of χ2.

Page 30: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Chi-Square Degrees of Freedom

The χ2 distribution has an associated degrees offreedom, just like the t distribution.Each χ2 distribution has a slightly different shape,depending on the number of degrees of freedom.For example, we let χ2

5 denote the chi-square statisticwith 5 degrees of freedom.

Definition (χ2 degrees of freedom)

In a goodness-of-fit test, the number of degrees of freedomis one less than the number of cells.

Page 31: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Chi-Square Degrees of Freedom

The Graph of χ21

2.5 5 7.5 10 12.5 15

0.05

0.1

0.15

0.2

0.25

Page 32: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Chi-Square Degrees of Freedom

The Graph of χ22

2.5 5 7.5 10 12.5 15

0.05

0.1

0.15

0.2

0.25

Page 33: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Chi-Square Degrees of Freedom

The Graph of χ23

2.5 5 7.5 10 12.5 15

0.05

0.1

0.15

0.2

0.25

Page 34: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Chi-Square Degrees of Freedom

The Graph of χ24

2.5 5 7.5 10 12.5 15

0.05

0.1

0.15

0.2

0.25

Page 35: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Chi-Square Degrees of Freedom

The Graph of χ25

2.5 5 7.5 10 12.5 15

0.05

0.1

0.15

0.2

0.25

Page 36: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Chi-Square Degrees of Freedom

The Graph of χ26

2.5 5 7.5 10 12.5 15

0.05

0.1

0.15

0.2

0.25

Page 37: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Chi-Square Degrees of Freedom

The Graph of χ27

2.5 5 7.5 10 12.5 15

0.05

0.1

0.15

0.2

0.25

Page 38: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Chi-Square Degrees of Freedom

The Graph of χ28

2.5 5 7.5 10 12.5 15

0.05

0.1

0.15

0.2

0.25

Page 39: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Properties of χ2

The chi-square distribution with df degrees of freedomhas the following properties.

χ2 ≥ 0.It is unimodal.It is skewed right (not symmetric!)µχ2 = df .σχ2 =

√2df .

If df is large, then χ2df is approximately normal with

mean df and standard deviation√

2df .

Page 40: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Chi-Square vs. Normal

The graph of χ28 vs. N(8, 4)

-5 5 10 15 20

0.02

0.04

0.06

0.08

0.1

0.12

Page 41: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Chi-Square vs. Normal

The graph of χ232 vs. N(32, 8)

10 20 30 40 50 60

0.01

0.02

0.03

0.04

0.05

0.06

Page 42: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Chi-Square vs. Normal

The graph of χ2128 vs. N(128, 16)

80 100 120 140 160 180

0.005

0.01

0.015

0.02

0.025

0.03

Page 43: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Chi-Square vs. Normal

The graph of χ2512 vs. N(512, 32)

450 500 550 600

0.002

0.004

0.006

0.008

0.01

0.012

0.014

Page 44: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

TI-83 - Chi-Square Probabilities

TI-83 Chi-square ProbabilitiesPress 2nd DISTR.Select χ2cdf.Enter the lower endpoint, the upper endpoint, and thedegrees of freedom.Press ENTER. The probability appears in the display.

Page 45: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

TI-83 - Chi-Square Probabilities

Practice

Find P(χ2 > 6) with df = 3.Find P(20 < χ2 < 30) with df = 25.Find P(χ2 < 10) with df = 6.

Page 46: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

The Goodness-of-Fit Test

In our example, we found χ2 = 9.7581.There are 6 categories (colors), so there are 5 degreesof freedom.The p-value is

χ2cdf(9.7581,E99,5) = 0.0823.

That is greater than α, so we accept H0.We conclude that the colors fit the distribution given bythe Mars Candy Company.

Page 47: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

The Goodness-of-Fit Test

Example (The Goodness-of-Fit Test)(1) H0 : p1 = 0.24, p2 = 0.20, p3 = 0.16, p4 = 0.14,

p5 = 0.13, p6 = 0.13H1 : H0 is not true.

(2) α = 0.05.

(3) χ2 =∑

all cells(O−E)2

E .

(4)Color Blue Orange Green Yellow Brown RedObserved 20 24 25 23 12 10(Expected) (27.36) (22.80) (18.24) (15.96) (14.82) (14.82)

χ2 = 9.7581.(5) p-value = χ2cdf(9.7581,E99,5) = 0.0823.(6) Accept H0.(7) The color distribution in plain M&Ms is what the Mars

Candy Company advertises it is.

Page 48: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Goodness-of-Fit Test on the TI-83

Be careful when using the TI-83!There is a function called χ2-Test, but it does notperform this test.Be careful! On the TI-83 there is a function calledχ2-Test, but it does not perform this test.Some TI-84s have a GOF-Test function.The GOF-Test function does perform this test.

Page 49: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Goodness-of-Fit Test on the TI-83

TI-83 Goodness-of-fit testPut the observed counts in list L1.Put the hypothetical proportions in list L2.Multiply L2 by the sample size and store as L2. Theseare the expected counts.Calculate (L1-L2)2/L2.Go to LIST > MATH and select sum (item #5).Enter Ans and press ENTER. The value of χ2 appears.Then use χ2cdf to find the p-value.

Page 50: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Example - Male vs. Female Births

Example (TI-83 Goodness-of-fit test)Suppose we observe 1000 births and find that 520 aremale and 480 are female.Does this indicate that male births and female birthsare not equally likely?

Page 51: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Example - Male vs. Female Births

Example (TI-83 Goodness-of-fit test)(1) Let p1 = proportion of male births.

Let p2 = proportion of female births.H0 : p1 = 0.50, p2 = 0.50H1 : H0 is not true.

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

χ2 =∑

all cells

(O− E)2

E.

Page 52: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Example - Male vs. Female Births

Example (TI-83 Goodness-of-fit test)(4) We have the table

Male FemaleObserved 520 480(Expected) (500) (500)

Calculate

χ2 =(520− 500)2

500+

(480− 500)2

500= 0.8 + 0.8

= 1.6

Page 53: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Example - Male vs. Female Births

Example (TI-83 Goodness-of-fit test)(5) The p-value is

p-value = χ2cdf(1.6,E99,1) = 0.2059.

(6) Accept H0.(7) The proportion of male births is 50%.

Page 54: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Example - Male vs. Female Births

Perform the above test as a two-tailed one-proportion ztest.That is, let the alternative hypothesis be

H1 : p1 6= p2.

What is the p-value?What is the value of the test statistic z?Square that number. What do you get?

Page 55: Test of Goodness of Fit - Lecture 42 Section 14people.hsc.edu/faculty-staff/robbk/Math121/Lectures...Chi-Square Statistic Goodness-of-Fit Test on the TI-83 Male vs. Female Births Again

Test ofGoodness of

Fit

Robb T.Koether

HomeworkReview

TheGoodness-of-FitTest

TheChi-SquareStatistic

Goodness-of-Fit Test on theTI-83

Male vs.Female BirthsAgain

Assignment

Assignment

HomeworkRead Sections 14.1 - 14.3, pages 921 - 935.Let’s Do It! 14.2, 14.3.Exercises 6 - 11, 14, 15, page 935.