chapter 9: hypothesis testing 9.1 introduction to hypothesis testing hypothesis testing is a tool...

15
apter 9: Hypothesis Testing 9.1 Introduction to Hypothesis Testing Hypothesis testing is a tool you use to make decision from data. Something you usually do: 1. You make a statement about something. 2. You collect sample data relating to the statement. 3. If given that the statement is true, the sample outcome is unlikely, you realize that the statement probably is not true. For example, assume you want to know if a particular coin is fair. Your hypothesis is that it is a fair coin. You toss the coin 20 times and get heads 18 times. Since that is an unlikely outcome

Upload: jewel-jefferson

Post on 29-Dec-2015

230 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Chapter 9: Hypothesis Testing 9.1 Introduction to Hypothesis Testing Hypothesis testing is a tool you use to make decision from data. Something you usually

Chapter 9: Hypothesis Testing9.1 Introduction to Hypothesis TestingHypothesis testing is a tool you use to make decision from data. Something you usually do:1. You make a statement about something.2. You collect sample data relating to the statement.3. If given that the statement is true, the sample outcome is unlikely, you realize that the statement probably is not true.

For example, assume you want to know if a particular coin is fair. Your hypothesis is that it is a fair coin. Youtoss the coin 20 times and get heads 18 times. Since that is an unlikely outcome given that it is a fair coin, you reject the hypothesis that it is a fair coin.

Page 2: Chapter 9: Hypothesis Testing 9.1 Introduction to Hypothesis Testing Hypothesis testing is a tool you use to make decision from data. Something you usually

9.2 Steps of Hypothesis Testing

1. Specify the null hypothesis (虛無假設,零假設 , H0) and the alternative hypothesis (對立假設 , H1).2. What level of significance ()?3. Which test and test statistic?4. State the decision rule.5. Use the sample data to calculate the test statistic.6. Use the test statistic to make a decision.7. Interpret the decision in the context of the original question.

Page 3: Chapter 9: Hypothesis Testing 9.1 Introduction to Hypothesis Testing Hypothesis testing is a tool you use to make decision from data. Something you usually

Assume that a teacher has a class of 28 students. She want to use the IQ score to demonstrate that herstudents are “above average.” The IQ scores are standardized to have a population mean of 100 and astandard deviation of 16.

Step 1: Specify the Null Hypothesis and the Alternative Hypothesis

The null hypothesis, H0, is the statement we are interestedin testing. The word null implies “nothing” or “non existent.”It indicates what would happen by chance or what wouldhappen if there was no difference or no treatment effect.

The alternative hypothesis, H1, is the statement that we accept if our sample outcome leads us to reject the nullhypothesis

Page 4: Chapter 9: Hypothesis Testing 9.1 Introduction to Hypothesis Testing Hypothesis testing is a tool you use to make decision from data. Something you usually

For the classroom example, the statement is as follows:

H0: = 100 (the students have an average IQ)H1: > 100 (the students have an above-average IQ)

The null hypothesis always includes the equal condition. The teacher is interested in the condition that the students are above average. Then this condition is in the alternative hypothesis. The hypotheses are written in the form with a population parameter on the left and a numeric value on the right: H0: = 0

H1: > 0

0 = the hypothesized value, 100 in this example.

Page 5: Chapter 9: Hypothesis Testing 9.1 Introduction to Hypothesis Testing Hypothesis testing is a tool you use to make decision from data. Something you usually

Step 2: What Level of Significance (顯著水準 )The level of significance is the probability of rejecting the null hypothesis by chance alone. (What does it mean with = 0.05?) This could result from sampling error. Occasionallywe get a sample just by chance (碰巧 ) that would lead us to reject the null hypothesis. It is possible to get 18 out of 20 heads with a perfectly fair coin, but the probability is very low or unlikely. The level of significance is our definition of unlikely. The traditional definition of unlikely is 5% of the time or less. (碰巧取到較極端的資料導致推翻正確 Ho的機率 )

What significance level should you use?If you want to be more certain that we are not falsely rejectingthe null hypothesis, you can reduce the significance level to .01or even lower.When in doubt, use the standard 5% level.

Page 6: Chapter 9: Hypothesis Testing 9.1 Introduction to Hypothesis Testing Hypothesis testing is a tool you use to make decision from data. Something you usually

Type I and Type II errorsThe significance level is also called the probability of a typeI error. A type I error occurs when you falsely reject the nullhypothesis on the basis of sampling error. A type II error occurs when you fail to reject the null hypothesis when itis false.

Page 7: Chapter 9: Hypothesis Testing 9.1 Introduction to Hypothesis Testing Hypothesis testing is a tool you use to make decision from data. Something you usually

Step 3: Which Test and Test Statistic?The test statistic (統計量 ) is the value calculated from the sample to determine whether to reject the null hypothesis.If we can assume a normal sampling distribution of means,we can calculate a z-value for a sampling distribution.For our IQ problem, a sample of 28 is enough for the central limit theorem to be valid, especially since we havereason to believe that the population distribution of IQs isclose to normal.For out test of mean vs. hypothesized value, a z-test, the test statistic is

To calculate this test statistic, we need to know the populationstandard deviation, . In this case, we know = 16.

[9.1] /

0

n

Xz

Page 8: Chapter 9: Hypothesis Testing 9.1 Introduction to Hypothesis Testing Hypothesis testing is a tool you use to make decision from data. Something you usually

Step 4: State the Decision RuleWe reject the null hypothesis if the test statistic is larger thana critical value corresponding to the significance level in step2. For = 0.05, the z-value corresponding to 0.05 in theupper tail of the normal curve is 1.645. The decision rule is

Reject H0 if z > 1.645

Page 9: Chapter 9: Hypothesis Testing 9.1 Introduction to Hypothesis Testing Hypothesis testing is a tool you use to make decision from data. Something you usually

(1) We were testing whether the IQ scores are greater than 100, a one-tailed test.We can also test:(2) The mean is less than 100, a one-tailed test.(3) Reject the hypothesis if the mean is either greater than or less than 100, a two-tailed test

5% one-tail upper 5% one-tail lower 5% two-tail z = 1.645 z = -1.645 z = -1.96 z = 1.96

2.5%2.5%

Page 10: Chapter 9: Hypothesis Testing 9.1 Introduction to Hypothesis Testing Hypothesis testing is a tool you use to make decision from data. Something you usually

Step 5: Use the Sample Data to Calculate the Test StatisticAssume that the mean IQ of the students is 105.6. Our teststatistic becomes

85.128/16

)1006.105(

/0

n

Xz

Page 11: Chapter 9: Hypothesis Testing 9.1 Introduction to Hypothesis Testing Hypothesis testing is a tool you use to make decision from data. Something you usually

Step 6: Use the Test Statistic to Make a DecisionWe see that our z value of 1.85 is greater than the criticalvalue 1.645, and so we reject the null hypothesis

Page 12: Chapter 9: Hypothesis Testing 9.1 Introduction to Hypothesis Testing Hypothesis testing is a tool you use to make decision from data. Something you usually

Step 7: Interpret the Decision in the Context of the Original QuestionTo say that a result is “statistically significant” means thatit is more than by chance alone.

The Concept of a p-value In our example, the probability of a z-value greater than 1.85is 0.0322. This is called p-value of the test. The p-value is theprobability of getting the sample result by chance alone if the null-hypothesis is actually true. In our case, the p-value is smaller than the level of significance.

The decision rule can also beReject H0 if the p-value is less than

can be any significance level.Note: For a two-tail test, you double one-tail p-value before comparing it to .

Page 13: Chapter 9: Hypothesis Testing 9.1 Introduction to Hypothesis Testing Hypothesis testing is a tool you use to make decision from data. Something you usually

Test Statistic versus p-valueBoth methods require the calculation of a test statistic. The test statistic approach compares the value of the calculatedtest statistic to a critical value from a table; the p-valueapproach calculates the probability of the test statistic and compares it to the significance level, .If you are using a statistical software, you will get a p-valueand you do not need to look up a critical value in a table.

With the p-value approach, instead of just rejecting the nullhypothesis (or not rejecting it), you will get a sense of howsignificant (or not significant) the results are. For example,if a test has a p-value of 0.000035, it is very unlikely to havehappened by chance alone.

Page 14: Chapter 9: Hypothesis Testing 9.1 Introduction to Hypothesis Testing Hypothesis testing is a tool you use to make decision from data. Something you usually

Learning Activity 9.1-2 Hypothesis Test Calculations Open Htest1.xls!Data. Use excel to calculate the z-value in the text Determine the p-value by looking up the Tables.xls Replicate the z-value and p-value by using MegaStat | Hypothesis Tests | Mean vs. Hypothesized Value Click “Summary Data” and select B3:B6 as the input Use MegaStat | Probability | Normal Distribution to replicate the figures below.

Page 15: Chapter 9: Hypothesis Testing 9.1 Introduction to Hypothesis Testing Hypothesis testing is a tool you use to make decision from data. Something you usually

9.A Hypothesis Testing Simulation (Normal random numbers)Open HtestSim1.xls.This simulates the example we looked at this chapter.We rarely reject H0 when the population mean is 100.When we do reject the H0, it is an example of type I error(rejecting based on a lucky sample).You can change population mean to 110 and see thenull hypothesis is rejected most of the time. When it is notrejected, it is a type II error (failing to reject when you shouldhave since the population mean is greater than 100).

Our example is H0: = 0

H1: > 0

0 = the hypothesized value, 100 in this example.