RESM6004
Tutorial 1: Hypothesis Testing
Solutions
Question 1 (a)
• Independent samples test
– We have two independent samples, one for
2009 and one for 2010.
2
Question 1 (b)
• Null Hypothesis
– The proportion of adults in the UK satisfied
with the Government as a whole is unchanged
between November 2009 and October 2010.
• Alternative Hypothesis
– The proportion of adults in the UK satisfied
with the Government as a whole has changed
between November 2009 and October 2010.
• H0 : Π 1 = Π 2 vs HA : Π 1 ≠ Π 2
3
Question 1 ( c)
Test of difference between two proportions
(Lecture 6)
4
• 2009: n1 = 1006, p1 = 252/1006 = 0.2505.
• 2010: n2 = 1009, p2 = 424/1009 = 0.4202.
• Pooled sample proportion is
p = (n1p1 + n2p2) / (n1 + n2) =
(1006(252/1006)+ 1009(424/1009)) / (1006 + 1009)
= 676/2015 = 0.3355.
5
• So, test statistic is:
0.2505 0.4202
z
0.3355(1 0.3355) 0.3355(1 0.3355)
1006 1009
0.1697 Very
= -8.081
0.0210 ‘large’
• Test statistic lies outside -1.96 and +1.96, therefore we
reject H0 at 5% level.
• Also lies well outside -2.575 and + 2.575 [or p-value =
0.000 which is less than 0.01] so reject H0 also at the
1% level. 6
• Conclude there is a significant difference
between 2009 and 2010 in the proportion of
adults in the UK satisfied with the Government
as a whole (1% significance level).
7
Question 2 (a)
• Looking down each column we can see that the distribution
across cholesterol levels looks different by smoking status.
• Could also look at row totals. (shown are column totals)
• Particular difference between never smokers and ex smokers
For example: 11.1% of ex-smokers have high cholesterol levels
(7.8 and over), whereas it is for never smokers 7.9%;
Amongst the group with low levels of cholesterol (less than 5.2)
(i.e. now using row totals) we find 52% (=635/1220) to have
never smoked but only 17% (=209/1220) to be ex-smokers.
Indication that never smokers have lower cholesterol levels
than ex-smokers.
8
Question 2 (a)
• Note:
With observational data like this we need to be careful
with interpretation (association does not imply
causation!)
– People may have given-up smoking for health related
reasons (i.e. other factors also play a role)
9
Question 2 (b)
• A chi-square test (see Lecture 7).
• Null Hypothesis
– In the population, there is no association
between cholesterol levels and smoking status.
• Alternative Hypothesis
– In the population, there is an association
between cholesterol levels and smoking status.
10
Question 2 (c)
• In the sample, overall 30.86% (1220/3953) have
the lowest cholesterol level (less than 5.2).
• If H0 is true, then we would expect
o 30.86% of never smoked in the lowest
cholesterol group:
30.86% of 1846 = 569.7
o OR: (1846 1220) / 3953 = 569.7
(column total row total)/n
11
Question 2 (d)
• With the chi-square test we measure the
distance between the observed and expected
counts to decide whether to reject the null
hypothesis
(O E) 2
– Use X 2 to measure the distance.
cells E
– If the null hypothesis is true then this follows a
chi-square distribution with (4-1) (3-1) = 6
degrees of freedom.
12
• In this case X2 = 56.575.
• Compare test statistic 56.575 with value from chi-
squared tables, 6 degrees of freedom.
• Critical value (1% significance level) is 16.812.
– REJECT the null hypothesis …
– We conclude that there is clear evidence of an
association between smoking status and
cholesterol levels in the population.
13
5% 1%
level level
14
Question 3 (a)
• Two independent samples test because it is a
different sample of children (from the same
population) being used for the before and after
measurements. (Lecture 6)
– N = 120 children in each sample CLT holds
15
Question 3 (b)
• Paired samples test because it is the same
sample of children being used for the before and
after measurements (Lecture 5)
– This is a one sample test on the differences
(technically a t-test, N = 120 children in each
sample CLT holds)
16
Question 3 (c)
• H0: Mean reading score after is the same as
mean score before in the population.
[H0: µ1 = µ2]
HA: Mean reading score after is different to
mean score before in the population.
[HA: µ1 µ2] (2-sided)
• We might have hypothesised an improvement and
had a one-sided alternative.
17
From lecture 6, slide 8
• Test statistic:
x1 x 2
z
2 2
s s
1
2
n1 n2
18
• Sample statistics …
Before After
Mean x1 = 11.01 x 2 = 12.19
Standard s1 = 4.796 s2 = 4.257
deviation
Sample size n1 = 120 n2 = 120
19
• Calculate test statistic for independent samples:
11.01 12.19 Not very
z = -2.016
4.796 2 4.257 2 extreme!
120 120
• This is just outside the range -1.96 to 1.96 so we
can reject the null hypothesis at the 5% level.
– We conclude that there has been a significant
(at the 5% level) change in reading scores.
– However, the difference is not statistically
significant at the 1% level (do not reject H0) 20
Question 3 (d)
• H0: Mean reading score after is the same as
mean score before in the population.
[H0: µ1 = µ2]
HA: Mean reading score after is different to
mean score before in the population.
[HA: µ1 µ2] (2-sided)
• We might have hypothesised an improvement and
had a one-sided alternative.
21
• Sample statistics …
Difference
Mean xd = -1.183
Standard sd = 0.850
deviation
Sample size n = 120
22
• Calculate test statistic for a paired samples test:
ത 𝐷
𝑑−𝜇 1.183 0 VERY
z= z = -15.167
SE𝐷 0.078 extreme!
• This is well outside the range -2.575 to 2.575 so
we can reject the null hypothesis at the 1% level.
– We conclude that there has been a significant
(at the 1% level) change in reading scores.
23
Question 3 (e)
• When we have independent samples there is
considerable variation in the difference in the
sample means just due to having a different sample
of students from the population for each mean.
• With a paired test this variation goes away
because we use the same students for both
measurements.
– Using the same units is a powerful way to
measure change.
24
• With this experiment we can see a change BUT that
might have happened anyway.
– The reading ability of students is likely to
change over time whether we introduce a new
method or not.
• It would be useful to have a control group (one
with no change in teaching) to compare with the
treatment group.
– How would you do this?
25
• A simple approach would take our 1,000 students
and randomly allocate them to two groups of 500.
– Treatment group gets orthographic rules.
– Control group does not.
• Test 60 students before and after in each group to
get two paired samples (assuming we can still
only test 120 students).
– Carry out an independent-samples test to
compare the mean difference between the two
groups.
26
• In fact we have the data, sample statistics …
Treatment Control
Mean x1 = -1.183 x 2 = -0.327
Standard s1 = 0.850 s2 = 0.792
deviation
Sample size n1 = 60 n2 = 60
27
• Calculate test statistic for two independent
samples:
1.183 (0.327) Very
z = -5.707
2 2 extreme!
0.850 0.792
60 60
• We reject the null hypothesis at the 1% level.
– We accept there is significant (at the 1% level)
difference between the two groups.
28