S1 Chp7 HypothesisTesting
S1 Chp7 HypothesisTesting
S1 Chp7 HypothesisTesting
Testing
Mrs Barton
Our intuition is that the further away we are from the ‘expected’
number of heads (i.e. 5 heads out of 10), the more unlikely it is.
𝑝 ( 𝑥) likely
a t e l y
ti ll m oder ce’.
ads s c ha n
8 He pp e n ‘by
to h a
appen
l y to h e’.
ike c
Unl y chan
‘b
0 1 2 3 4 5 6 7 8 9 10
Number of heads ()
What is Hypothesis Testing?
I throw a coin 10 times. For what numbers of heads might
you conclude that the coin is biased towards heads? Why?
! A hypothesis is a statement made about the value of a In this context…
population parameter that we wish to test by collecting
evidence in the form of a sample. We’re asking “is the coin biased”.
This is making a statement about
The null hypothesis, is the default position, i.e. that
nothing has changed, unless proven otherwise.
?
the probability of getting Heads
(i.e. the in )
The alternative hypothesis, , is that there has been
some change in the population parameter. The ‘default position’ is that the
𝑝 ( 𝑥) For this range of outcomes we wouldn’t conclude the ?
coin is fair, i.e. .
coin is biased, i.e. we’d “accept ”
The ‘alternative’ position is that the
?
coin is biased towards heads, i.e. is
more than 0.5.
0 1 2 3 4 5 6 7 8 9 10
Number of heads ()
What is Hypothesis Testing?
I throw a coin 10 times. For what numbers of heads might
you conclude that the coin is biased towards heads? Why?
In this context…
! In a hypothesis test, the evidence from the sample The test statistic is what we
is a test statistic. observed, in this case, is the
number of heads seen in 10 throws.
0 1 2 3 4 5 6 7 8 9 10
Number of heads ()
What is Hypothesis Testing?
I throw a coin 10 times. For what numbers of heads might
you conclude that the coin is biased towards heads? Why?
In this context…
The level of significance is the maximum We said that if we saw a number of
probability where we would reject the null heads within ranges of outcomes
hypothesis. that were sufficiently unlikely, then
This is usually 5% or 1%. we’d rule out that the coin is fair
and conclude it was in fact biased.
𝑝 ( 𝑥) If , we’ve set this region so that
there’s at most a 5% probability
of seeing these number of
?
But how unlikely is ‘sufficiently
unlikely’? If , then we’d find a
region of outcomes where there’s
heads ‘by chance’.
(at most) a 5% chance of one of
these extreme values happening ‘by
chance’ (i.e. if the coin was fair).
0 1 2 3 4 5 6 7 8 9 10
Number of heads ()
What is Hypothesis Testing? !
We said that our two hypotheses are about the population parameter.
Suppose is the probability of a coin landing heads.
Under the null hypothesis , we assume
Null hypothesis: ? that the population parameter is
correct, in this case, that it is a normal
Alternative hypothesis:
? coin and the probability of Heads is 0.5
The latter is known as a ‘one-tailed test’ because we’re saying the coin is biased
one way or the other (i.e. or ).
But we could also have had the hypothesis ‘the coin is biased (either way)’, i.e. .
This is known as a two-tailed test.
Further Example
[Textbook] An election candidate believes she has the support of 40% of the residents in
a particular town. A researcher wants to test, at the 5% significance level, whether the
candidate is over-estimating her support. The researcher asks 20 people whether they
support the candidate or not. 3 people say they do.
a) Write down a suitable test statistic.
b) Write down two suitable hypotheses.
c) Explain the condition under which the null hypothesis would be rejected.
a The number of people who say they For a hypothesis test involving the binomial
?
support the candidate.
distribution, the test statistic is always the count of
successes.
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).
However, there are values which The probability of getting exactly 5 heads is only 22%,
collectively form a range of which is more likely to not happen than to happen. If
‘extreme values’ where it would we saw this number of heads, why would it not be
be unlikely that the coin would sensible to think the coin is biased?
be unbiased. Their combined The probability is only low because there’s lots of
probability is limited by the level possible outcomes. But 5 heads forms part of a range
of significance set (e.g. 5%) ?
of possible number of heads that collectively would
Prob under
0 1 2 3 4 5 6 7 8
Num heads
Critical Regions and Values
John wants to see whether a coin is unbiased or whether it is biased towards coming
down heads. He tosses the coin 8 times and counts the number of times , it lands head
uppermost. What values would lead to John’s hypothesis being rejected, if the
significance level was 5%?
Prob under
do we work out the critical values
now, with 5% significance?
a) Using the 2% level of significance, find the critical region of this test. The probability
in each tail should be as close as possible to 0.01. This means you find the closest to
b) Write down the actual significance level of the test. 0.01 (even if slightly above) rather
than the closest under 0.01
a (Half of 0.02 is 0.01) To ensure all method marks always
show the probability of being in the
critical region (even if you don’t C.D.F. Binomial table:
subsequently need the value!)
? Note that 2 0.0010
can’t go
below 0 or 3 0.0047
exceed 40. 4 0.0160
Critical region is or 5 0.0433
b
? 16 0.9884
17 0.9953
18 0.9983
19 0.9994
? of heads.
is probability (stating its distribution), and
the parameter .
C.D.F. Binomial table:
? conclusion:
1. Do we reject or not? NEW TO A LEVEL 2017: The probability of
2. Put in context of ‘the observed value or more extreme’ is
original problem. known as the -value.
Alternative method using critical regions
We can also find the critical region and see if the test statistic lies within it.
John tosses a coin 8 times and it comes up heads 6 times. He claims the coin is biased towards
heads. With a significance level of 5%, test his claim.
Sheila wants to know if a coin is biased towards heads and throws it a large
number of times, counting the number of heads. The -value is less than 0.03.
Conduct a hypothesis test at the 5% significance level.
is number of patients for whom trial was successful. STEP 1: Define test statistic
is probability of success in?each patient. (stating its distribution), and
the parameter .
You need to know which tail of the distribution you are testing.
If X~ B(n,p) then the expected outcome is np.
If the observed value, x, is < Expected outcome then consider P (X < x)
If the observed value x is > Expected Outcome then consider P( X > x)
A coin is tossed 20 times and lands on Heads 6 times.
Use 2 tailed test with 5% significance to determine whether
coin is biased.
A random variable has distribution X B(50,p). A single observation
of x = 4 is taken from this distribution. Test at the 2% significance
level, : p=0.02 against : p
Two-Tailed Tests
We have already seen that if we’re interest in bias ‘either way’, we have two tails, and therefore
have to split the critical region by halving the significance level at each end.
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.
If true then
?.
therefore insufficient evidence to reject
There is no evidence that proportion of veg meals at Manuel’s Half significance
restaurant is different to Enrico’s. as 2 tailed.
Conclusion and
what it means in
context.
Test Your Understanding
Edexcel S2 Jan 2006 Q7a
?
Exercise 7D
Pearson Applied Year 1/AS
Pages 108-109