Download Slides - Dr Frost Maths

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Degrees of freedom (statistics) wikipedia , lookup

German tank problem wikipedia , lookup

Bootstrapping (statistics) wikipedia , lookup

Taylor's law wikipedia , lookup

Resampling (statistics) wikipedia , lookup

Student's t-test wikipedia , lookup

Transcript
S3: Chapter 3 โ€“ Estimation and
Confidence Intervals
Dr J Frost ([email protected])
www.drfrostmaths.com
Last modified: 30th August 2015
RECAP: Sampling Distributions
What is:
A statistic?
A value based only on the samples (i.e.
? not any population parameters)
Sampling distribution of a statistic ๐‘‡?
The probability distribution of ๐‘ป (i.e. a distribution describing how the statistic can
?
vary as we consider possible samples)
e.g. The distribution of
heights of everyone in the
population.
Population distribution
Generate sample
๐‘‹1
๐‘‹2
๐‘‹3
๐‘‡
๐‘‹4
Each ๐‘‹๐‘– is a distribution representing
the choice of each thing in the sample.
Since each sample is chosen from the
population, each ๐‘‹๐‘– has the same
distribution as the population.
The samples are combined in some way to
form a statistic (e.g. mean, maximum, mode).
As above, this forms a sampling distribution as
we consider possible samples.
RECAP: Sampling Distributions
A large bar contains counters. 60% of the counters have the number 0 on them and 40%
have the number 1.
a. Find the mean ๐œ‡ and variance ๐œŽ 2 for this population of counters.
A simple random sample of size 3 is taken from this population.
b. List all possible samples.
c. Find the sampling distribution for the mean:
๐‘‹1 + ๐‘‹2 + ๐‘‹3
๐‘‹=
3
where ๐‘‹1 , ๐‘‹2 and ๐‘‹3 are the three variables representing counters within the sample.
d. Hence find ๐ธ ๐‘‹ and ๐‘‰๐‘Ž๐‘Ÿ ๐‘‹
e. Find the sampling distribution for the mode ๐‘€.
f. Hence find ๐ธ(๐‘€) and ๐‘‰๐‘Ž๐‘Ÿ ๐‘€
a
๐’™
0
1
๐‘ƒ ๐‘‹=๐‘ฅ
3
5
2
5
?2
๐œ‡=
c
List systematically:
? (0,1,0), etc.
(0,0,0), (1,0,0),
๐‘ฟ
0
๐‘ƒ ๐‘‹=๐‘ฅ
27
125
5
6
๐œŽ =
25
2
b
d
?
1
3
54
125
2
3
36
125
๐ธ ๐‘‹ =
2
5
?2
๐‘‰๐‘Ž๐‘Ÿ ๐‘‹ =
e
1
๐‘ด
0
๐‘ƒ ๐‘€=๐‘š
8
125
25
? 81
125
f
๐ธ ๐‘€ =
1
44
125
44
๐‘‰๐‘Ž๐‘Ÿ ๐‘€ = 0.228
125
?
Estimating Population Parameters
A large bar contains counters. 60% of the counters have the number 0 on them and 40%
have the number 1. A simple random sample of size 3 is taken from this population.
In the example we saw:
Population
Mean ๐œ‡ =
2
5
Variance ๐œŽ 2 =
6
25
Mode ๐‘€ = 0
?
Sample
Average mean across
samples:
2
๐ธ ๐‘‹ =
5
Variance of mean
across samples:
2
๐‘‰๐‘Ž๐‘Ÿ ๐‘‹ =
25
To estimate the mean number of the
population, we sampled 3 counters and
took the mean for them ๐‘‹. โ€˜On averageโ€™,
what do you notice about our estimate
of the mean?
Itโ€™s the same as the population!
?
44
= 0.352
125
๐‘‰๐‘Ž๐‘Ÿ ๐‘€ = 0.228
๐ธ ๐‘€ =
What do you notice about the mode
seen on average across samples?
Itโ€™s different from the population.
?
! Estimator: A statistic
used to estimate a
population (e.g. ๐‘‹ for ๐œ‡).
Estimate: A particular
value of an estimator.
Estimating Population Parameters
A large bar contains counters. 60% of the counters have the number 0 on them and 40%
have the number 1. A simple random sample of size 3 is taken from this population.
In the example we saw:
Population
Mean ๐œ‡ =
2
5
Variance ๐œŽ 2 =
6
25
Mode = 0
Sample
Average mean across
samples:
2
๐ธ ๐‘‹ =
5
Variance of mean
across samples:
2
๐‘‰๐‘Ž๐‘Ÿ ๐‘‹ =
25
44
= 0.352
125
๐‘‰๐‘Ž๐‘Ÿ ๐‘€ = 0.228
๐ธ ๐‘€ =
! If a statistic ๐‘ป is used as an estimator for a population parameter ๐œƒ then the bias is:
๐ธ ๐‘‡ โˆ’๐œƒ
! If ๐ธ ๐‘‡ โˆ’ ๐œƒ = 0, i.e. ๐ธ ๐‘‡ = ๐œƒ, then ๐‘‡ is an unbiased estimator for ๐œƒ
e.g. ๐‘‹ is an unbiased estimator for ๐œ‡
But ๐‘€ was a biased estimator of the true mode.
See Proof >
The variance of the sample mean
A large bar contains counters. 60% of the counters have the number 0 on them and 40%
have the number 1. A simple random sample of size 3 is taken from this population.
Population
2
6
Variance ๐œŽ 2 = 25
Mean ๐œ‡ = 5
Mode ๐‘€ = 0
Sample
Average mean across
samples:
2
๐ธ ๐‘‹ =
5
Variance of mean
across samples:
2
๐‘‰๐‘Ž๐‘Ÿ ๐‘‹ =
25
44
= 0.352
125
๐‘‰๐‘Ž๐‘Ÿ ๐‘€ = 0.228
๐ธ ๐‘€ =
We saw that the sample mean, ๐‘‹, varied as we considered different samples. Can you
spot the relationship between the population variance ๐œŽ 2 , and this variance of the
sample mean?
๐œŽ2
๐‘‰๐‘Ž๐‘Ÿ ๐‘‹ =
๐‘›
?
where ๐‘› is the sample size.
See Proof >
What does this imply as we increase the sample size. Is this expected?
If the sample size is larger, the sample mean varies less. This is
expected as a large sample size makes our sample mean more
accurate.
?
Excel Demo Time!
File Ref: DemoVarianceOfSampleMean.xlsx
Unbiased estimator of ๐œŽ 2
Weโ€™ve seen that we can use ๐ธ ๐‘‹ as an unbiased estimator for the population mean ๐œ‡.
Can the variance of the sample be used as an unbiased estimator for the population?
Consider the heights of students at Tiffin, say with ๐œŽ 2 = 0.4๐‘š
If the sample size was 1, what (on average) would the variance of our sample be? What
does this tell us about our use of the sample variance to represent the population
variance?
Variance of sample is 0. Therefore it must be a biased estimator, because on average
? to the variance of the population.
the variance of the sample (i.e. 0) is not equal
We can modified the formula for variance of a sample to give us an unbiased estimator
for ๐ˆ๐Ÿ :
! ๐‘†2 is an unbiased estimator of ๐œŽ 2 , i.e. ๐ธ ๐‘† 2 = ๐œŽ 2
Variance Type
Population
Variance (๐œŽ 2 )
Sample Variance
(๐‘† 2 )
Definition
1
ฮฃ ๐‘‹โˆ’๐œ‡
๐‘›
?
Simplified (โ€œmsmsmโ€)
2
i.e. average squared distance
from the mean
1
ฮฃ?๐‘‹ โˆ’ ๐œ‡
๐‘›โˆ’1
2
ฮฃ๐‘‹ 2
โˆ’ ๐œ‡2
๐‘› ?
1
2 โˆ’ ๐‘›๐‘‹ 2 )
(ฮฃ๐‘‹
?
๐‘›โˆ’1
See Proof >
Notation for estimators
! ๐œƒ represents an estimator of ๐œƒ
๐œ‡=๐‘‹ ?
๐œŽ2 = ๐‘†2 ?
Examples
๐‘†2 =
The table below summarises the number of
breakdowns, ๐‘ฅ, on a townโ€™s bypass on 30
randomly chosen days.
Calculate unbiased estimates of the mean
and variance of the number of
breakdowns.
Num breakdowns
2
3
4
5
6
7
8
9
Num days
3
5
4
3
5
4
4
2
?
ฮฃ๐‘ฅ = 160
ฮฃ๐‘ฅ 2
= 990?
(note here that weโ€™re taking into account
the frequency here)
160
?
๐œ‡=x=
= 5.33
30
2
990
โˆ’
30
x
๐œŽ 2 = sx2 =
= 4.71
29?
1
(ฮฃ๐‘‹ 2 โˆ’ ๐‘›๐‘‹ 2 )
๐‘›โˆ’1
The random variable ๐‘‹ has a continuous
uniform distribution defined over the range
0, ๐›ผ . A random sample ๐‘‹1 , ๐‘‹2 , โ€ฆ , ๐‘‹๐‘› is
taken.
a) Show that ๐‘‹ is a biased estimate for ๐›ผ
and state the bias.
b) Suggest a suitable unbiased estimator
for ๐›ผ.
Note first that this is a stupid question.
Remember that to calculate bias ๐ธ ๐‘‡ โˆ’ ๐œƒ
๐›ผ
๐œ‡=
2
๐›ผ
๐ธ ๐‘‹ =
๐œ‡
=
? 2
๐›ผ
๐›ผ
Bias = 2 โˆ’ ๐›ผ = โˆ’ 2
Unbiased estimator would be where
๐ธ ๐‘‡ = ๐›ผ as desired. Can be achieved with
๐‘‡ = 2๐‘‹
Exercise 3B
Standard Error
๐‘†2 =
1
(ฮฃ๐‘‹ 2 โˆ’ ๐‘›๐‘‹ 2 )
๐‘›โˆ’1
We previously saw that variance of the sample mean is:
(i.e. how much the mean varies as we consider different samples)
๐œŽ2
๐‘‰๐‘Ž๐‘Ÿ ๐‘‹ =
๐‘›
Naturally we might want to refer to the standard deviation of the sample mean.
This is known as the standard error.
๐œŽ
๐‘ 
Standard error = or (if ๐œŽ not known)
?
๐‘›
๐‘›
b
Example: Recall the table from before:
Num breakdowns
2
3
4
5
6
7
8
9
Num days
3
5
4
3
5
4
4
2
Twenty more days were randomly sampled and this
sample had a mean of 6.0 days and ๐‘  2 = 5.0.
b. Treating the 50 results as a single sample, obtain
further unbiased estimates of the population mean
and variance.
c. Find the standard error of this estimate of the mean.
d. Estimate the size of sample required to achieve a
standard error of less than 0.25.
New sample:
๐‘ฆ = 6.0 โ‡’ ฮฃ๐‘ฆ = 20 × 6 = 120
๐‘ ๐‘ฆ2 = 5.0 โ‡’ ฮฃ๐‘ฆ 2 = 815
So combined sample (๐‘ค):
ฮฃ๐‘ค = 160 + 120 = 280
ฮฃ๐‘ค 2 = 990 + 815 = 1805
Combined estimate of ๐œ‡ is:
280
๐‘ค=
= 5.6
50
and the estimate for ๐œŽ 2 is
1805 โˆ’ 50 × 5.62
2
๐‘ ๐‘ค =
= 4.84
49
๐‘ ๐‘ค
= 0.311
?
c
d
?
< 0.25 โ†’ ๐‘› > 77.38
?
Thus need sample of at least 78.
50
4.86โ€ฆ
๐‘›
Exercise 3C
Central Limit Theorem
Suppose you rolled ๐‘› 10-sided unfair dice, where each throw is ๐‘‹1 , ๐‘‹2 , โ€ฆ, ๐‘‹๐‘› (all with
the same distribution ๐‘‹) and you added up the values (to obtain a distribution across
possible sums, ฮฃ๐‘‹).
See Excel Demo!
Questions based on demo:
As ๐‘› becomes large, what distribution does ฮฃ๐‘‹ seem to approximate?
A Normal Distribution.
?
Does how biased the die is (i.e. ๐‘‹) affect the type of distribution of ๐›ด๐‘‹?
No. It will affect the variance and mean of ๐œฎ๐‘ฟ, but we will always obtain a Normal
?
Distribution for ๐œฎ๐‘ฟ, regardless of the distribution
of each trial ๐‘ฟ.
What can we therefore say about the sampling distribution of the sample mean ๐‘‹?
Since ๐‘ฟ is just ๐šบ๐‘ฟ divided by a constant ๐’,
? it will also have a Normal Distribution.
! The Central Limit Theorem says that if ๐‘‹1 , ๐‘‹2 , โ€ฆ ๐‘‹๐‘› is a
random sample of size ๐‘›, from a population of mean ๐œ‡ and
2
variance ๐œŽ , then ๐‘‹ is approximately ~๐‘
๐œŽ2
๐œ‡,
๐‘›
?
Examples
June 2013 (R)
Bro Note: You might think you could have used ๐‘ฅ =
๐œŽ2
17.2. However, in ๐‘‹~๐‘(๐œ‡, ๐‘› ), we would only resort
to an estimate of ๐œ‡, i.e. ๐‘ฅ, if ๐œ‡ was not known. But ๐œ‡
is known!
?
S3 Textbook Example
A sample of size 9 is taken from a population with distribution ๐‘ 10, 22 . Find the probability that the sample
mean ๐‘‹ is more than 11.
๐Ÿ’
๐‘ฟ~๐‘ต ๐Ÿ๐ŸŽ,
Bro Tip: Although ๐‘‹ here (and
๐Ÿ—
therefore ๐‘‹) is discrete, do not
๐Ÿ๐Ÿ โˆ’ ๐Ÿ๐ŸŽ
use continuity correction unless
๐‘ท ๐‘ฟ > ๐Ÿ๐Ÿ = ๐‘ท ๐’ >
= ๐‘ท ๐’ > ๐Ÿ. ๐Ÿ“ = ๐ŸŽ. ๐ŸŽ๐Ÿ”๐Ÿ”๐Ÿ–
๐Ÿ
asked to find ๐‘ƒ ฮฃ๐‘‹ > 120
๐Ÿ‘
?
S3 Textbook Example
A cubical die is relabelled so that there are three faces marked 1, two faces marked 3 and one marked 6. The die
is rolled 40 times and the mean of the 40 scores is recorded. Find an approximation for the probability that the
mean is over 3.
๐ = ๐‘ฌ ๐‘ฟ = ๐Ÿ. ๐Ÿ“
๐Ÿ๐Ÿ‘
๐‘‹
1
3
6
๐ˆ๐Ÿ = ๐‘ฝ๐’‚๐’“ ๐‘ฟ =
๐Ÿ’
๐‘(๐‘ฅ) 1/2 1/3 1/6
๐Ÿ๐Ÿ‘
๐‘ฟ โ‰ˆ ~๐‘ต ๐Ÿ. ๐Ÿ“,
๐‘ท ๐‘ฟ > ๐Ÿ‘ = ๐‘ท ๐’ > ๐Ÿ. ๐Ÿ•๐Ÿ“ = ๐ŸŽ. ๐ŸŽ๐Ÿ’๐ŸŽ
๐Ÿ๐Ÿ”๐ŸŽ
?
Exercise 3D
Review Questions
What is a statistic?
A value calculated only from the sample (and not population parameters), e.g. mean.
?
What is meant by the sampling distribution of a statistic?
A distribution over possible values of the statistic as we consider different samples.
?
What does ๐‘‹ represent? How conceptually does it differ from ๐‘ฅ?
๐’™ is the sample mean from a specific sample. ๐‘ฟ is a distribution over possible sample
means across all possible samples (i.e. sampling
? distribution of sampling mean).
What things do we know about the original population distribution ๐‘‹? (i.e. the
distribution things in our sample are sampled from)
It could be any distribution. But we refer to the mean as ๐ and variance as ๐ˆ๐Ÿ , which
?
are population parameters.
What do we know about how ๐‘‹ is distributed in general? What extra information do we
have if the sample size is large?
๐‘ฟ has mean ๐ and
๐ˆ๐Ÿ
variance ๐’
?
If ๐’ is large, then ๐‘ฟ approximately has the distribution ๐‘ต
๐ˆ๐Ÿ
๐, ๐’
Review Questions
What is an estimator?
A statistic used to estimate a population parameter, e.g. ๐’™ could be used to estimate ๐.
?
Why is it appropriate to use ๐‘ฅ calculated from a sample as an estimator for ๐œ‡.
Because on average ๐’™ will be equal to ๐, i.e. ๐‘ฌ ๐‘ฟ = ๐. It is an unbiased estimator.
?
Why is it not appropriate to use the variance of the sample as an estimator for ๐œŽ 2 ?
The variance of the sample is lower than the population variance ๐ˆ๐Ÿ (e.g. consider
when sample size is 1). We therefore use โ€˜sample
varianceโ€™ ๐’”๐Ÿ , which is an unbiased
?
estimator of ๐ˆ๐Ÿ .
What is meant by ๐œ‡?
An estimator of ๐.
๐=๐’™
?
Confidence Intervals
We have seen we can use ๐œ‡ = ๐‘ฅ as an (unbiased) estimator for the mean by finding the
mean from the sample, when the true population mean ๐œ‡ is unknown.
Suppose the population variance ๐œŽ 2 is known, and that we want a confidence interval
where we a 95% sure the population mean ๐œ‡ lies within this range.
Q Show that a 95% confidence interval for ๐œ‡, based on a sample of size ๐‘›, is given
by:
๐œŽ
๐‘ฅ ± 1.96 ×
๐‘›
๐‘ฟ approximated by ๐‘ต
๐ˆ๐Ÿ
๐, ๐’
(Note: typo in your textbooks, which says variance is
Standard error (i.e. standard deviation of sample mean) is
๐ˆ
๐’
Looking in reverse-Z table, we can see weโ€™re in top ๐Ÿ. ๐Ÿ“% if ๐’ = ๐Ÿ. ๐Ÿ—๐Ÿ”๐ŸŽ๐ŸŽ
(and by symmetry, in the bottom 2.5% if ๐’ = โˆ’๐Ÿ. ๐Ÿ—๐Ÿ”๐ŸŽ๐ŸŽ)
By definition, these z values tell us the ?
number of standard deviations
above (or below) the mean, i.e.
๐ˆ
๐’™ ± ๐Ÿ. ๐Ÿ—๐Ÿ” ×
๐’
๐œŽ2
๐‘›
)
Confidence Intervals
! The 95% confidence interval for ๐œ‡ is given by:
๐œŽ
๐‘ฅ ± 1.96 ×
๐‘›
The 99% confidence interval is given by:
๐œŽ
๐‘ฅ ± 2.5758 ×
๐‘›
Iโ€™d remember this first one, but
1.96 value can easily be
obtained from tables.
The width of the confidence interval is:
๐œŽ
2×๐‘ง×
๐‘›
What is actually meant by the 95% confidence interval?
The interval in which there is a 95% chance that ๐ lies within.
Think how this is useful in real life: youโ€™re doing a survey to establish the
average BMI (Body Mass Index) of Americans. You take a sample of 30 people
and the mean BMI in your sample is 23.2. Because itโ€™s a small sample you canโ€™t
be certain that the true population mean BMI is exactly that, but you can have
good certainty for example it lies between say 23.0 and 23.4
?
Quickfire Intervals
Calculate the 95% confidence intervals for ๐œ‡:
๐ˆ
๐’
๐’™
Interval for ๐
4
9
10
7.387 to?12.613
4
100
10
9.126 to?10.784
8
25
28.1
24.964 to
? 31.236
June 2013 (R)
We earlier found:
3
๐‘‹~๐‘ ๐‘Ž + 2,
50
๐Ÿ๐Ÿ•. ๐Ÿ โˆ’ ๐Ÿ. ๐Ÿ—๐Ÿ” ×
?
๐Ÿ๐Ÿ•. ๐Ÿ + ๐Ÿ. ๐Ÿ—๐Ÿ” ×
๐Ÿ‘
= ๐Ÿ๐Ÿ”. ๐Ÿ•
๐Ÿ“๐ŸŽ
๐Ÿ‘
= ๐Ÿ๐Ÿ•. ๐Ÿ•
๐Ÿ“๐ŸŽ
๐Ÿ๐Ÿ”. ๐Ÿ• < ๐’‚ + ๐Ÿ < ๐Ÿ๐Ÿ•. ๐Ÿ•
๐Ÿ๐Ÿ’. ๐Ÿ• < ๐’‚ < ๐Ÿ๐Ÿ“. ๐Ÿ•
Exercise 3E
Also to doโ€ฆ
May 2012 Q3
?
?
?
One other thingโ€ฆ setting sample size
โ€ฆ in the exam but not so much in your textbook.
In a class the standard deviation of weights is 3kg but the mean is unknown.
Therefore Bob takes a sample of people in the class and records their mean weight.
Calculate the minimum sample size needed so that there is a 95% that the estimate
of the population mean from the sample lies within 0.8kg of the true mean.
0.8
๐œŽ = 1.96
๐‘›
๐‘› > 54.0225
๐‘› = 55
1.96 ×
?
3
= 0.8
๐‘›
The ages of teachers at Tiffin School has a standard deviation of 8 years. I ask a few
teachers for their age and find the mean from these. How many teachers do I need
to ask such that there is a 99% chance that the estimate of the population mean
age from the sample lies within 1 year of the true mean.
1
๐œŽ = 2.5758
๐‘›
๐‘› > 424.6237 โ€ฆ
๐‘› = 425
2.5758 ×
?
8
=1
๐‘›
Hypothesis Testing
Thereโ€™s nothing really new here! We can carry out a hypothesis test on the mean of a
normal distribution.
Q A certain company sells fruit juice in cartons. The amount of juice in a carton has a
normal distribution with a standard deviation of 3ml.
The company claims that the mean amount of juice per carton, ๐œ‡, is 60ml. A trading
inspector has received complaints that the company is overstating the mean amount
of juice per carton and he wishes to investigate this complaint. The trading inspector
took a random sample of 16 cartons which gave a mean of 59.1ml.
Using a 5% level of significance, and stating your hypothesis clearly, test whether or
not there is evidence to uphold this complaint.
๐ป0 : ๐œ‡ =?60
๐ป1 : ๐œ‡ < ?
60
๐‘ƒ ๐‘‹ โ‰ค 59.1 ?
๐œ‡ = 60 = ๐‘ƒ ๐‘ โ‰ค
59.1 โˆ’ 60
?3
4
= 0.1151 ?
0.115 > 0.05 so the result is not significant and there is insufficient evidence to
?
reject ๐ป0 , that ๐œ‡ = 60
There is insufficient evidence to support?the complaint.
! The test statistic in a test for the population mean ๐œ‡ is ๐‘ =
๐‘‹โˆ’๐œ‡
๐œŽ
๐‘›
Further Example Using Critical Values
As per S2, an alternative way of carrying out hypothesis tests is to find the critical value
and see if our test statistic exceeds/goes below this.
At a certain college new students are weighed when they join the college. The
distribution of weights of students at the college when they enrol has a standard
deviation of 7.5kg and a mean of 70kg. A random sample of 90 students from the
new entry were weighed and their mean weight was 71.6kg. Assuming that the
standard deviation has not changed.
a. Test, at the 5% level, whether there is evidence that the mean of the new entry
is more than 70kg.
b. State the importance of the Central Limit Theorem to your test.
๐Ÿ•๐ŸŽ
a ๐‘ฏ๐ŸŽ : ๐ =?๐Ÿ•๐ŸŽ, ๐‘ฏ๐Ÿ : ๐ > ?
๐ˆ = ๐Ÿ•. ๐Ÿ“
Critical region is top 5%, which from table
? is ๐’ โ‰ฅ ๐Ÿ. ๐Ÿ”๐Ÿ’๐Ÿ’๐Ÿ—
Test statistic:
๐Ÿ•๐Ÿ. ๐Ÿ” โˆ’ ๐Ÿ•๐ŸŽ
๐’›=
= ๐Ÿ. ๐ŸŽ๐Ÿ๐Ÿ‘๐Ÿ—
๐Ÿ•. ๐Ÿ“ ?
๐Ÿ—๐ŸŽ
Value is in critical region so reject ๐‘ฏ๐ŸŽ and conclude evidence that new
?
class have a higher mean weight.
b Central Limit Theorem is used to assume that ๐‘ฟ is normally distributed.
?
Test Your Understanding
June 2011 Q7
?
?
?
?
Test Your Understanding โ€“ Two Tailed Test
Example in textbook
A machine produces bolts of diameter ๐ท where ๐ท has a normal distribution with mean
0.580cm and standard deviation 0.015cm.
The machine is serviced and after the service a random sample of 50 bolts from the
next production run is taken to see if the mean diameter of the bolts has changed from
0.580cm. The distribution of the diameters of bolts after the service is still normal with
a standard deviation of 0.015cm. The mean diameter of the 50 bolts is 0.577cm.
a. Stating your hypothesis clearly test, at the 1% level, whether or not there is
evidence that the mean diameter of the bolts has changed.
b. Find the critical region for ๐‘‹ in the above test.
a ๐‘ฏ๐ŸŽ : ๐ = ๐ŸŽ. ๐Ÿ“๐Ÿ–๐ŸŽ, ๐‘ฏ๐Ÿ :?๐ โ‰  ๐ŸŽ. ๐Ÿ“๐Ÿ–๐ŸŽ
๐ˆ = ๐ŸŽ. ๐ŸŽ๐Ÿ๐Ÿ“
Critical region is top 0.5% and bottom 0.5%, which from tables is:
๐’ โ‰ค โˆ’๐Ÿ. ๐Ÿ“๐Ÿ•๐Ÿ“๐Ÿ– or ๐’ โ‰ฅ ๐Ÿ. ๐Ÿ“๐Ÿ•๐Ÿ“๐Ÿ–
Test statistic:
๐ŸŽ. ๐Ÿ“๐Ÿ•๐Ÿ• โˆ’ ๐ŸŽ. ๐Ÿ“๐Ÿ–๐ŸŽ
๐’›=
= โˆ’๐Ÿ. ๐Ÿ’๐Ÿ๐Ÿ’
๐ŸŽ. ๐ŸŽ๐Ÿ๐Ÿ“
๐Ÿ“๐ŸŽ
Value is NOT in critical region so accept ๐‘ฏ๐ŸŽ and conclude no significant evidence that mean
diameter has changed.
?
?
?
b Critical region: ๐ŸŽ. ๐Ÿ“๐Ÿ–๐ŸŽ ± ๐Ÿ. ๐Ÿ“๐Ÿ“๐Ÿ– ×
๐ŸŽ.๐ŸŽ๐Ÿ๐Ÿ“
๐Ÿ“๐ŸŽ
โ†’
๐‘ฟ โ‰ค ๐ŸŽ. ๐Ÿ“๐Ÿ•๐Ÿ“ ๐’๐’“ ๐‘ฟ โ‰ฅ ๐ŸŽ. ๐Ÿ“๐Ÿ–๐Ÿ“
?
Exercise 3F
Reasoning about difference between means
GIRLS
BOYS
๐œŽ๐‘๐‘œ๐‘ฆ = 5๐‘˜๐‘”
Sample:
๐‘›1 = 25
๐‘ฅ1 = 48๐‘˜๐‘”
๐œŽ๐‘”๐‘–๐‘Ÿ๐‘™ = 8๐‘˜๐‘”
Sample:
๐‘›2 = 30
๐‘ฅ2 = 45๐‘˜๐‘”
The weights of boys and girls in a certain school are known to be normally distributed with
standard deviations of 5kg and 8kg respectively. A random sample of 25 boys had a mean weight of
48kg and a random sample of 30 girls had a mean weight of 45kg.
Stating your hypothesis clearly test, at the 5% level of significance, whether or not there is
evidence that the mean weight of boys in the school is greater than the mean weight of the girls.
Reasoning about difference between means
We know that ๐‘‹ is roughly normally distributed as the sample size becomes large.
If ๐‘‹~๐‘
๐œŽ๐‘ฅ2
๐œ‡๐‘ฅ , ๐‘›
and ๐‘Œ~๐‘ ๐œ‡๐‘ฆ ,
๐œŽ๐‘ฆ2
๐‘›
then by Chapter 1:
๐ˆ๐Ÿ๐’™ ๐ˆ๐Ÿ๐’š
๐‘ฟ โˆ’ ๐’€ ~ ๐‘ต ๐๐’™ โˆ’
? ๐๐’š, ๐’ + ๐’
And thus to produce a standardised variable ๐‘:
๐‘ฟ?
โˆ’ ๐’€ โˆ’ ๐๐’™ โˆ’
๐๐’š
?
๐’=
๐Ÿ
๐ˆ๐Ÿ๐’™ ๐ˆ๐’š
?
๐’ + ๐’
! Test for difference between two means
If ๐‘‹~๐‘ ๐œ‡๐‘ฅ , ๐œŽ๐‘ฅ2 and the independent variable ๐‘Œ~๐‘ ๐œ‡๐‘ฆ , ๐œŽ๐‘ฆ2 then a test of the null
hypothesis ๐ป0 : ๐œ‡๐‘ฅ = ๐œ‡๐‘ฆ can be carried out using the test statistic:
๐‘‹ โˆ’ ๐‘Œ โˆ’ ๐œ‡๐‘ฅ โˆ’ ๐œ‡๐‘ฆ
๐‘=
2
๐œŽ๐‘ฅ2 ๐œŽ๐‘ฆ
๐‘› + ๐‘›
If the same sizes ๐‘›๐‘ฅ and ๐‘›๐‘ฆ are large then the result can be extended, by the Central
Limit Theorem, to include cases where the distributions of ๐‘‹ and ๐‘Œ are not normal.
Example
Q The weights of boys and girls in a certain school are known to be normally distributed
with standard deviations of 5kg and 8kg respectively. A random sample of 25 boys had
a mean weight of 48kg and a random sample of 30 girls had a mean weight of 45kg.
Stating your hypothesis clearly test, at the 5% level of significance, whether or not
there is evidence that the mean weight of boys in the school is greater than the mean
weight of the girls.
๐ป0 : ๐œ‡๐‘๐‘œ๐‘ฆ =?๐œ‡๐‘”๐‘–๐‘Ÿ๐‘™
๐œŽ1 = 5, ๐‘›1 = 25
Test statistic:
๐ป1 : ๐œ‡๐‘๐‘œ๐‘ฆ > ?
๐œ‡๐‘”๐‘–๐‘Ÿ๐‘™
๐œŽ2 = 8, ๐‘›2 = 30
๐‘ง=
48 ?
โˆ’ 45 โˆ’ 0
?
25 64
+
25 ? 30
= 1.6947
?
5% (one-tailed) critical value for ๐‘ is ๐‘ง = 1.6449 so value is
significant and you can reject ๐ป0
โ€ฆand conclude there is evidence?that the mean weight of boys is
greater than the mean weight of the girls.
Test Your Understanding
June 2013 Q6
?
?
?
?
Test Your Understanding โ€“ Two Tailed
Q A manufacturer of personal stereos can use batteries made by two difference
manufacturers. The standard deviation of lifetimes for Never Die batteries is 3.1 and
for Everlasting batteries it is 2.9 hours. A random sample of 80 Never Die batteries and
a random sample of 90 Everlasting batteries were tested and their mean lifetimes
were 7.9 hours and 8.2 hours respectively.
Stating your hypotheses clearly test, at the 5% level of significance, whether there is
evidence of a difference between the mean lifetimes of the two makes of batteries.
๐‘ฏ๐ŸŽ : ๐๐’™ = ๐๐’š ๐‘ฏ๐Ÿ : ๐๐’™ โ‰  ๐๐’š
๐ˆ๐’™ = ๐Ÿ‘. ๐Ÿ, ๐’๐’™ = ๐Ÿ–๐ŸŽ, ๐ˆ๐’š = ๐Ÿ. ๐Ÿ—, ๐’๐’š = ๐Ÿ—๐ŸŽ
๐Ÿ•. ๐Ÿ— โˆ’ ๐Ÿ–. ๐Ÿ
๐’›=
= โˆ’๐ŸŽ. ๐Ÿ”๐Ÿ’๐Ÿ— โ€ฆ
๐Ÿ
๐Ÿ
๐Ÿ‘. ๐Ÿ
๐Ÿ. ๐Ÿ—?
+
๐Ÿ–๐ŸŽ
๐Ÿ—๐ŸŽ
The 5% two-tailed critical values for ๐’ are ๐’› = ±๐Ÿ. ๐Ÿ—๐Ÿ”๐ŸŽ๐ŸŽ
So the value is not significant and you do not reject ๐‘ฏ๐ŸŽ .
No significant evidence of a difference in the mean lifetimes of the two
makes of battery.
Exercise 3G
Q1, 3, 5, 7
Hypothesis Tests/Confidences when ๐‘› is large
In our hypothesis tests/determining confidence intervals up to now, we have presumed
we knew the population variance ๐œŽ 2 (which in turn allowed us to find the variance
the sampling distribution ๐‘‹ or the test statistic
๐‘ฅโˆ’๐œ‡
๐œŽ
๐‘›
๐œŽ2
๐‘›
).
What might seem an obvious thing to use for ๐œŽ 2 if we didnโ€™t know it?
We saw ๐’”๐Ÿ was an unbiased estimator for ๐ˆ๐Ÿ (i.e. a variance calculated from the
sample with on average is the same as ๐ˆ๐Ÿ , i.e. ๐‘ฌ ๐’”๐Ÿ = ๐ˆ๐Ÿ )
This however is only appropriate for large?
samples, and the test statistic is only an
approximation.
! If the population is normal, or can assumed to be so, then for large samples,
๐‘‹โˆ’๐œ‡
the statistic ๐‘  has an approximation ๐‘ 0,12 distribution.
๐‘›
If the population is not normal, by assuming ๐‘  is a close approximation to ๐œŽ,
๐‘‹โˆ’๐œ‡
then ๐‘  can be treated as having an approximate ๐‘(0,12 ) distribution.
๐‘›
of
Example
Q As part of a study into the health of young schoolchildren a random sample of 220
children from area ๐ด and a second, independent random sample of 180 children from
area ๐ต were weighed. The results are given in the table below:
๐’
๐’™
๐’”
๐‘จ๐’“๐’†๐’‚ ๐‘จ
220
37.8
3.6
๐‘จ๐’“๐’†๐’‚ ๐‘ฉ
180
38.6
4.1
a. Test at the 5% level, whether or not there is evidence of a difference in the mean
weight of children in the two areas.
b. State an assumption you have made in carrying out this test.
c. Explain the significance of the Central Limit Theorem to this test.
a ๐‘ฏ๐ŸŽ : ๐ ๐‘จ = ๐ ๐‘ฉ
๐‘ฏ๐Ÿ : ๐ ๐‘จ โ‰  ๐ ๐‘ฉ
Test statistic:
๐’›=
b
c
๐Ÿ‘๐Ÿ–. ๐Ÿ” โˆ’ ๐Ÿ‘๐Ÿ•. ๐Ÿ–
๐Ÿ‘. ๐Ÿ”๐Ÿ
๐Ÿ’. ๐Ÿ๐Ÿ
?= ๐Ÿ. ๐ŸŽ๐Ÿ“ (๐Ÿ‘๐’”๐’‡)
+
๐Ÿ๐Ÿ๐ŸŽ ๐Ÿ๐Ÿ–๐ŸŽ
Two-tail critical values are ๐’› = ±๐Ÿ. ๐Ÿ—๐Ÿ”. Since 2.05 > 1.96, result significantโ€ฆ
Test statistic requires ๐ˆ so you have to assume that ๐’”๐Ÿ = ๐ˆ๐Ÿ for both samples.
You are not told that populations are normally distributed but the samples are both large
as so the Central Limit Theorem enables us to assume that ๐‘ฟ๐‘จ and ๐‘ฟ๐‘ฉ are both normal.
?
?
Test Your Understanding
May 2012 Q5
?
?
Exercise 3H
Appendix
PROOFS
On following slides.
Proving ๐ธ ๐‘‹ = ๐œ‡
Prove that ๐‘‹ is an unbiased estimator for ๐œ‡ when the population is normally
distributed.
A random sample ๐‘‹1 , ๐‘‹2 , โ€ฆ , ๐‘‹๐‘› is taken from a population with ๐‘‹~๐‘ ๐œ‡, ๐œŽ 2
1
๐‘‹ + ๐‘‹2 + โ‹ฏ?+ ๐‘‹๐‘›
๐‘› 1
1
๐ธ ๐‘‹ = ๐ธ ๐‘‹1 + โ‹ฏ + ๐‘‹?๐‘›
๐‘›
1
= ๐ธ ๐‘‹1 + โ‹ฏ +?๐ธ ๐‘‹๐‘›
๐‘›
1
= ๐œ‡ +โ‹ฏ+๐œ‡ ?
๐‘›
1
= ๐‘›๐œ‡
?
๐‘›
๐‘›๐œ‡
=
=๐œ‡
?
๐‘›
๐‘‹=
Proof that ๐‘‰๐‘Ž๐‘Ÿ ๐‘‹ = ๐œŽ 2 /๐‘›
A random sample ๐‘‹1 , ๐‘‹2 , โ€ฆ , ๐‘‹๐‘› is taken from a population with ๐‘‹~๐‘ ๐œ‡, ๐œŽ 2
1
๐‘‹ = ๐‘‹1 + ๐‘‹2 + โ‹ฏ + ๐‘‹๐‘›
๐‘›
1
๐‘‰๐‘Ž๐‘Ÿ ๐‘‹ = 2 ๐‘‰๐‘Ž๐‘Ÿ ๐‘‹1 + ?
โ‹ฏ + ๐‘‹๐‘›
๐‘›
1
= 2 ๐‘‰๐‘Ž๐‘Ÿ ๐‘‹1 +?โ‹ฏ + ๐‘‰๐‘Ž๐‘Ÿ ๐‘‹๐‘›
๐‘›
1
= 2 ๐œŽ 2 + โ‹ฏ + ๐œŽ?2
๐‘›
1
= 2 ๐‘›๐œŽ 2
?
๐‘›
๐œŽ2
=
?
๐‘›
Proof of unbiased estimator for ๐œŽ 2
1
Prove that ๐‘† 2 = ๐‘›โˆ’1 ฮฃ๐‘‹ 2 โˆ’ ๐‘›๐‘‹ 2 is an unbiased estimator for ๐œŽ 2
Note first ๐ธ ๐‘‹ 2 = ๐œŽ 2 +?๐œ‡2
And that ๐‘‰๐‘Ž๐‘Ÿ ๐‘‹ =
Thus ๐ธ ๐‘‹
2
=
๐œŽ2
๐‘›
๐œŽ2
๐‘›
?
+?๐œ‡2
(as proven earlier) and ๐ธ ๐‘‹ = ๐œ‡ ?
(as proven earlier)
1
ฮฃ๐‘‹ 2 โˆ’ ๐‘›๐‘‹ 2
๐‘›โˆ’1
1
๐ธ ๐‘†2 =
๐ธ ฮฃ๐‘‹ 2 โˆ’ ๐‘›๐‘‹ 2
๐‘›โˆ’1
1
=
๐ธ ฮฃ๐‘‹ 2 โˆ’ ๐‘›๐ธ ๐‘‹ 2
๐‘›โˆ’1
๐‘†2 =
?
?
Since ๐ธ ฮฃ๐‘‹ 2 = ฮฃ๐ธ ๐‘‹ 2 = ๐‘›๐ธ ๐‘‹ 2 (as each thing in the sum is the same)
๐‘›
๐ธ ๐‘‹2 โˆ’ ๐ธ ๐‘‹2
๐‘›โˆ’1
๐‘›
๐œŽ2
2
2
=
๐œŽ +๐œ‡ โˆ’
+ ๐œ‡2
๐‘›โˆ’1
๐‘›
๐‘› ๐œŽ2 ๐‘› โˆ’ 1
=
= ๐œŽ2
๐‘›โˆ’1
๐‘›
?
๐ธ ๐‘†2 =
?
?