S2 Chapter 7: Hypothesis Testing
www.dilanmaths.com
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.
🖉 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:
* 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
| |
0 | 0.0039 |
1 | 0.0352 |
2 | 0.1445 |
3 | 0.3633 |
4 | 0.6367 |
5 | 0.8555 |
6 | 0.9648 |
7 | 0.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).
?
| |
0 | 0.0039 |
1 | 0.0352 |
2 | 0.1445 |
3 | 0.3633 |
4 | 0.6367 |
5 | 0.8555 |
6 | 0.9648 |
7 | 0.9961 |
We’ll explore more fully critical values and regions later on…
?
Quickfire Critical Regions
| |
0 | 0.0312 |
1 | 0.1875 |
2 | 0.5000 |
3 | 0.8125 |
4 | 0.9688 |
Coin thrown 5 times. Trying to establish if biased towards heads.
| |
0 | 0.0010 |
1 | 0.0107 |
2 | 0.0547 |
… | … |
7 | 0.9453 |
8 | 0.9893 |
9 | 0.9990 |
Coin thrown 10 times. Trying to establish if biased towards heads.
| |
0 | 0.0010 |
1 | 0.0107 |
2 | 0.0547 |
… | … |
7 | 0.9453 |
8 | 0.9893 |
9 | 0.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:
?
?
?
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:
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
| |
0 | 0.0039 |
1 | 0.0352 |
2 | 0.1445 |
3 | 0.3633 |
4 | 0.6367 |
5 | 0.8555 |
6 | 0.9648 |
7 | 0.9961 |
?
Quickfire Critical Regions
| |
0 | 0.0312 |
1 | 0.1875 |
2 | 0.5000 |
3 | 0.8125 |
4 | 0.9688 |
Coin thrown 5 times. Trying to establish if biased towards heads.
| |
0 | 0.0010 |
1 | 0.0107 |
2 | 0.0547 |
… | … |
7 | 0.9453 |
8 | 0.9893 |
9 | 0.9990 |
Coin thrown 10 times. Trying to establish if biased towards heads.
| |
0 | 0.0010 |
1 | 0.0107 |
2 | 0.0547 |
… | … |
7 | 0.9453 |
8 | 0.9893 |
9 | 0.9990 |
Coin thrown 10 times. Trying to establish if biased towards tails.
?
?
?
0.252
0.02
Actual Level of Significance
0.015
0.013
0.3
0.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:
?
?
| |
0 | 0.0135 |
1 | 0.0860 |
2 | 0.2616 |
… | … |
6 | 0.9740 |
7 | 0.9952 |
8 | 0.9995 |
9 | 1.0000 |
| |
0 | 0.0404 |
1 | 0.1960 |
2 | 0.4628 |
… | … |
5 | 0.9747 |
6 | 0.9957 |
7 | 0.9996 |
8 | 1.0000 |
Test Your Understanding
May 2013 Q6
M1
A1
A1
A1 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 changed 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.
| |
0 | 0.0015 |
1 | 0.0113 |
2 | 0.0430 |
… | … |
11 | 0.9661 |
12 | 0.9840 |
13 | 0.9929 |
14 | 0.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
| |
7 | 0.9489 |
8 | 0.9786 |
9 | 0.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).
?
?
?
?
?
?
?