25
Math 122 Intro to Stats Chapter 6 Semester II, 2015-16 Inference for Categorical Data Hypothesis Testing for a Proportion In a survey, 1864 out of 2246 randomly selected adults said texting while driving should be illegal. Use a significance level of 0.05 to test the claim that more than 80% of adults believe texting should be illegal while driving. 1. H 0 : p H A : p 2. Test Statistic and pvalue: 3. Conclusions: 1

Hypothesis Testing for a Proportion

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Hypothesis Testing for a Proportion

Math 122 Intro to Stats Chapter 6Semester II, 2015-16 Inference for Categorical Data

Hypothesis Testing for a Proportion

In a survey, 1864 out of 2246 randomly selected adults said textingwhile driving should be illegal. Use a significance level of 0.05 totest the claim that more than 80% of adults believe texting shouldbe illegal while driving.

1. H0 : pHA : p

2. Test Statistic and p−value:

3. Conclusions:

1

Page 2: Hypothesis Testing for a Proportion

Use STAT TESTS 1-PropZTest .

1. Let p0 be the null or hypothesized value of p.

2. Let x be the number of successes.

3. Let n be the sample size.

4. Choose 6=, <, or > to correspond to HA.

5. Choose (Calculate) and hit (ENTER)

Use MENU STAT TEST (F3) (F1) (F3).

1. Specify the sidedness of the test.

2. Enter the null value, p0.

3. Enter the number of successes, x.

4. Let n be the sample size.

5. Choose (EXE)

2

Page 3: Hypothesis Testing for a Proportion

Clinical trials involved treating patients with Tamiflu. Among 724patients treated, 72 experienced nausea as an adverse reaction. Usea significance level of 0.05 to test the claim that the rate of nauseais greater than the 6% rate experienced by patients given a placebo.Does nausea appear to be a concern for those given the Tamiflutreatment.

1. H0 : pHA : p

2. Test Statistic and p−value:

3. Conclusions:

3

Page 4: Hypothesis Testing for a Proportion

In a survey of 703 randomly selected workers, 61% got their jobsthrough networking. Use a significance level of 0.05 to test theclaim that most (more than 50%) workers got their jobs throughnetworking. What does the result suggest about the strategy forfinding a job after graduation?

1. H0 : pHA : p

2. Test Statistic and p−value:

3. Conclusions:

4

Page 5: Hypothesis Testing for a Proportion

Hypothesis Testing About Two Proportions

In clinical trials of Lipitor, 94 subjects were treated with Lipitor and270 subjects were given a placebo. Among those treated withLipitor, 7 developed infections. Among the control group, 27developed infections. Use a significance level of 0.05 to test the claimthat rate of infection was the same for both groups.

1. H0 : p1 p2HA : p1 p2

2. Test Statistic and p-value:

3. Conclusions:

5

Page 6: Hypothesis Testing for a Proportion

Chi-Square Distribution

The distribution we will use is the χ2 distribution. Some propertiesof the χ2 distribution are:

1. The χ2 distribution is not symmetric, it is skewed to the right.

2. The values of the distribution cannot be negative.

3. The χ2 distribution is different for each number of degrees offreedom.

6

Page 7: Hypothesis Testing for a Proportion

The following are graphs of the χ2 distribution for various degreesof freedom.

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0 1 2 3 4 5 6 7 8 9 10 11 12 13

7

Page 8: Hypothesis Testing for a Proportion

Goodness of Fit

Assumptions

1. The data have been randomly selected.

2. The sample data consist of frequency counts for each of thedifferent categories.

3. For each category, the expected frequency is at least 5.

A goodness-of-fit test is used to test the hypothesis that anobserved frequency distribution fits some claimed distribution.

8

Page 9: Hypothesis Testing for a Proportion

Hypotheses

The form of the hypotheses is

H0 : p1 = p2 = · · · = pkHA : at least one proportion is different

or

H0 : p1 = value1, p2 = value2, · · · pk = valuekHA : at least one proportion is not as claimed

9

Page 10: Hypothesis Testing for a Proportion

Notation for Goodness-of-Fit

O observed frequency of an outcomeE expected frequency of an outcomek number of different categories or outcomesn total number of trials

Finding Expected Frequencies

• If all expected frequencies are equal, then E = n/k.

• If the expected frequencies are not equal, then E = np for eachcategory. Where p is the probability of being in the category.

Test Statistic for Goodness-of-Fit

χ2 =∑ (O − E)2

E

10

Page 11: Hypothesis Testing for a Proportion

Close agreement between observed and expected frequencies lead toa small value for the χ2 statistic and support the null hypothesis.Significant differences between observed and expected frequencieslead to a large value for the test statistic and result in a rejectionof the null hypothesis. The null hypothesis is that the data fit aparticular distribution.

11

Page 12: Hypothesis Testing for a Proportion

A researcher designs an experiment in which a rat chooses betweendoors of three different colors. Does the rat have preference for oneof the doors?

Green Red BlueFrequency 20 29 31

I. H0 :HA :

II. Test Statistic and p−value:

III. Conclusions:

12

Page 13: Hypothesis Testing for a Proportion

1. Enter the observed counts into list L1 and the expected countsinto list L2.

2. Choose STAT .

3. Right arrow to TESTS .

4. Down arrow and choose χ2 GOF-Test .

5. Enter the degrees of freedom after df:

6. Choose Calculate and hit ENTER .

13

Page 14: Hypothesis Testing for a Proportion

1. Navigate to STAT (MENU), then hit the (2) button or selectSTAT .

2. Enter the observed counts into a list (e.g. List 1) and theexpected counts into list (e.g. List 2).

3. Choose the TEST option (F3).

4. Choose the CHI option (F3).

5. Choose the GOF option (F1).

6. Adjust the Observed and Expected lists to the correspondinglist numbers from Step2.

7. Enter the degrees of freedom, df.

8. Specify a list where the contributions to the test statistic will bereported using CNTRB. This list number should be different fromthe others.

9. Hit the EXE button.

14

Page 15: Hypothesis Testing for a Proportion

Enter observed values in L1 and expected values in L2. With L3highlighted enter the following

(L1− L2)2

L2

The keystrokes are the following:

( 2ND 1 - 2ND 2 ) x2 / 2ND 2

QUIT

2ND STAT scroll to MATH. Select option 5:sum( 2ND 3

press ENTER

This is the χ2 test statistic.

15

Page 16: Hypothesis Testing for a Proportion

We will use the calculator to determine the p−value. The degreesof freedom is one less than the number of categories.

2ND VARS 7

χ2cdf(test statistic, BIG NUMBER, df)

16

Page 17: Hypothesis Testing for a Proportion

Mars, Inc., claims that its M&M’s are distributed with followingcolor percentages: 30% brown, 20% yellow, 20% red, 10% orange,10% green, and 10% blue. A sample of 100 M&M’s yielded thefollowing data. Test the claim that color distribution is as claimed.

Brown Yellow Red Orange Green BlueFrequency 35 25 18 12 5 5

I. H0 :HA :

II. Test Statistic and p−value:

III. Conclusions:

17

Page 18: Hypothesis Testing for a Proportion

Contingency Tables

A contingency table is a table in which frequencies correspondto two variables.

Male FemaleNebraska 300 200Other 300 400

18

Page 19: Hypothesis Testing for a Proportion

Test of Independence/Homogeneity

1. The null hypothesisH0 is the statement that the row and columnvariables are independent. The alternative Ha is that the rowand column variables are dependent.

2. For every cell, the expected frequency is at least 5.

3. The degrees of freedom is (r− 1)(c− 1), where r is the numberof rows and c is the number of columns.

19

Page 20: Hypothesis Testing for a Proportion

Test Statistic for Test of Independence

χ2 =∑ (O − E)2

E

Expected Frequency for a Contingency Table

E =(row total)(column total)

grand total

20

Page 21: Hypothesis Testing for a Proportion

1. Hit 2ND x−1 (i.e. MATRIX).

2. Right arrow to EDIT.

3. Hit 1 or ENTER to select matrix A.

4. Enter the dimensions by typing #rows, ENTER , #columns,ENTER .

5. Enter the data from the two-way table.

6. Choose STAT.

7. Right arrow to TESTS.

8. Down arrow and choose C:χ2-Test.

9. Down arrow, choose Calculate, and hit ENTER

21

Page 22: Hypothesis Testing for a Proportion

1. Navigate to STAT (MENU button, then hit the 2 button orselect STAT).

2. Choose the TEST option ( F3 button).

3. Choose the CHI option ( F3 button).

4. Choose the 2WAY option ( F2 button).

5. Enter the data into a matrix:

• Hit ⊲MAT ( F2 button).

• Navigate to a matrix you would like to use (e.g. Mat C)and hit EXE .

• Specify the matrix dimensions: m is for rows, n is for columns.

• Enter the data.

• Return to the test page by hitting EXIT twice.

6. Enter the Observed matrix that was used by hitting MAT( F1 button) and the matrix letter (e.g. C ).

22

Page 23: Hypothesis Testing for a Proportion

7. Enter the Expected matrix where the expected values will bestored (e.g. D ).

8. Hit the EXE button

23

Page 24: Hypothesis Testing for a Proportion

Male FemaleNebraska 300 200Other 300 400

I. H0 :HA :

II. Test Statistic and p−value:

III. Conclusions:

24

Page 25: Hypothesis Testing for a Proportion

A researcher was interested in comparing three of the most com-monly used NSAIDs (non-steroidal anti-inflammatory drugs): Motrin,Advil, and Aleve. Ninety (90) people who suffer of headaches wererandomly assigned to each of these three treatments.

Felt Better Motrin Advil AleveYes 11 16 20No 19 14 10

I. H0 :HA :

II. Test Statistic and p−value:

III. Conclusions:

25