Vous êtes sur la page 1sur 53

Statistics

CVEN2002/2702

Week 10

This lecture
7. Inferences concerning a mean
7.11 Hypothesis tests for a proportion
9. Inferences concerning a difference of means
9.2 Two independent populations
9.3 Paired observations
8. Inferences concerning a variance
8.2 Estimation of a variance
8.3 Confidence interval for a variance
8.4 Hypothesis tests for a variance
Additional reading: Sections 7.3, 7.5 and 8.2 (pp.359-367)
in the textbook

CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

2 / 53

7. Inferences concerning a mean

7.11 Hypothesis tests for a proportion

Revision
In Section 7.8 (Week 8), we explained that, when a
proportion/probability is the population parameter of interest, it can
naturally be estimated from the sample by the sample proportion
n

X
=1
Xi
P
n
i=1

where Xi = 1 if the ith individual of the sample has the characteristic,


and Xi = 0 if not
obeys the Central Limit Theorem and we have
As a sample mean, P


P
a
np
N (0, 1)
(1 )

(for n large)

This allowed us to derive a large-sample confidence interval for :


"
#
r
r
(1 p
)
(1 p
)
p
p
z1/2
+ z1/2
p
,p
n
n
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

3 / 53

7. Inferences concerning a mean

7.11 Hypothesis tests for a proportion

Hypothesis tests for a proportion


From

np


P
(1 )

N (0, 1)

it is also straightforward to derive testing procedures for hypotheses


about the proportion , similar to the test procedures for
We will consider testing
H0 : = 0

against

Ha : 6= 0

Application of previous results (Slide 39, Week 9) implies that the


decision rule at (approximate) significance level is
"
#
r
r
0 (1 0 )
0 (1 0 )

reject H0 if p
/ 0 z1/2
, 0 + z1/2
n
n

CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

4 / 53

7. Inferences concerning a mean

7.11 Hypothesis tests for a proportion

Hypothesis tests for a proportion


Note: as = P(reject H0 when it is true) (Slide 10, Week 9), we take
= 0 everywhere in the derivation of the decision
q rule, so that the
standard error of the estimation here appears as

0 (10 )
n

The (approximate) p-value for this test is also calculated exactly as in


the previous chapter (Slide 39, Week 9), that is,
p = 2 (1 (|z0 |)),
where z0 is the observed value of the test statistic when = 0 :
z0 =

0
p
np
0 (1 0 )

This test is called a large sample test for a proportion

CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

5 / 53

7. Inferences concerning a mean

7.11 Hypothesis tests for a proportion

Hypothesis tests for a proportion


For the one-sided test for H0 : = 0 against
Ha : > 0

or

Ha : < 0 ,

the decision rules


r
> 0 + z1
reject H0 if p
or

0 (1 0 )
n

0 (1 0 )
n
will have approximate significance level
< 0 z1
reject H0 if p

The associated approximate p-values will be


p = 1 (z0 )

or

p = (z0 )

(one-sided large-sample tests for a proportion)


CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

6 / 53

7. Inferences concerning a mean

7.11 Hypothesis tests for a proportion

Hypothesis tests for a proportion: example


Example
Transceivers provide wireless communication among electronic components
of consumer products. Responding to a need for a fast, low-cost test of
Bluetooth-capable transceivers, engineers developed a product test at the
wafer level. In one set of trials with 60 devices selected from different wafer
lots, 48 devices passed. Denote the population proportion of transceivers
that would pass. Test the null hypothesis = 0.70 against > 0.70 at the
0.05 significance level.
This is a one-sided hypothesis test for :
H0 : = 0.70

against Ha : > 0.70

The estimate of is
=
p

48
= 0.80
60

The decision rule is


r
> 0.70 + 1.645
reject H0 if p
CVEN2002/2702 (Statistics)

0.70 (1 0.70)
= 0.7973
60

Dr Justin Wishart

Session 2, 2012 - Week 10

7 / 53

7. Inferences concerning a mean

7.11 Hypothesis tests for a proportion

Hypothesis tests for a proportion: example


; reject H0 !
(at significance level = 0.05, there is enough evidence to conclude
that the proportion of good transceivers that would be produced is
greater than 0.70)
The observed value of the test statistics is
z0 =

0.80 0.70
60 p
= 1.69
0.70 (1 0.70)

and the associated p-value is


table

p = 1 (1.69) = 0.0455
; at level = 0.05, we do reject H0
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

8 / 53

9. Inferences concerning a difference of means

9. Inferences concerning a
difference of means

CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

9 / 53

9. Inferences concerning a difference of means

9.1 Introduction

Inferences concerning a difference of means


Advances occur in engineering when new ideas lead to better equipment,
new materials, or revision of existing production processes
Any new procedure or device must be compared with the existing one and
the amount of improvement assessed
Furthermore, in many situations it is quite common to be interested in
comparing two populations in regard to a parameter of interest
The two populations may be:
produced items using an existing and a new technique
success rates in two groups of individuals
health test results for patients who received a drug and for patients who
received a placebo
...
As usual, we are unfortunately not able to observe both populations
; we need statistical inference methods to make comparisons between
two different populations, having only observed two samples from them
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

10 / 53

9. Inferences concerning a difference of means

9.1 Introduction

Inferences concerning a difference of means


For instance, suppose that the paint manufacturer of the new
fast-drying paint would like to reduce further the drying time of the
paint
Two formulations of the paint are tested: formulation 1 is the standard
chemistry, while formulation 2 has a new drying ingredient that should
reduce the drying time
From experience, it is known that the standard deviation of drying time
is 1.3 minutes, and this should be unaffected by the addition of the new
ingredient
Ten specimens are painted with formulation 1 and another 10 are
painted with formulation 2, in random order
The two sample average drying times are x1 = 20.17 min and
x2 = 18.67 min, respectively
What conclusions can the manufacturer draw about the effectiveness
of the new ingredient ?
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

11 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Hypothesis test for the difference in means


The general situation is as follows:
Population 1 has mean 1 and standard deviation 1
Population 2 has mean 2 and standard deviation 2
Inferences will be based on two random samples of sizes n1 and n2 :
X11 , X12 , . . . , X1n1 is a sample from population 1
X21 , X22 , . . . , X2n2 is a sample from population 2
We will first assume that the samples are independent (i.e.,
observations in sample 1 are by no means linked to the observations
in sample 2, they concern different individuals)
What we would like to know is whether 1 = 2 or not
; hypothesis test
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

12 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Hypothesis test for 1 = 2


We can formalise this by stating the null hypothesis as:
H0 : 1 = 2
Then, the hypothesis test idea can be understood as it was done in the
one-sample case: we observe two samples for which we compute the
sample means x1 and x2
As x1 is supposed to be a good estimate of 1 and x2 is supposed to
be a good estimate of 2 :
if x1 ' x2 , then H0 is probably acceptable
if x1 is considerably different to x2 , that is evidence that H0 is not
true and we are tempted to reject it
Note that the alternative hypothesis can be
H1 : 1 6= 2
or

H1 : 1 > 2

CVEN2002/2702 (Statistics)

or

(two-sided alternative)
H1 : 1 < 2
Dr Justin Wishart

(one-sided alternatives)
Session 2, 2012 - Week 10

13 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Hypothesis test for 1 = 2


We know (Slide 41 Week 6, or Central Limit Theorem Week 8) that




n1
n2
1 X
1 X
1
2
(a)
(a)

X1 =
and X2 =
X1i N 1 ,
X2i N 2 ,
n1
n1
n2
n2
i=1

i=1

(a)

( means that these are exact results for any n1 , n2 if the populations are
normal, approximate results for large n1 , n2 if they are not)
We also know (Slide 20 Week 6) that if X
(2 , 2 )
1 ) and X2 N
1 N (1 , q
are independent, then aX1 + bX2 N a1 + b2 , a2 12 + b2 22
1 X
2 :
; we deduce the sampling distribution of X

q 2
(a)

X1 X2 N 1 2 , n11 +

22
n2

Now, as testing for H0 : 1 = 2 exactly amounts to testing for


H0 : 1 2 = 0, the one-sample procedure we introduced in Chapter 7 can
1 X
2 as an estimator for 1 2
be used up to some light adaptation, with X
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

14 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Hypothesis test for 1 = 2


Suppose that 1 and 2 are known, and that we have observed two
samples x11 , x12 , . . . , x1n1 and x21 , x22 , . . . , x2n2 whose respective
means are
n1
n2
1 X
1 X

x1i and x2 =
x2i
x1 =
n1
n2
i=1

i=1

For the two-sided test (with H1 : 1 2 6= 0), at significance level ,


the decision rule is

s
s
2
2
2
2
1

reject H0 if x1 x2
/ z1/2
+ 2 , z1/2
+ 2
n1
n2
n1
n2
(interval obviously centred at 0 by H0 )
The associated p-value is given by p = 2 (1 (|z0 |))
x1 x2
where z0 is the z-score of x1 x2 if 1 2 = 0, i.e. z0 = q 2
1
22
+
n1
n2
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

15 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Hypothesis test for 1 = 2


Similarly, for the one-sided test with alternative H1 : 1 > 2 , the
decision rule is
s
12 22
+
reject H0 if x1 x2 > z1
n1
n2
and the associated p-value is
p = 1 (z0 ),
while for the one-sided test with alternative H1 : 1 < 2 , the decision
rule is
s
12 22
reject H0 if x1 x2 < z1
+
n1
n2
and the associated p-value is
p = (z0 )
Remark: these decision rules will lead to tests of approximate level
if the populations are not normal but n1 and n2 are large enough
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

16 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Hypothesis test for 1 = 2 : example


In our running example, define 1 the true average drying time for the
formulation 1 paint, and 2 the true average drying time for the formulation 2
paint (with the new ingredient)
We have observed two samples of sizes n1 = n2 = 10 from both populations
with known standard deviations 1 = 2 = 1.3, with sample means
x1 = 20.17 and x2 = 18.67. Assume that both populations are normal
At level = 0.05, for the alternative H1 : 1 > 2 , the decision rule is
r
1.32
1.32
+
= 0.956
reject H0 if x1 x2 > 1.645
10
10
; here, we have observed x1 x2 = 1.5 > 0.956, so we reject H0
Furthermore, z0 =

1.5
q

1.32
10

+ 1.3
10

= 2.58, so that the p-value is


table

p = 1 (2.58) = 0.0049
; adding the new ingredient significantly reduces the drying time
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

17 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Confidence interval for 1 2


As we observed (Slides 43-44 Week 9), there is a strong relationship
between hypothesis tests and confidence intervals
; we can directly derive a confidence interval for 1 2


q 2
(a)
1
22

We note that X1 X2 N 1 2 , n1 + n2 , so

(X1 X2 ) (1 2 )
q 2
1 = P z1/2
z1/2
1
22
+
n1
n2

s
2
2

1
1 X
2 ) z1/2
= P 1 2 (X
+ 2
n1
n2

; from two observed samples, we have that a 100 (1 )%


two-sided
confidences
interval for 1 2 is

s
2
2
2
2
1

(x1 x2 ) z1/2
+ 2 , (x1 x2 ) + z1/2
+ 2
n1
n2
n1
n2
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

18 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Confidence interval for 1 2


Similarly,
100 (1 )% one-sided 
confidence intervals for 1 2

q 2
22
1
are , (x1 x2 ) + z1 n1 + n2 and


q 2
1
22
(x1 x2 ) z1 n1 + n2 , +
In our running example, for instance, we have that a 95% one-sided
confidence interval for 1 2 is
r
1.32 1.32
[1.5 1.645
+
, +) = [0.544, +)
10
10
; we can be 95% confident that the gain in drying time is at least
0.544 minutes
A two-sided 95% confidence interval for 1 2 would be
"
#
r
r
1.32 1.32
1.32 1.32
1.5 1.96
+
, 1.5 + 1.96
+
= [0.47, 2.63]
10
10
10
10
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

19 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Hypothesis test for 1 = 2


A generalisation of the previous procedure is to deal with the unknown
variance case
However, two different situations must be treated:
1

the standard deviations of the two distributions are unknown but


equal: 1 = 2 =

the standard deviations of the two distributions are unknown but


not necessarily equal: 1 6= 2

These situations must be differentiated as we will need to estimate the


unknown variance(s)
; estimating one parameter from all the observations, or estimating
two parameters 1 and 2 each from half of the observations, will
lead to different results

CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

20 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Hypothesis test for 1 = 2 (with 12 = 22 )

Assume for now that 1 = 2 = , but is unknown ; estimate it !


1 )2 is an estimator for 2 in population
Each squared deviation (X1i X
2 )2 is an estimator for 2 in
1, and each squared deviation (X2i X
population 2
; we estimate 2 by pooling the sums of squared deviations from the
respective sample means, thus we estimate 2 by the pooled
variance estimator:
Pn1
2 Pn2 (X2i X
2 )2
(n1 1)S12 + (n2 1)S22
2
i=1 (X1i X1 ) +
i=1
=
Sp =
n1 + n2 2
n1 + n2 2
P 1
1 )2 and S 2 = 1 Pn1 (X2i X
2 )2
where S12 = n111 ni=1
(X1i X
2
i=1
n2 1
Note: the pooled variance estimator has n1 + n2 2 degrees of freedom,
because we have n1 1 independent deviations from the mean in the first
sample, and n2 1 independent deviations from the mean in the second
sample ; altogether, n1 + n2 2 independent deviations to estimate 2
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

21 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Hypothesis test for 1 = 2 (with 12 = 22 )


In the one sample case, we had (Slides 3-4-5, Week 8)

2
n X
N (0, 1) + S =

1
n1

Pn

i=1 (Xi

)2
X

n X S tn1

Similarly, we have now


1 X
2 )(1 2 ) (a)
(X
q

n1 + n1
1

N (0, 1) + Sp2 =

(n1 1)S12 +(n2 1)S22


n1 +n2 2

1 X
2 ) (1 2 ) (a)
(X
q
tn1 +n2 2
Sp n11 + n12

Note: for non-normal populations, in large samples (n1 and n2 large),


we know that tn1 +n2 2 N (0, 1) and that the CLT gives approximate
results anyway ; we can use N (0, 1) (recall Slide 15, Week 8)
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

22 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Hypothesis test for 1 = 2 (with 12 = 22 )


Suppose we have observed two samples x11 , x12 , . . . , x1n1 and
x21 , x22 , . . . , x2n2 whose respective means and standard deviations are
x1 =

n1
1 X
x1i
n1

and

i=1

x2 =

n2
1 X
x2i
n2
i=1

and
v
u
u
s1 = t

1
n1 1

n1
X
(x1i x1 )2

and

i=1

v
u
u
s2 = t

2
1 X
(x2i x2 )2
n2 1

i=1

; the observed pooled sample standard deviation is


s
(n1 1)s12 + (n2 1)s22
sp =
n1 + n2 2
which should be a good estimate of (if 1 = 2 !)
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

23 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Hypothesis test for 1 = 2 (with 12 = 22 )

For the two-sided test (with Ha : 1 2 6= 0), at significance level ,


the decision rule is thus
reject H0 : 1 = 2 if
"

x1 x2
/ tn1 +n2 2;1/2 sp

1
1
+ , tn1 +n2 2;1/2 sp
n1 n2

1
1
+
n1 n2

The associated p-value is given by


p = 2 P(T > |t0 |)

with T tn1 +n2 2 ,

where t0 is the observed value of the test statistic (with 1 2 = 0)


t0 =

x x2
q1
sp n11 + n12

This test is known as the two-sample t-test


CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

24 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Hypothesis test for 1 = 2 (with 12 = 22 )


One-sided versions of this test are also available. For the alternative
Ha : 1 > 2 , the decision rule is
s
1
1
+
reject H0 : 1 = 2 if x1 x2 > tn1 +n2 2;1 sp
n1 n2
and the associated p-value is
p = 1 P(T < t0 ),
whereas for the alternative Ha : 1 < 2 , the decision rule is
s
1
1
reject H0 if x1 x2 < tn1 +n2 2;1 sp
+
n1 n2
and the associated p-value is
p = P(T < t0 )
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

25 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Confidence intervals for 1 2 (with 12 = 22 )

In the same framework, a 100 (1 )% two-sided confidence


interval for 1 2 is
s
"
1
1
+ ,
(x1 x2 ) tn1 +n2 2;1/2 sp
n1 n2
s
#
1
1
(x1 x2 ) + tn1 +n2 2;1/2 sp
+
n1 n2

while two 100 (1 )% one-sided confidence intervals for 1 2 are


s
#
1
1
, (x1 x2 ) + tn1 +n2 2;1 sp
+
n1 n2
and

"
(x1 x2 ) tn1 +n2 2;1 sp
CVEN2002/2702 (Statistics)

Dr Justin Wishart

1
1
+ , +
n1 n2

Session 2, 2012 - Week 10

26 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Confidence intervals for 1 2 (with 12 = 22 )


Example
Two catalysts are being analysed to determine how they affect the mean yield
of a chemical process. Catalyst 1 is currently in use, but catalyst 2 is
acceptable and cheaper so that it could be adopted providing it does not
change the process yield. A test is run, see data below. Is there any
difference between the mean yields? Use = 0.05 and assume equal
variances.
Data: Catalyst 1: n1 = 8,
(89.19, 90.95, 90.46, 93.21, 97.19, 97.04, 91.07, 92.75),
; x1 = 92.733, s1 = 2.98
Catalyst 2: n2 = 8,
(91.50, 94.18, 92.18, 95.39, 91.79, 89.07, 94.72, 89.21),
; x2 = 92.255, s2 = 2.39
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

27 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

The parameters of interest are 1 and 2 , the mean process yields


using catalysts 1 and 2, respectively
We would like to test: H0 : 1 = 2 , against Ha : 1 6= 2
The qq-plots for the two samples do not show strong departure from
normality ; two-sample t-test, assuming 12 = 22 (for s1 ' s2 )
1.5

quantile plot cat2

1.5

quantile plot cat1

1.0

1.0

0.0

0.5

0.0

Theoretical Quantiles

0.5

0.5

0.5

Theoretical Quantiles

89

1.5

1.5

1.0

1.0

90

91

92

93

94

95

90

Sample Quantiles

92

94

96

Sample Quantiles

With the data we have, we easily find the observed pooled standard
deviation
s
s
(n1 1)s12 + (n2 1)s22
7 2.392 + 7 2.982
sp =
=
= 2.70
n1 + n2 2
8+82
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

28 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Now, with n1 + n2 2 = 14 degrees of freedom, the quantile of level


0.975 of the Students t distribution is t14;0.975 = 2.145 (table)
; the rejection criterion is thus
reject H0 : 1 = 2 if
"

x1 x2
/ 2.145 2.70

1 1
+ , 2.145 2.70
8 8

1 1
+
8 8

= [2.895, 2.895]
Here, x1 x2 = 0.478
; do not reject H0 !
Conclusion: at the 0.05 level of significance, we do not have evidence
enough to conclude that catalyst 2 results in a mean yield that differs
from the mean yield when catalyst 1 is used
; cheaper catalyst 2 can be used without (significantly) affecting the
mean process yield
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

29 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

The associated p-value can be found from


t0 =

x x2
0.478
q1
q
=
1
1
sp n1 + n2
2.70 18 +

= 0.35,
1
8

so that
p = 2 P(T > 0.35) = 2 0.365 = 0.73,
for T t14
; not very risky to claim that the yield is significantly affected
A 95% confidence interval can also be derived for 1 2 :
"
#
r
r
1 1
1 1
0.478 2.145 2.70
+ , 0.478 + 2.145 2.70
+
8 8
8 8
= [2.418, 3.374]
Of course, 0 belongs to this interval of plausible values for 1 2
(why?)
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

30 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Hypothesis test for 1 = 2 (when 12 6= 22 )


In some situations, we cannot reasonably assume that the unknown
variances 12 and 22 are equal
; S12 has to be used as an estimator for 12 and S22 has to be used as
an estimator for 22
There is no exact result available for testing H0 : 1 = 2 in this case
However, an approximate result can be applied:
1 X
) (1 2 ) a
(X
q2 2
t
S1
S22
+
n1
n2
where the number of degrees of freedom is
=

(s12 /n1 + s22 /n2 )2


(s12 /n1 )2
n1 1

(s22 /n2 )2
n2 1

(rounded down to the nearest integer)


CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

31 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Hypothesis test for 1 = 2 (when 12 6= 22 )


From there, the hypotheses/confidence intervals on the difference
in
q
s2

means of two populations are tested/derived as usual, with n11 +


as estimated standard error, and this value of for the number of
degrees of freedom of the t-distribution

s22
n2

; this is called Satterthwaites approximate two-sample t-test


Remark 1: Again, if the sample sizes are large (usually both n1 > 40
and n2 > 40), the test statistic has approximate standard normal
distribution, and the rejection criterion and p-value can be computed
by reference of the N (0, 1)-distribution (no real need for computing
then)
Remark 2: the hypothesis of equality of variances 12 = 22 can be
formally tested. The hypotheses would be
H0 : 12 = 22

against

Ha : 12 6= 22

This test is beyond the scope of this course


CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

32 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Hypothesis test for 1 = 2 (when 12 6= 22 ): example


Example
The void volume within a textile fabric affects comfort, flammability, and
insulation properties. Permeability of a fabric refers to the accessibility of void
space to the flow of a gas or liquid. We have summary information on air
permeability (in cm3 /cm2 /sec) for two different types of plain weave fabric
(see below). Assuming the permeability distributions for both types of fabric
are normal, calculate a 95% confidence interval for the difference between
true average permeability for the cotton fabric and that for the acetate fabric.

Fabric type Sample size


Cotton
10
Acetate
10

Sample mean
51.71
136.14

Sample standard deviation


0.79
3.59

Here we have s1 = 0.79  s2 = 3.59, so it would not be wise to assume


12 = 22 !
; Satterthwaites approximate two-sample t-test
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

33 / 53

9. Inferences concerning a difference of means

9.2 Independent samples

Hypothesis test for 1 = 2 (when 12 6= 22 ): example


First the right number of degrees of freedom must be determined:
=

(0.792 /10 + 3.592 /10)2


(0.792 /10)2
9

(3.592 /10)2
9

= 9.87

; use = 9 degrees of freedom

From the table, we can find t9;0.975 = 2.262, so a 95% confidence interval is

"
s
#
r
2
2
s
s
3.592
0.792
1
2
x1 x2 t;1/2
= 51.71 136.14 2.262
+
+
n1
n2
10
10
= [87.06, 81.80]
; we can be 95% confident that the true average permeability for acetate
fabric exceeds that for cotton by between 81.80 and 87.06 cm3 /cm2 /sec

CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

34 / 53

9. Inferences concerning a difference of means

9.3 Paired observations

Paired observations
In the application of the two-sample t-test we need to be certain the
two populations (and thus the two random samples) are independent
; this test cannot be used when we deal with before and after data,
the ages of husbands and wives, and numerous situations where
the data are naturally paired (and thus, not independent!)
Let (X11 , X21 ), (X12 , X22 ), . . . , (Xn1 , Xn2 ) be a random sample of n pairs
of observations drawn from two subpopulations X1 and X2 , with
respective means 1 and 2
Because Xi1 and Xi2 share some common information, they are
certainly not independent, but they can be represented as
Xi1 = Wi + Yi1 ,

Xi2 = Wi + Yi2 ,

where Wi is the common random variable representing the ith pair,


and Yi1 , Yi2 are the particular independent contributions of the first and
second observation of the pair
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

35 / 53

9. Inferences concerning a difference of means

9.3 Paired observations

Paired observations
An easy way to get rid of the dependence implied by Wi is just to
consider the differences
Di = Xi1 Xi2 = (Wi + Yi1 ) (Wi + Yi2 ) = Yi1 Yi2
; we have just a sample of independent observations D1 , D2 , . . . , Dn ,
one for each pair, drawn from a distribution with mean
D = 1 2
; testing for H0 : 1 = 2 is exactly equivalent to testing for
H 0 : D = 0
This can be accomplished by performing the usual one-sample t-test
(Slides 33-34, Week 9) (or a large-sample test, Slides 39-40 Week 9)
on D , from the observed sample of differences
Note: the test will be performed on the sample of differences only
; check if the population of differences is normal or not (the initial
distributions of X1 and X2 do no matter)
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

36 / 53

9. Inferences concerning a difference of means

9.3 Paired observations

Paired observations: example


Example
Below are the average weekly losses of worker-hours due to accidents in 10
industrial plants before and after a certain safety program was put into
operation. Use a hypothesis test at significance level = 0.05 to check
whether the safety program is effective
Data:
Plant
Before (sample 1)
After (sample 2)

1
47
36

2
73
60

3
46
44

4
124
119

5
33
35

6
58
51

7
83
77

8
32
29

9
26
26

10
17
11

Define 1 the true mean weekly loss before the safety program was put into
operation, and 2 the true mean weekly loss after the safety program was put
into operation. We would like to test:
H0 : 1 = 2

(no effect of the safety program)

against
Ha : 1 > 2
CVEN2002/2702 (Statistics)

(effectiveness of the safety program)


Dr Justin Wishart

Session 2, 2012 - Week 10

37 / 53

9. Inferences concerning a difference of means

9.3 Paired observations

Paired observations: example


We cannot apply an independent two-sample t-test because the before and
after weekly losses of worker-hours in the same industrial plant are
certainly not independent
(regardless of the safety program, some plants may be prone to frequent
accidents, some others may not be)
; pairing of the observations
; the sample of differences is:
11, 13, 2, 5, 2, 7, 6, 3, 0, 4
with a sample mean d = 4.9 and a sample standard deviation s = 4.6296
We can check that it is plausible that the sample of differences comes from a
normal population (quantile plot)
; one-sample t-test for H0 : D = 0 against Ha : D > 0
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

38 / 53

9. Inferences concerning a difference of means

9.3 Paired observations

Paired observations: example


Here n = 10 and t9;0.95 = 1.833 ; rejection criterion:
4.6296
s
reject H0 if d > tn1;1 = 1.833
= 2.684
n
10
; we reject H0
The p-value is computed from
t0 =

d
5.2
n = 10
= 3.347
s
4.296

; p = P(T > 3.347) for T t9


From the t-distribution table, with 9 degrees of freedom, we find that the
associated p-value is between 0.0025 and 0.005 (M ATLAB says: p = 0.0043)
; clear rejection of H0
; Conclusion: the data shows evidence that the safety program put into
operation is indeed effective
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

39 / 53

8. Inferences concerning a variance

8. Inferences concerning a
variance

CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

40 / 53

8. Inferences concerning a variance

8.1 Introduction

Inferences concerning a variance: introduction

In the previous chapter, we saw how to make inferences about the


population mean , and as a particular case, about a population
proportion
Very similar methods apply to inferences about other population
parameters, like the variance 2
Variances and standard deviations are not only important in their own
right, they must sometimes be estimated before inferences about other
parameters can be made

CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

41 / 53

8. Inferences concerning a variance

8.2 Estimation of a variance

Estimation of a variance
In Chapter 7, there were several instances where we estimated a
population standard deviation by means of a sample standard
deviation (e.g. in the derivation of the t-confidence interval for )
The sample variance of a random sample {X1 , X2 , . . . , Xn } with mean
is given by
X
n
1 X
)2 ,
(Xi X
S2 =
n1
i=1

and is obviously a natural estimator for the population variance 2


We can write
)2 = (Xi + X
)2 = (Xi )2 + ( X
)2 + 2(Xi )( X
),
(Xi X
so that
n
X

)2 =
(Xi X

n
X

i=1

n
X

)2 + 2( X
)
(Xi )2 + n( X

i=1

(Xi )

i=1

)2 2n(X
)2 =
(Xi )2 + n(X

i=1
CVEN2002/2702 (Statistics)

n
X

n
X

)2
(Xi )2 n(X

i=1
Dr Justin Wishart

Session 2, 2012 - Week 10

42 / 53

8. Inferences concerning a variance

8.2 Estimation of a variance

Estimation of a variance
) = E((X
)2 ) =
We know that Var(Xi ) = E((Xi )2 ) = 2 and Var(X
hence
!

n
X
)2
(Xi X

= n 2 n

i=1

2
n ,

2
= (n 1) 2
n

and thus
n
X
1
)2
E(S ) =
E
(Xi X
n1
2

i=1

S2

!
=

(n 1) 2
= 2
n1

is an unbiased estimator of 2 (and consistent (not shown))

Note: this makes it clear why the divisor in S 2 must be n 1, not n. If


we divided by n, the resulting estimator would be biased!
Looking at the maths, it can be understood that we actually lose one

degree of freedom because we have to estimate the unknown by X


in the expression
Fact: We lose one degree of freedom for each estimated parameter
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

43 / 53

8. Inferences concerning a variance

8.2 Estimation of a variance

Sampling distribution in a normal population


Since S 2 cannot be negative, we should suspect that the sampling
distribution of the sample variance is not normal
Actually, in general, little can be said about this sampling distribution
However, when the population is normal, the sampling distribution of
S 2 can be derived and turns out to be related to the so-called
chi-square distribution
If X1 , X2 , . . . , Xn is a random sample from a normal population with
mean and variance 2 , then
(n 1)S 2
2n1
2
; 2n1 denotes the chi-square distribution with n 1 degrees of
freedom
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

44 / 53

8. Inferences concerning a variance

8.2 Estimation of a variance

The 2 -distribution
A random variable, say X , is said to follow the chi-square-distribution
with degrees of freedom, i.e.
X 2
if its probability density function is given by
f (x) =

1
2/2

 x /21 ex/2

for x > 0

; SX = [0, +)

for some integer


Note: the Gamma function is given by
Z +
(y ) =
x y 1 ex dx,

for y > 0

It can be shown that (y ) = (y 1) (y 1), so that, if y is a positive


integer n,
(n) = (n 1)!
There is usually no simple expression for the 2 -cdf
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

45 / 53

8. Inferences concerning a variance

8.2 Estimation of a variance

The 2 -distribution

1.0

0.5

Some 2 -distributions, with = 2, = 5 and = 10

0.2

0.1

0.4

0.2

f(x)

F(x)

0.6

0.3

0.8

0.4

2 d.f.
5 d.f.
10 d.f.

0.0

0.0

2 d.f.
5 d.f.
10 d.f.

10

15

20

25

10

15

20

25

pdf f (x) = F 0 (x)

cdf F (x)
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

46 / 53

8. Inferences concerning a variance

8.2 Estimation of a variance

The 2 -distribution
It can be shown that the mean and the variance of the 2 -distribution
are
E(X ) =
and
Var(X ) = 2
Note that a 2 -distributed random variable is nonnegative, as
expected, and the distribution is skewed to the right
However, as increases, the distribution becomes more and more
symmetric
In fact, it can be shown that the standardised 2 - distribution with
degrees of freedom approaches the standard normal distribution as

CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

47 / 53

8. Inferences concerning a variance

8.2 Estimation of a variance

The 2 -distribution: quantiles


Similarly to what we did for other distributions, we can define the
quantiles of any 2 -distribution:
2distribution

Let 2; be the value such that


P(X > 2; ) = 1
f(x)

for X 2
Careful! unlike the standard normal
distribution (or the t-distribution),
the 2 -distribution is not symmetric

1
2,
x

For any , the main quantiles of interest may be found in the


2 -distribution critical values tables
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

48 / 53

8. Inferences concerning a variance

8.3 Confidence interval for a variance

Confidence interval for the population variance


(normal population)
As we know that

(n 1)S 2
2n1 ,
2


we can write P 2n1;/2
be rearranged as
P

(n1)S 2
2


2n1;1/2 = 1 , which can

(n 1)S 2
(n 1)S 2
2 2
2
n1;1/2
n1;/2

!
= 1 ,

; if s is the observed sample variance in a random sample of size n


drawn from a normal population, then a two-sided 100 (1 )%
confidence interval for 2 is
#
"
(n 1)s2 (n 1)s2
,
2n1;1/2 2n1;/2
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

49 / 53

8. Inferences concerning a variance

8.4 Hypotheses test for a variance

Hypothesis test for the population variance (normal


population)
2

2n1 is also the basis of


Of course, the sampling distribution (n1)S
2
test procedures for hypotheses about the population variance
For instance, consider testing H0 : 2 = 02 against Ha : 2 6= 02
As S 2 is supposed to be close to 2 , we will reject H0 whenever the
observed s2 will be too distant from 02 :
at significance level , we are after two constants ` and u such that
2

= P(S
/ [`, u] when =

; `=

02 )

2n1;/2 02
n1


=P



(n 1)S 2
(n 1)` (n 1)u

/
,
02
02
02

and

u=

2n1;1/2 02
n1

; the decision rule is:


2n1;/2 02 2n1;1/2 02
reject H0 if s
/
,
n1
n1
"

CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

50 / 53

8. Inferences concerning a variance

8.4 Hypotheses test for a variance

Hypothesis test for the population variance: example


Example
The lapping process which is used to grind certain silicon wafers to the
proper thickness is acceptable only if , the population standard deviation of
the thickness of dice cut from the wafers, is at most 0.50 mm. On a given day,
15 dice cut from such wafers were observed and their thickness showed a
sample standard deviation of 0.64 mm. Use the 0.05 level of significance to
test the hypothesis that = 0.50 on that day
We are only interested in Ha : 2 > 0.502 = 0.25, thus we need a one-sided
test. Similarly to what we did for the two-sided case, we will here reject H0 if
the observed s2 is much larger than 0.25, with rejection criterion being
reject H0 if s2 >

2n1;1 02
n1

Here, n = 15, and we can find on the table that 214;0.95 = 23.68, so the rule is
reject H0 if s2 >
CVEN2002/2702 (Statistics)

23.68 0.25
= 0.4229
14

Dr Justin Wishart

Session 2, 2012 - Week 10

51 / 53

8. Inferences concerning a variance

8.4 Hypotheses test for a variance

Hypothesis test for the population variance: example


The value we have observed is s2 = 0.642 = 0.4096
; do not reject H0
Even if s = 0.64 > 0.50, this is not enough evidence to conclude that
the lapping process was unsatisfactory on that day
We can compute the p-value of the test:
The observed value of the test statistic under H0 is
14 0.4096
(n 1)s2
=
= 22.94
2
0.25
0
; from the table, we can conclude that p = P(X > 22.94) (where
X 214 ) is between 0.05 and 0.10 (> 0.05)
(M ATLAB says: p = 0.061)
(confirmation that we do not reject H0 at level 5%)
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

52 / 53

Objectives

Objectives
Now you should be able to:
test hypotheses on a population proportion
test hypotheses and construct confidence intervals on the
variance of a normal population
structure comparative experiments involving two samples as
hypothesis tests
test hypotheses and construct confidence intervals on the
difference in means of two independent populations
test hypotheses and construct confidence intervals on the
difference in means of two paired (sub)populations
Recommended exercises: ; Q25(a-b) p.311, Q31 p.312, Q47, Q49
p.326, Q51(b), Q53 p.327, Q75 p.341, Q25, Q27 p.368, Q29, Q31
p.369, Q35, Q37 p.370
CVEN2002/2702 (Statistics)

Dr Justin Wishart

Session 2, 2012 - Week 10

53 / 53

Vous aimerez peut-être aussi