# S2 Chapter 7: Hypothesis Testing Dr J Frost Last modified: 3 rd October 2014.

## Presentation on theme: "S2 Chapter 7: Hypothesis Testing Dr J Frost Last modified: 3 rd October 2014."— Presentation transcript:

S2 Chapter 7: Hypothesis Testing Dr J Frost (jfrost@tiffin.kingston.sch.uk) Last modified: 3 rd October 2014

What is Hypothesis Testing? To get a flavour of hypothesis testing, discuss how you would approach the following problem: In 2013 in Richmond park, whenever I went on an hour long stroll, I saw on average 10 squirrels. I want to establish whether now in 2014, the rate of squirrels I see has increased. I need to ensure any result I get is statistically significant. 1.Go on a stroll one day in 2014 and count the number of squirrels I see. Suppose I saw 15 squirrels. 2.If I were to assume that the rate at which I see squirrels hasn’t changed, I would calculate the probability that I would see 15 squirrels or more (using a Poisson Distribution). 3.If this probability of seeing at least 15 squirrels by chance is sufficiently low (say less than 5%), I conclude that the rate at which squirrels appear has increased.  In a hypothesis test, the evidence from the sample is a test statistic. (In this case, we’ve taken a sample by counting squirrels, and found the test statistic of “rate of squirrels across 1 hour was 15”) Note: This first lesson will be mostly note-taking, so pay attention!

What is Hypothesis Testing? Hypothesis testing in a nutshell* then is: 1.We have some hypothesis we wish to see if true (average rate of squirrels seen has increased), so… 2.We collect some sample data (giving us our test statistic) and… 3.If that data is sufficiently unlikely to have emerged ‘just by chance’, then we conclude that our (alternate) hypothesis is correct. * Squirrel pun intended. 

Null Hypothesis and Alternative Hypothesis We said that our two hypotheses are about the population parameter. ? ?

The probability of getting exactly 5 heads is only 22%, which is more likely to not happen than to happen. If we saw this number of heads, why would it not be sensible to think the coin is biased? The probability is only low because there’s lots of possible outcomes. But 5 heads forms part of a range of possible number of heads that collectively would be consistent with a coin not biased towards heads. Critical Regions and Values Num heads 0 1 2 3 4 5 6 7 8 As before, we’re interested how likely a given outcome is likely to happen ‘just by chance’ under the null hypothesis (i.e. when the coin is not biased). ?

Critical Regions and Values 00.0039 10.0352 20.1445 30.3633 40.6367 50.8555 60.9648 70.9961 What’s the probability that we would see 6 heads, or an even more extreme value? Is this sufficiently unlikely to support John’s claim that the coin is biased? What’s the probability that we would see 7 heads, or an even more extreme value? ? ?

Critical Regions and Values  The value(s) on the boundary of the critical region are called critical value(s). ? 00.0039 10.0352 20.1445 30.3633 40.6367 50.8555 60.9648 70.9961 We’ll explore more fully critical values and regions later on… ?

Quickfire Critical Regions 00.0312 10.1875 20.5000 30.8125 40.9688 Coin thrown 5 times. Trying to establish if biased towards heads. 00.0010 10.0107 20.0547 …… 70.9453 80.9893 90.9990 Coin thrown 10 times. Trying to establish if biased towards heads. 00.0010 10.0107 20.0547 …… 70.9453 80.9893 90.9990 Coin thrown 10 times. Trying to establish if biased towards tails. ???

One and Two-Tailed Tests Num heads 0 1 2 3 4 5 6 7 8 Our critical region Num heads 0 1 2 3 4 5 6 7 8 ?

Structure of Hypothesis Tests

Example Accidents used to occur at a road junction at a rate of 6 per month. After a speed limit is placed on the road the number of accidents in the following month is 2. The planners wish to test, at the 5% level of significance, whether or not there has been a decrease in the rate of accidents. a) Suggest a suitable test statistic. b) Write down the null and alternative hypothesis. c) Explain the conditions under which the null hypothesis is rejected. The number of accidents in a month. ? ? ? ?

Exercise 7A 3 5 7 ? ? ? ? ?

Carrying out Hypothesis Tests for Poisson/Binomial Q From earlier: 4. State conclusion. Address: a)Is result significant or not? b)What are implications in terms of context of original problem? ? ? ?

Test Your Understanding Over a long period of time it has been found that in Enrico’s restaurant the ratio of non-veg to veg meals is 2 to 1. In Manuel’s restaurant in a random sample of 10 people ordering meals, 1 ordered a vegetarian meal. Using a 5% level of significance, test whether or not the proportion of people eating veg meals in Manuel’s restaurant is different to that in Enrico’s restaurant. Q1 Half significance as 2 tailed. Conclusion and what it means in context. ?

Test Your Understanding Accidents used to occur at a certain road junction at a rate of 6 per month. The residents petitioned for traffic lights. In the month after the lights were installed there was only 1 accident. Does this give sufficient evidence that the lights have reduced the number of accidents? Use a 5% level of significance. Q2 Over a long period of time, Jessie found that the bus taking her to school was late at the rate of 6.7 times per month. In the month following the start of the new summer bus schedules, Jessie finds that her bus is late twice. Assuming that the number of times the bus is late has a Poisson distribution, test at the 1% level of significance, whether or not the new schedules have in fact decreased the number of times the bus is late. Q3 (Note: Poisson tables can be used for Q2 but not for Q3) ? ?

Exercise 7B 1 9 11 13 15 ? ? ? ? ?

Critical Regions with One and Two Tailed Tests There are two options for carrying out hypothesis tests: Calculate the probability of the outcome “or worse” and see if this is lower than the significance level (as we just did). Calculate the critical regions and see if the test statistic lies within it. We earlier touched upon finding critical value(s), i.e. those at which (and beyond which) we reject the null hypothesis. Num heads 0 1 2 3 4 5 6 7 8 00.0039 10.0352 20.1445 30.3633 40.6367 50.8555 60.9648 70.9961 ?

Quickfire Critical Regions 00.0312 10.1875 20.5000 30.8125 40.9688 Coin thrown 5 times. Trying to establish if biased towards heads. 00.0010 10.0107 20.0547 …… 70.9453 80.9893 90.9990 Coin thrown 10 times. Trying to establish if biased towards heads. 00.0010 10.0107 20.0547 …… 70.9453 80.9893 90.9990 Coin thrown 10 times. Trying to establish if biased towards tails. ???

0.2520.02 Actual Level of Significance 0.015 0.013 0.30.4 This is because our values are discrete and therefore are unlikely to be able to get ‘exactly’ 5%. At each tail we had to be within 2.5%. Now suppose we instead opted on a policy of choosing the closest to 2.5% rather than the first under it… Although we exceeded 2.5% at the left tail, because there was some ‘spare’ here, the actual level of significance is 1.5% + 1.3% + 2% = 4.8%, which is within the level of significance. ? In an exam, they will say “find the value as close to 0.025 as possible.”

Quickfire Critical Regions (Closest Value) Only if specifically instructed to find the closest to 2.5% for each tail: For the left tail, just find the closest value in the table. Find the right tail, use the value just AFTER the closest one. ?? 00.0135 10.0860 20.2616 …… 60.9740 70.9952 80.9995 91.0000 00.0404 10.1960 20.4628 …… 50.9747 60.9957 70.9996 81.0000

Test Your Understanding May 2013 Q6 M1 A1 As per tip, use the value in your table AFTER the first to exceed 0.975. ?

One More Example An office finds that over a long time incoming telephone calls from customers occur at a rate of 0.325 per minute. They believe that the number of calls has increased recently. To test this, the number of incoming calls during a random 20-minute interval is recorded. Find the critical region for a two-tailed test of the hypothesis that the number of incoming calls occur at the rate of 0.325 per minute. The probability in both tails should be as close to 2.5% as possible. 00.0015 10.0113 20.0430 …… 110.9661 120.9840 130.9929 140.9970 ? Q

Using Approximating Distributions Bro Tip: Don’t forget your continuity correction! (recall: you make the range 0.5 wider) A shop sells grass mowers at the rate of 10 per week. In an attempt to increase sales, the price was reduced for a six-week period. During this period a total of 75 mowers were sold. Using a 5% level of significance, test whether or not there is evidence that the average number of sales per week has increased during this six-week period. Q1 ?

Identifying Critical Regions During an influenza epidemic, 4% of the population of a large city was affected on a given day. The manager of a factory that employs 100 people found that 12 of his employees were absent, claiming to have influenza. Using a 5% level of significance, find the critical region that would enable the manage to test whether there is evidence that percentage of people having influenza at his factory was greater than that of the city, and state your conclusion. Q2 70.9489 80.9786 90.9919 ?

Test Your Understanding May 2013 (R) Q6 ? ? ?

Exercise 7C Q10 Q1 Q3 Q5 Q7 Q13 Q14 If you’re done, continue onto mixed exercises (7D). ? ? ? ? ? ? ?

Download ppt "S2 Chapter 7: Hypothesis Testing Dr J Frost Last modified: 3 rd October 2014."

Similar presentations