37
STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing him to use/edit some of their slides.

STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Embed Size (px)

Citation preview

Page 1: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

STT 315

This lecture is based on Chapter 6.

Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing him to use/edit some of their slides.

Page 2: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Within the context of the problem, students will be able to: Perform a one-sample z-test for proportion. Perform one-sample z-test and t-test for mean. Verify the conditions for performing the tests. Identify Type I and Type II errors. Understand the concept of p-value. Interpret the results of the test within the

context of the problem.

Hypothesis Tests: Goal

2

Page 3: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Example 1A congressman claims that only 12% of drivers talk on

their cell phone. Standing at a bus stop someone noticed 4 out of 10 drivers on a cell phone.

• Is this an evidence that the congressman is wrong?• But before answering that question, we must reflect on

“Is the sample size large enough to come to any conclusion about proportion?”No, because np = 1.2, and n(1-p) = 8.8, both of which

are less than 9.So we must have a larger sample.

3

Page 4: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Example 1• What minimum sample size is required that meets the

“large enough” condition?About 76, because it gives np = 9.12 expected

successes and n(1-p) = 66.88 expected failures, both larger than 9.

• Suppose 19 out of 100 drivers were found to be on cell phones. Is this an evidence that the congressman is wrong?

Let us assume that the congressman’s assumption is correct, and find how likely it is to have 19% or more drivers to be on cell phone, when sample size is 100.

4

Page 5: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Example 1• As n = 100 is large enough [np and n(1-p) > 9], • the sample proportion is approximately normal • with mean p = 0.12, • and standard deviation ,• so the chance that sample proportion will be larger

than 19% is normalcdf(0.19,100,0.12,0.0325) = 0.016,

i.e. out of 100 drivers, there is only 1.6% chance that 19 or more drivers will be on cell phone.

• Hence congressman’s claim does not seem to be very likely.

5

Page 6: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Few questions

• We are making our conclusion on the basis of a sample. Is there any possibility of making an error?

• How much reliable is our conclusion?In other words, what is the probability of

making an error?• We are saying that 0.016 (1.6%) is not very

likely. What value(s) should we consider as likely, and what as unlikely?

6

Page 7: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Some terminologies• A hypothesis is a claim/conjecture about some

parameter of the population distribution.In the driving example, congressman’s claim that p =

0.12, is a hypothesis.• We shall have two competing hypotheses:

H0, the null hypothesis,Ha, the alternative hypothesis.

• In testing of hypotheses we try to retain the null hypothesis unless sample provides strong evidence against it, in which case we conclude in favor of alternative hypothesis.

7

Page 8: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

In a hypothesis test we have two possible errors:• We find evidence to reject the null hypothesis but it

turns out that the null hypothesis is true: Type I error.• We do not find evidence to reject the null hypothesis

but the null hypothesis turns out to be false: Type II error.

Errors in testing

8

Page 9: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

A. A Type I errorB. A Type II error

In the cell phone drivers example, when we had 19 people in the sample who were talking on their cell phones, we found evidence to reject the null hypothesis. If the actual percent of drivers who talk on cell phones is 12%, we have made

9

Page 10: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

A. A Type I errorB. A Type II error

In the cell phone drivers example, when we had 14 people in the sample who were talking on their cell phones, we did not find evidence to reject the null hypothesis. If the actual percent of drivers who talk on cell phones is not 12%, we have made

10

Page 11: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Few Remarks• Errors of Type I and II are NOT mistakes.

They happen due to sampling variability. It is the same reason that some confidence intervals

do not contain the population value, because the conclusions we make based on hypothesis tests are probabilistic.

• Except in some special cases, we are bound to make both type of errors. Our attempt is to minimize the probability of making these errors.

• Unfortunately, often is the case that trying to reduce one error increases the chance of other error.

11

Page 12: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Which error is more crucial?• This is not an easy question. In order to answer this

question, let us think of a different problem. Suppose you are a jury member and you have to decide whether someone is guilty or not.

• Which error is more crucial?Type I error.

The person is innocent

The person is guilty

Jury declares the person to be guilty

Type I error

Jury declares the person to be not guilty

Type II error

12

Page 13: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Example

A drug company tests the null hypothesis that a new drug does not work better than a placebo.

What is a Type I error in this case?

A. The tests show the new drug works better than the placebo, but it really does not.

B. The tests show the new drug does not work better than the placebo, but it really does.

13

Page 14: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

A drug company tests the null hypothesis that a new drug does not work better than a placebo.

Which error would be worse to make?

A. The tests show the new drug works better than the placebo, but it really does not. (Type I error)

B. The tests show the new drug does not work better than the placebo, but it really does. (Type II error)

Example

14

Page 15: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

The Testing Procedure• Since Type I error is more crucial, we always make sure that the

probability of Type I error is not too high (say, under 5%) and then we try to minimize Type II error.

• Such a test is said to have a level of significance 5% and it is called a level-0.05 test.

• So level of significance (usually denoted by the Greek letter α) is the maximum permissible probability of Type I error. The popular choices of values of α are 1%, 5% and 10%.

• Given the sample we compute the probability of Type I error, which is also known as observed level of significance or p-value.

• If “p-value is less than level of significance”, we reject H0.• Alternatively, we compute the rejection region corresponding

to α, and find the value of the test-statistic from the sample.• We reject H0 if the value of test-statistic falls in the rejection

region. 15

Page 16: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

The Testing Procedure• Given a statistical problem we shall first decide what are the

suitable null and alternative hypotheses.• Mind that the hypotheses are decided before the data are

collected; that means– the sampled data should not influence what the null

and/or alternative hypotheses are.– but on the basis of sample we shall decide which of the

hypotheses to be rejected.• We decide about the level of significance (α).• We compute the test-statistic and the rejection region and see

if the test-statistic falls in the rejection region.• Additionally, we compute p-value and if p-value < α, we reject

H0.16

Page 17: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

On the question of choosing an level - rules of thumb for p-values

• Popular choices for are 0.01, 0.05 and 0.10.• A p-value below 0.01 is very unusual and provides

strong evidence to reject the null hypothesis.• A p-value between 0.01 and 0.05 is pretty unusual and

provides moderate evidence to reject the null hypothesis.

• A p-value between 0.05 and 0.10 is unusual and provides some evidence to reject the null hypothesis.

• In some social sciences, a p-value between 0.10 and 0.25 is considered unusual and evidence to reject the null hypothesis.

17

Page 18: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

18

Test for population proportion

Page 19: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Test for For the null hypothesis we defineTest-statistic:

The sample has to be large enough to apply this test:

TI 83/84 function 1-PropZTest computes the value of the test statistic and the p-value.

19

Alternative hypothesis

Rejection region

One-sided test (right)One-sided test (left)Two-sided test

Page 20: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Remark• Testing “ against ” is same as testing “ against

”.

• Testing “ against ” is same as testing “ against ”.

20

Page 21: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Example 1Let us test the problem of Example 1 (calling on cell-phone while driving) at 5% level of significance. Here we consider

H0: p = 0.12, Ha: p > 0.12.

In our sample 19 of 100 drivers were on cell-phone.We shall use TI 83/84 Plus to compute p-value.• Press [STAT].• Select [TESTS].• Choose 5: 1-PropZTest….• Input the following:

o p0: 0.12o x: 19o n: 100o prop: > p0

• Choose Calculate and press [ENTER]. 21

Page 22: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Test of 1-proportion with TI 83/84 PlusLet us test the problem of Example 1 (calling on cell-phone while driving) at 5% level of significance. Here we consider

H0: p = 0.12, Ha: p > 0.12.

In our sample 19 of 100 drivers were on cell-phone.The TI 83/84 Plus output gives us:

prop > .12z = 2.154101092p = .0156160664 = .19n = 100.

Alternative hypothesis (Ha)

Value of test-statisticp-value

Value of sample proportion

Sample size

Since p-value = 0.016 and α = 0.05, we reject H0 at 5% level of significance, because p-value < α.Note that we would not have rejected H0 if α = 0.01.

22

Page 23: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Test of 1-proportion with TI 83/84 PlusLet us test the problem of Example 1 (calling on cell-phone while driving) at 5% level of significance. Here we consider

H0: p = 0.12, Ha: p > 0.12.

In our sample 19 of 100 drivers were on cell-phone.The TI 83/84 Plus output gives us:

prop > .12z = 2.154101092p = .0156160664 = .19n = 100.

Alternative hypothesis (Ha)

Value of test-statisticp-value

Value of sample proportion

Sample size

On the other hand, for α = 0.05, we compute Since reject H0 at 5% level of significance.

Note, and we do not reject H0 at α = 0.01.23

Page 24: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Example 2The manufacturer of a certain chewing gum claims that four out of five dentists surveyed prefer their type of gum. You decide to test their claim against the alternative that it is less. You find that in a sample of 200 doctors, 74% do actually prefer their gum. Is this evidence sufficient to doubt the manufacturer’s claim? Use We shall test, against .We find that (from TI 83/84) that

Since p-value < 0.03, we reject at =0.03.𝛼Also

24

Page 25: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Example 3In a random sample of 200 education school students, 92 sample members indicated some measure of agreement with this statement: “Scores on a standardized entrance exam are less important for a student’s chance to succeed academically than is the student’s high school GPA”. Test at the 5% level of significance the null hypothesis that one-half of all education school graduates would agree with this statement against the alternative that its is different than half.We shall test, against .We find that (from TI 83/84) that

Since p-value > 0.05, we do not reject at =0.05.𝛼Also

25

Page 26: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

26

Tests for population mean

Page 27: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

27

Testing • Consider a population with mean and

standard deviation • Goal: to test against a suitable alternative,

using a random sample of size n from the population.

• Like constructing CI’s of , the testing procedure will depend on whether – the sample size n is large enough or not,– we know the value of or not.

Page 28: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

28

Large sample tests for

Page 29: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Large sample test for If nothing is known about the population and the sample size is large For the null hypothesis we defineTest-statistic: , (if known) or (if unknown).

TI 83/84 function Z-Test computes the value of the test statistic and the p-value.

29

Alternative hypothesis

Rejection region

One-sided test (right)One-sided test (left)Two-sided test

Page 30: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

A sample of 82 MSU undergraduates, the mean number of Facebook friends was 616.95 friends with standard deviation of 447.05 friends. Test whether the average friend size of MSU undergraduates is different from the average number of Facebook friends of all Facebook users, reported at 130 friends as of March 20, 2010. To test: • Press [STAT].• Select [TESTS].• Choose 1: Z-Test• Inpt: Select with arrow keys Stats• Input the following:

µ0: 130 : 447.05 : 616.95 n: 82 µ: ≠ µ0

• Choose Calculate and press [ENTER].30

Facebook Example

Page 31: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

31

Facebook ExampleIn Facebook Example: H0: µ = 130, Ha: µ ≠ 130.

In our sample n = 82, mean = 616.95, std. dev. = 447.05.Let us test at 5% level of significance (i.e. α = 0.05).The TI 83/84 Plus output gives us:

µ ≠ 130z = 9.863594213p = 6.100659E-23 = 616.95n = 82

Alternative hypothesis (Ha)

Test statistic

p-value

Sample mean

Sample size

Since p-value is almost 0 and α = 0.05, we reject H0 at 5% level of significance, because p-value < α.Also, So we reject H0 at α = 0.05.

31

Page 32: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

32

Tests for in normal populations

Page 33: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Test for [normal population: known ]Suppose the population is normally distributed with known . For the null hypothesis we defineTest-statistic: .

In case, nothing is known about the population distribution and we make normality assumption and perform the above test.TI 83/84 function Z-Test computes the value of the test statistic and the p-value.

33

Alternative hypothesis

Rejection region

One-sided test (right)One-sided test (left)Two-sided test

Page 34: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

34

Example 4The state lottery office claims that the average household income of those people playing the lottery is about $37,000.We want to test ( that above average income is actually more than that. Assume that the distribution of household income of those people playing the lottery is normally distributed with a standard deviation of $5,756. Suppose that for a sample of 25 households, it is found that the average income was $38,243.To test: against Using Z-Test, we get and p-value = 0.1359.Here rejection region: Since , we do not reject at .Also here p-value

Page 35: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Test for [normal population: unknown ]Suppose the population is normally distributed with unknown . For the null hypothesis we defineTest-statistic: .

In case, nothing is known about the population distribution and we make normality assumption and perform the above test.TI 83/84 function T-Test computes the value of the test statistic and the p-value.

35

Alternative hypothesis

Rejection region

One-sided test (right)One-sided test (left)Two-sided test

Page 36: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

36

Example 5The manufacturer of a new product claims that his product will increase output per machine by at least 29 units per hour. A line manager adopts the product on 15 of his machines, and finds that the average increase was only 26 with a std. dev. of 6.2. Test whether output increase is less than the claim (use ).To test: against

29t = -1.8740242p = 0.0409746397 = 26Sx = 6.2n = 15

Alternative hypothesis (Ha)

Test statistic

p-value

Sample mean

Sample standard deviation

Sample size

Since p-value = 0.04 < 0.05, we reject H0 at α = 0.05.Also so we reject H0 at α = 0.05.

36

Page 37: STT 315 This lecture is based on Chapter 6. Acknowledgement: Author is thankful to Dr. Ashok Sinha, Dr. Jennifer Kaplan and Dr. Parthanil Roy for allowing

Remark

• Testing “ against ” is same as testing “ against ”.

• Testing “ against ” is same as testing “ against ”.

37