Professional Documents
Culture Documents
MBB:
Chapters 8 & 9
8.1 , 8.2
Topic 6
8.8
8.9
We obtain: 172 178 185 190 175 163 184 176 173 197
Sample statistics: x = 179.3
s = 9.84
n = 10
=179.3
for this year is the sample average
Example:
In past years, the height of male STAT171 students has followed a
Normal distribution with = 175 cm & = 15cm.
15cm
substitute for Z:
mult by /n:
subtract X:
Start with
X
P 1.96
+1.96 = 0.95
n
P 1.96
X +1.96
= 0.95
n
n
P X 1.96
X + 1.96
= 0.95
n
n
+ + X 1.96
= 0.95
n
P X 1.96
X + 1.96
= 0.95
n
n
X
~ Z
n
So, we can write P(-1.96 < Z < +1.96) = 0.95
, X + 1.96
X 1.96
n
n
But 95% is by far the most commonly used (see why later).
1 -
/2
X 1.96
-z/2
/2
z/2
x = 179.3 n = 10 = 15 (assumed)
= ( 179.3 12.2 )
= (170.0 , 188.6)
We are 95% confident that the interval 170.0 to 188.6 includes
the population mean , where is the true mean height for all
the male STAT171 students for this year.
year
= (167.1, 191.5)
(x 1.645 * /n )
= ( 179.3 1.645 * 15/10 )
= ( 179.3 7.8 )
9
= (171.5, 187.1)
X
~Z
n
This requires:
Therefore:
X to be Normally distributed
Do say:
say:
There is a 95% chance that the calculated confidence
interval includes .
; OR
AND is known.
There are occasions when is known and is not. But it is much
more common for to be unknown as well.
(we will come back to this in Topic 7)
12
(test of significance)
The other approach to making conclusions about the population
mean is to use the sample mean to test for a specific hypothesised
possible value of .
i.e. Is the value of xx evidence that could be or could not be a
particular value?
hypothesis testing
Both approaches are equally valid (and use the same statistical
theory).
13
In general, X ~ N(
, 2/n) and
14
X
~ Z
n
X 175
15 10
is
NOT
~ Z
X
~ Z
15 10
x 175
10
then,
X 175
~ Z
15 10
16
our sample was believably from a population with the specified mean.
our sample was NOT believably from a population with the specified mean.
x 179.3 175
=
0.91
n
15 10
17
That is, if the true mean were 175, and we take a sample of size
10, we would expect to get a sample mean of 179.3 or a sample
mean further away from 175 (at least 4.3 cm in either direction)
in 36% of the samples, just due to chance variation.
variation
18
20
denoted by (alpha)
versus
or
0.018
or
0.003 etc
if p >
We conclude that the observed z-value is reasonably likely.
Hence the sample mean is close enough to the hypothesised value
to conclude that the difference can be treated as due to chance.
i.e. Not reject the hypothesised value.
if p
We conclude that the observed z-value is reasonably unlikely.
un
Hence the sample mean is so far away from the hypothesised value
that we can conclude that it is not reasonable that the difference
could have occurred due to chance alone.
i.e. Reject the hypothesised value.
23
22
24
Z=
H1: 175
= 0.05
zobs =
X
n
x 0
n
25
26
if p > Retain H0
evidence to be able to conclude
there is insufficient
in
that the true mean is not 0.
In this case:
if p Reject H0
there is sufficient evidence (at that level of statistical
significance) to be able to conclude that the true
mean is not 0.
27
28
We reject H0 if p 0.05:
This is equivalent to obtaining an observed z greater than 1.96 or
less than -1.96 since P(-1.96 Z 1.96) = 0.95
We retain H0 if p > 0.05:
A zobs between -1.96 and 1.96 will result in a p-value > 0.05 and
will mean H0 is retained.
-z/2
z/2
Both of these probabilities are only these values in the case of H0 being true
30
is known.
= x - 0
s.e.(x )
31
32
If we retain H0:
The possibilities are we could be doing so because:
If we reject H0:
OR
33
35
36
38
= P(Type I Error)
= P(Retain H0 | H0 false)
= P(Reject H0 | H0 true)
because the test is designed so that if H0 is true, we will reject % of z-values
Type I error
40
Legal Analogy:
A Type II error occurs when H0 is false, and we incorrectly retain
it .
Significance Test
H0 not rejected
Decision
H0 rejected
Jury trial
Decision
Situation in reality
H0 true
H0 false
Type II error
Type I error
Situation in reality
Person innocent
Person guilty
Error
Error
Declared guilty
41
42
decreases
de
increases
in
As
increases
in
decreases
de
43
Picture 1: standard
= 0.05 = 0.7405
We can see:
Picture 2: lower
= 0.01 = 0.9074
and
Picture 3: higher
= 0.20 = 0.4371
44
a Type I error
would occur if there is evidence the drug is useful (when it isnt)
would lead to more intense testing only a little bit costly (time and money)
a Type II error
would occur if there is insufficient evidence the drug is useful (when it is)
would stop further testing very costly (in terms of lost potential benefits)
45
46
So, in the final stages the error types have a very different cost than in
the initial stages.
For the blood pressure drug example:
a Type I error would be costly
(manufacturing and marketing a useless drug)
a Type II error would be not be so costly
(not developing a useful drug)
We want P(Type I error) to be very low at the expense of a high P(Type II error).
We want the probability of marketing an ineffective drug to be close to zero.
48
zobs =
x 0
reject H0
zobs =
< 1.96
x 0
1.96
CI contains 0 retain H0
CI does not contain 0 reject H0
P
< 1.96 = 0.95
n
= 1
49
50
The 95% C.I. for (the true mean height this year) was (170.0 , 188.6)
Example:
Example:
versus
H1: 175
H1: 165
52
In this case we are only interested in the new paint (with the
additive) if it DECREASES (typical) drying time.
H0: = 75
x = 71.5
H1: < 75
= 9 (assumed)
We carry out a one tailed test instead of a two tailed test, since we
are only interested in more deviant outcomes that support H1.
Z=
X 0
X is normally distributed
BUT:
BUT What is the distn of X?
no data here, so cant assess
told in question X is normal
zobs =
54
x 0
71.5 75
=
1.94
9 25
n
55
56
H1: < 0
H1: > 0
Same conclusion.
57
58
H1: < 0
etc, etc
So you require a reason before you can do a one tailed test the
reason would be based on the question of interest, or the research
hypothesis, as this dictates the H1.
The only real difference in carrying out a one or two tailed test is
the calculation of the p-value.
Everything else is the same.
61
62
P < X + 1.645
= 0.95
n
P > X 1.645
= 0.95
n
P < X + 1.645
= 0.95
n
63
If the value of 0 is
outside the 95% onesided CI for , we
would have evidence
that the population
from which the sample
was taken has a mean
less than the value 0 .
64
, +,
X + 1.645
n
P
< z = 1
n
z is positive it is
the value which
cuts off an area of
in the upper tail
P < X + z
= 1
n
P > X z
= 1
n
65
66
H0: = 0
H1: <
n = 25 , x = 71.5 , = 9 (assumed)
retain H0 if 0 is in CI eg ( , 102)
reject H0 if 0 not in CI eg ( , 96.7 )
H0: = 0
e.g. H0: = 100
H1: > 0 >
H1: > 100
retain H0 if 0 is in CI eg ( 98.3 , + )
reject H0 if 0 not in CI eg ( 102 , + )
We can reject H0 .
there is evidence that the true mean is less than 75 minutes
market the new paint
67
68
> Stat
> Basic Stats
> 1-Sample Z
StDev
9.84
SE Mean
4.74
95.0% CI
Z
P
( 170.00, 188.60) 0.91 0.365
69
P
0.026
P
0.052
70
P
0.974
71
72
Summary:
All confidence intervals require the following:
74
P (Y = y ) =
y
; y = 1, 2,3, 4,5, 6
21
It was shown that the expected value and variance of the value (Y)
on the uppermost face of the die were:
13
1
E (Y ) = = 4
3
3
Var(Y ) =
20
2
=2
9
9
; and
Y =
20
1.490712
9
75
76
Example
Hypothesis test: H0: = 4.333
versus H1: 4.333
= 0.05
X
n
993
= 4.1375
240
1
20
Given: Distribution as stated with = 4 , =
3
9
Assumption: X
X is approximately normally distributed.
Justification:
Here, X is discrete and skewed, so X
X will also be discrete and skewed.
skewed
Mean = E ( X ) = 4
se ( X ) =
X
n
1
3
20 9
240
1
0.096225
108
=
77
zobs =
78
1
1
4.1375 +
4.33
0.19375
2n
480
=
2.0135
0.096225
n
2.22 240
x+
Hence, there is sufficient evidence to refute the claim that this die
is biased in the way claimed.
and we want to include our observed mean in the tail area ...
so the cc here is to add 1/480
79
80
(ii) Working with the total, we get the same result as with the
mean:
zobs =
x
4.1375 4.33
0.195833
=
2.035
0.096225
n
2.22 240
x + 2 n
i
zobs =
i =1
1
993 + 1040
46.5
2
=
2.0135
23.094011
240 2.22
1
1
4.1375 4.33
2n =
480 0.19375 2.0135
0.096225
n
2.22 240
x
zobs =
81
Q1: For the continuity correction (dealing with the mean X and
not the sum of the observations), ... how do you know when to
add or subtract 1/(2n)?
The relevant confidence interval for the true mean of this die is:
2.22
95% c.i. for = 4.1375 1.96
240
( 4.1375 + 0.18860 )
( 3.949, 4.326 )
One-Sample Z
Test of mu = 4.33333 vs not = 4.33333
The assumed standard deviation = 1.49071
N
Mean
SE Mean
95% CI
240
4.1375
0.0962
(3.9489, 4.3261)
82
-2.04
0.042
83
z 2
z 2
n
85
Recall that in past years, the height of male STAT171 students has
followed a Normal distribution with = 175 cm & = 15cm.
15cm
z 2 1.96 15
2
n
=
= 5.88 = 34.5744
5
B
2
z 2.33 9
2
n =
= 5.2425 27.48
B 4
Hence, n 35.
A sample size less of 34 or less will cause the margin of error in
estimating to be greater than 5 cm.
86
88
89
90
Recall from Topic 6 there are two types of error which can occur
when testing a hypothesis:
Type I error:
error this occurs when H0 is true, and we wrongly declare
it to be false:
= P(Type I error)
= P(Reject H0 | H0 true)
Type II error:
error this occurs when H0 is false, and we wrongly declare
it to be true:
= P(Type II error)
= P(Retain H0 | H0 false)
This would mean our Type I error rate () was also 100% .
91
92
That is, for a fixed Type I error rate, how can we improve the
power?
zobs =
We concluded that there was evidence that the new additive reduced
the average drying time of the paint.
93
e.g.
71.5 75
0.870
9 5
Dont reject H0
Now (with n=5 rather than n=25) we cannot conclude that the
additive has a significant effect on the average drying time.
94
71.5 75
=
38.89
9 10000
0.00
The sample size can affect your conclusions because the larger the
sample size, the more confident we can be about the sample mean
as an estimate of .
e.g.
71.5 75
1.94
9 25
For n = 5
5:: zobs =
= 9 n = 25
95
96
zobs =
x 75
9 10000
will be declared significant if zobs is less than (or equal to) -1.645
(recall, H1 is < 75).
97
98
We want: zobs
99
result significant?
73 75
9 n
Statistical sig
= p-val 5%
1.645
100
2 n
1.645
9
n 1.645
H0: = 0
9
= 7.4025
2
n ( 7.4025 ) 54.80
2
So, once we have decided on what values for these are to be used,
we solve the equation to obtain the minimum sample size that will
achieve this.
Solve for n:
x 0
1.645
n
x 0
1.645
n
102
n z
To solve the dilemma, use the zcrit as this will give a rough idea in
helping to plan the experiment.
103
104
For any test of significance, there are two possible correct outcomes,
and two incorrect outcomes. Recall:
H0 true
Type II ERROR
H0 rejected
Type I ERROR
105
H0 retained
Warning:
Warning We may observe sample statistics that are entirely
different from what we are hoping/expecting to observe.
H0 false
9
25
x 75 2.961 = 72.039
x 75 1.645
107
108
9
X ~ N 75,
~ N 75,1.82
25
we will:
reject H0 if X 72.039
not reject H0 if X
X > 72.039
110
= P X 72.039 = 70
That is, if the true mean is 70 and we carry out a one-tailed test
for = 75 at the 5% level of significance testing :
X 72.039 70
= 70
= P
9 25
2.039
= PZ
1.8
P ( Z 1.133)
0.8708
112
Reject H0
87%
5%
What would happen to the power (area under the black density curve to the left
of 72.04) if:
Reject H0
the true mean is greater than 70 (but still less than 75)?
87%
5%
113
When = 65:
65
When = 71:
71 Power = P ( X < 72.039 | = 71)
X 72.039 71
= 71
= P
<
n
9 25
When = 73:
73 Power = P ( X < 72.039 | = 73)
X 72.039 73
= 73
= P
<
n
9 25
P ( Z < 0.534 )
0.2946
114
If is 73, there is
only a 30% chance
of (correctly)
concluding it is
less than 75.
When = 74.9:
74.9
X 72.039 65
= P
<
= 65
n
9 25
P ( Z < 3.911)
1.0000 (close enough)
X 72.039 74.9
= 74.9
= P
<
n
9 25
P ( Z < 1.589 )
0.0559
Power does not exist when H0 is true, that is when =75 here,
but the power approaches 0.05 (the significance level).
115
116
- 75
Power
65
-10
1.000
70
-5
0.871
71
-4
0.719
73
-2
0.295
-0.1
0.056
74.9
117
118
x 0
120
121
122
Different Example:
Example: zz-test power curve for different
[Note: this chart was NOT created in Minitab]
1.00
0.90
0.80
H0: = 120
Ha: > 120
Power (1 - )
0.70
0.60
0.50
0.40
0.30
= 0.10
= 0.05
= 0.01
0.20
0.10
0.00
118
119
120
121
122
123
124
125
126
127
128
True Value of
To get the graph, cut and paste these values for Size and
Actual Power into columns in the worksheet, then do
Graph > Scatterplot > With Connect Line
123
124
1.00
0.90
0.80
H0: = 120
Ha: > 120
Power (1 - )
0.70
0.60
0.50
0.40
0.30
n = 45
n = 90
n = 180
n = 360
0.20
0.10
0.00
118
119
120
121
122
123
124
125
126
127
128
True Value of
At a 5% significance level, we
would reject H0 for zobs -1.96
or zobs +1.96
125
(cont ...)
We now need to convert this rejection region for zobs into one involving
the sampling distribution of the sample average we will first deal
with a sample size of 25.
When we carry out the test we will
reject H0 if zobs -1.96 or zobs 1.96
X
1.96
n
OR
X 500 1.96
X 498.432
4
25
X 498.432 499
X 501.568 499
= 499 + P
= 499
= P
<
>
n
4 25
4 25
X
+1.96
n
X 500
+1.96
4 25
X 500
1.96
4 25
126
X 500 + 1.96
X 501.568
4
25
127
Reject H0
Reject H0
128
130
The text book uses different terminology from the lecture notes.
For a z-test, it uses a large sample (n30) and estimates the
population standard deviation with the sample standard deviation s.
Z=
X
n
zobs =
x
n
133