Chapter 20 Testing hypotheses about proportions Math2200.

30
Chapter 20 Testing hypotheses about proportions Math2200

Transcript of Chapter 20 Testing hypotheses about proportions Math2200.

Page 1: Chapter 20 Testing hypotheses about proportions Math2200.

Chapter 20 Testing hypotheses about

proportions

Math2200

Page 2: Chapter 20 Testing hypotheses about proportions Math2200.

Example: Ingot

• Ingot: Huge pieces of metal• Cracking is a serious problem for metal

manufactures– 20% of the ingots have cracks

• The plant engineers try to reduce the crack rate by making some changes in the casting process– 400 ingots have been cast and only 17% of them

have cracked

• Real improvement or sampling variation?

Page 3: Chapter 20 Testing hypotheses about proportions Math2200.

Null vs Alternative

• A hypothesis proposes a model.• Our starting hypothesis is called the null hypothesis.

– The null hypothesis, that we denote by H0, specifies a population model parameter of interest and proposes a value for that parameter.

– We usually write down the null hypothesis in the form H0: parameter = hypothesized value.

– We are more concerned if the error occurs when the null hypothesis is true.

• The alternative hypothesis, which we denote by HA, contains the value of the parameter that we consider plausible when we reject the null hypothesis.

Page 4: Chapter 20 Testing hypotheses about proportions Math2200.

Ingot (cont’)

• H0: p=0.2 (cracking rate is still 20%)

• HA: p<0.2 (cracking rate has decreased)

• If the observed cracking proportion is much lower than 0.2, we will reject the null hypothesis.

• But how low?

Page 5: Chapter 20 Testing hypotheses about proportions Math2200.

Ingot (cont’)

• Data: 17 out of 400 ingots have cracks– Sample size is big enough – Independence is reasonable– We can use normal model to approximate the

distribution of the sample proportion– Under the null hypothesis,

Page 6: Chapter 20 Testing hypotheses about proportions Math2200.

Ingot (cont’)

• Model of the sample proportion under the null hypothesis– Normal with mean p=0.2 and SD=0.02

• How likely to observe a sample proportion is equal to or less than 0.17?– Z-score

– Using a standard normal table or a calculator, the probability is 0.067

Page 7: Chapter 20 Testing hypotheses about proportions Math2200.

Hypothesis testing

• Hypothesis testing– Prove something is correct (difficult)– Recognize something is wrong (relatively easy)

• Think about jury trials– The starting hypothesis: the defendant is innocent– We retain the hypothesis until the facts make it

unlikely beyond a reasonable doubt– ‘not guilty’ only means not enough evidence to

prove guilty. It does NOT say the defendant is innocent.

Page 8: Chapter 20 Testing hypotheses about proportions Math2200.

Hypothesis testing (cont’)

• The same logic used in jury trials is used in statistical tests of hypotheses: – We begin by assuming that a hypothesis is true. – Next we consider whether the data are consistent with the

hypothesis. – If they are, all we can do is retain the hypothesis we started

with. If they are not, then like a jury, we ask whether they are beyond a reasonable doubt.

• If the data seem consistent with what we would expect from natural sampling variability, we will retain the null hypothesis.

• If the probability of seeing results like our data is really low, we reject the hypothesis.

Page 9: Chapter 20 Testing hypotheses about proportions Math2200.

P-value

• The probability that the observed statistic value and even more extreme values could occur if the null hypothesis is true.

• Always report the P-value with the conclusion.

Page 10: Chapter 20 Testing hypotheses about proportions Math2200.

Ingot• P-value is 0.067.• 6.7% rare enough?

– ‘Beyond a reasonable doubt’?

• Usually, P-value less than 0.05 is regarded as ‘small’– We fail to reject the null hypothesis. That is, we fail

to conclude that the technical change in the production process reduces the cracking rate.

– Sometimes, cutoff values of 0.1 or 0.01 are also used

– Always report p-values so that people using different cutoff values can have their own conclusions

Page 11: Chapter 20 Testing hypotheses about proportions Math2200.

The Reasoning of Hypothesis Testing

• There are four basic parts to a hypothesis test:

1. Hypotheses

2. Model

3. Mechanics

4. Conclusion

• Let’s look at these parts in detail…

Page 12: Chapter 20 Testing hypotheses about proportions Math2200.

The Reasoning of Hypothesis Testing (cont.)

1. Hypotheses– The null hypothesis: To perform a

hypothesis test, we must first translate our question of interest into a statement about model parameters. • In general, we have

H0: parameter = hypothesized value.

– The alternative hypothesis: The alternative hypothesis, HA, contains the values of the parameter we consider plausible if we reject the null.

Page 13: Chapter 20 Testing hypotheses about proportions Math2200.

The Reasoning of Hypothesis Testing (cont.)

2. Model– To plan a statistical hypothesis test, specify

the model you will use to test the null hypothesis and the parameter of interest.

– All models require assumptions, so state the assumptions and check any corresponding conditions.

Page 14: Chapter 20 Testing hypotheses about proportions Math2200.

The Reasoning of Hypothesis Testing (cont.)

2. Model– Each test we discuss in the book has a

name that you should include in your report.– The test about proportions is called a one-

proportion z-test.

Page 15: Chapter 20 Testing hypotheses about proportions Math2200.

One-Proportion z-Test

• The conditions for the one-proportion z-test are the same as for the one proportion z-interval. We test the hypothesis

H0: p = p0

using the statistic

where

• When the conditions are met and the null hypothesis is true, this statistic follows the standard Normal model, so we can use that model to obtain a P-value.

ˆ

p pz

SD p

0 0ˆp q

SD pn

Page 16: Chapter 20 Testing hypotheses about proportions Math2200.

The Reasoning of Hypothesis Testing (cont.)

3. Mechanics– calculate of our test statistic from the data.– Different tests have different formulas and

different test statistics.– Usually handled by a statistics program or

calculator.– The ultimate goal of the calculation is to

obtain a P-value.

Page 17: Chapter 20 Testing hypotheses about proportions Math2200.

The Reasoning of Hypothesis Testing (cont.)

4. Conclusion– The conclusion in a hypothesis test is

always a statement about the null hypothesis.

– The conclusion must state either that we reject or that we fail to reject the null hypothesis.

– The conclusion should be stated in context.

Page 18: Chapter 20 Testing hypotheses about proportions Math2200.

Alternative hypotheses

• There are three possible alternative hypotheses:

• HA: parameter < hypothesized value

• HA: parameter ≠ hypothesized value

• HA: parameter > hypothesized value

Page 19: Chapter 20 Testing hypotheses about proportions Math2200.

Alternative hypotheses (cont.)

• HA: parameter ≠ value is known as a two-sided alternative because we are equally interested in deviations on either side of the null hypothesis value.

• For two-sided alternatives, the P-value is the probability of deviating in either direction from the null hypothesis value.

Page 20: Chapter 20 Testing hypotheses about proportions Math2200.

Alternative hypotheses (cont.)

• The other two alternative hypotheses are called one-sided alternatives.

• A one-sided alternative focuses on deviations from the null hypothesis value in only one direction.

• Thus, the P-value for one-sided alternatives is the probability of deviating only in the direction of the alternative away from the null hypothesis value.

Page 21: Chapter 20 Testing hypotheses about proportions Math2200.

P-Values and Decisions:What to Tell About a Hypothesis

Test

• How small should the P-value be in order for you to reject the null hypothesis?

• Our decision criterion is context-dependent.

• Another factor in choosing a P-value is the importance of the issue being tested.

Page 22: Chapter 20 Testing hypotheses about proportions Math2200.

Example: Baby gender

• Some culture value male children more highly than female children.

• In 1993 in one hospital, 313 (56.9%) of the 550 live births that year were boys

• Baseline for this region is 51.7% male live births

• Is the sample proportion of 56.9% evidence of a higher proportion of male births?

Page 23: Chapter 20 Testing hypotheses about proportions Math2200.

Baby gender (cont’)

• H0 : p=0.517 versus HA : p>0.517• Checking assumptions

– Independence– Random sampling– 10% condition– Success/failure condition

• The sample proportion has a normal model when the above conditions are satisfied

Page 24: Chapter 20 Testing hypotheses about proportions Math2200.

Baby gender (cont’)

• One-proportion z-test– The model under the null hypothesis is normal

with mean 0.517 and sd 0.0213– Z-score is 2.44– One-sided alternative– P-value is 0.0073

Page 25: Chapter 20 Testing hypotheses about proportions Math2200.

TI-83

• STAT TESTS

• 5:1-PropZTest

• Enter observed value of x (counts)

• Specify the sample size n

• Choose from– One-tail lower tail (one-sided alternative)– Two-tail (two-sided alternative)– One-tail upper tail (one-sided alternative)

Page 26: Chapter 20 Testing hypotheses about proportions Math2200.

Baby gender (cont’)

• Conclusion– If the true proportion of male babies were still

at 51.7%, an observed proportion of 56.9% male babies would occur at random only about 7 times in 1000. This suggests that the birth ratio of boys to girls is not equal to its natural level, but rather has increased.

Page 27: Chapter 20 Testing hypotheses about proportions Math2200.

What Can Go Wrong?

• Don’t base your null hypothesis or alternative hypothesis on what you see in the data.– You are not allowed to look at the data first

and then adjust your null or alternative hypotheses.

Page 28: Chapter 20 Testing hypotheses about proportions Math2200.

What Can Go Wrong? (cont.)

• Don’t make your null hypothesis what you want to show to be true.– You can reject the null hypothesis, but you

can never “accept” or “prove” the null.

• Don’t forget to check the conditions.– We need randomization, independence, and a

sample that is large enough to justify the use of the Normal model.

Page 29: Chapter 20 Testing hypotheses about proportions Math2200.

What have we learned?

• We can use what we see in a random sample to test a particular hypothesis about the world.

• Testing a hypothesis involves proposing a model, and seeing whether the data we observe are consistent with that model or so unusual that we must reject it.– We do this by finding a P-value—the probability that

data like ours could have occurred if the model is correct.

Page 30: Chapter 20 Testing hypotheses about proportions Math2200.

What have we learned? (cont.)

• We’ve learned the process of hypothesis testing, from developing the hypotheses to stating our conclusion in the context of the original question.