07 Chapter 9 Hypothesis Testing
07 Chapter 9 Hypothesis Testing
Yes
𝜇 Population No
Parameter of Sample Size >30? Use T-score
Variance Known?
Interest? No
𝜎!
Single Sample
Null hypothesis H 0 : µ = µ0
Alternative hypothesis H1 : µ ≠ µ 0
Statistical Hypotheses
H 0 : µ = 50 cm/sec H 0 : µ = 50 cm/sec
OR
H1 : µ < 50 cm/sec H1 : µ > 50 cm/sec
Two-sided Hypothesis Testing
H 0 : µ = 50 cm/sec
H1 : µ ≠ 50 cm/sec
Confidence Interval
Types of error
In reality, H0 is
True False
Your test says that Fail to Correct conclusion Type II error
H0 should be: Reject b
Reject Type I error Correct conclusion
a
Type II: fail to reject null hypothesis when it’s really false, b
b=P(Type II error)=P(fail to reject Ho when Ho is false)
8
Type I error, a
Age
Producer’s Risk
> Type II error – do not reject the null hypothesis that
the engine functions properly (i.e., think it’s okay)
– Leave engine in the car – ENGINE MALFUNCTION
Consumer’s Risk
Statistical Inference
Guilty or Not Guilty
H0: A person is innocent
H1: A person is guilty
14
Statistical Hypotheses
Two-sided Alternative Hypothesis
H 0 : µ = 50 cm/sec Given: n=10, σ =2.5
H1 : µ ≠ 50 cm/sec
We WILL reject the null hypothesis if: x < 48.5 or x > 51.5
β = P(48.5 ≤ X ≤ 51.5)
Type II error
The probability of making a Type II error (b) is:
β = P(48.5 ≤ X ≤ 51.5)
If the true value of the mean, µ=52
48.5 − 52 51.5 − 52
z1 = = −4.43 z2 = = −0.63
2.5 / 10 2.5 / 10
β = P(−4.43 ≤ Z ≤ −0.63)
= P(Z ≤ −0.63) − P(Z ≤ −4.43)
= 0.2643− 0
= 0.2643
Type II error, part 2
The probability of making a Type II error (b) gets
bigger when the difference between the true mean and
hypothesized mean gets smaller
β = P(−2.53 ≤ Z ≤ 1.27)
= P(Z ≤ 1.27) − P(Z ≤ −2.53) Compare that to b=0.2643 (last
= 0.8923 slide) where µ=52
Power of a Test
σ σ
x − Zα ≤ µ ≤ x + Zα
2 n 2 n
7. Conclusion
p − value = 2[1− Φ(3.25)] = 0.0012
µ = 25.6
σ = 3.1
10 15 20 25 30 35 40
Student Age
Let’s say we have a random sample of
5 students (n1=5)
Mary: X1=32 Bob: X2=40 Terry: X3=33
Ronald: X4=30 Susan: X5=38 yrs old
H0 : µ = 25.6
10 15 20 25 30 35 40
Student Age
Let’s say we have a random sample of
5 students (n1=5)
Mary: X1=32 Bob: X2=40 Terry: X3=33
Ronald: X4=30 Susan: X5=38 yrs old
H0 : µ = 25.6
α 2 α 2
10 15 20 25 30 35 40
Student Age
X = 34.6
Reject Ho
10 20 30 40 50
Student Age
X = 27.8
DO NOT
Reject Ho
10 20 30 40 50
Student Age
Type II: fail to reject null hypothesis when it’s really false, b
b=P(Type II error)=P(fail to reject Ho when Ho is false)
Inference on the Mean of a Population,
Variance Known
• Test Statistic: x - µ0
Z0 =
s/ n
• Significance Level, a
• Rejection Region:
Two sided test: Zo < -Za/2 or Zo > Za/2
One sided test: (lower) Zo < -Za
For one-sided, only pick one
(upper) Zo > Za
9-2.2 Type II error
H 0 : µ = µo <= Suppose this is false
H1 : µ ≠ µ o The true mean is actually: µ = µo + δ
x − µ0
If Z 0 =
σ/ n
x − µo + δ − δ
We can account for d: Z o =
σ/ n
x − µo − δ δ
Rearranging, gives us: Z o = +
σ/ n σ/ n
⇒ Zo =
(
x − µo + δ )+δ n
σ/ n σ
9-2.2 Type II error
Zo =
(
x − µo + δ )+δ n This is a normal distribution
σ/ n σ denoted as: ! δ n $
N# ,1&
" σ %
Type II error for a 2-sided test
Type II: not rejecting the null hypothesis when it is false
H0 H1
δ n
N(0,1) N( , 1)
σ
− Zα 2 0 Zα 2 δ n σ
Pr (Type II error) = b
æ d nö æ d nö
b = Fçç Za - ÷ - Fç - Za -
÷ ç
÷
÷
è 2 s ø è 2 s ø 39
Type II error for a 1-sided test
Type II: not rejecting the null hypothesis when it is false
𝛿 𝑛
𝛽 = Φ(𝑍! − )
𝜎
When true mean (µ) is LESS than hypothesized mean (µ0)
𝛿 𝑛
𝛽 = 1 − Φ(−𝑍! − )
𝜎
40
Type II error and sample size
æ d nö æ d nö
b = Fçç Za - ÷ - Fç - Za -
÷ ç
÷
÷
è 2 s ø è 2 s ø
Where b is the Type II error
Probability of accepting a lot of poor quality
=>Therefore, a smaller b is better
F the Z value needed (and whose probability can
be found in the Z table).
δ = µ − µo
Where µ=the true mean and
µ0 = the hypothesized41mean
Sample Size Formula
Zero
æ d nö æ d nö
b = Fçç Za - ÷ - Fç - Za -
÷ ç
÷
÷
è 2 s ø è 2 s ø
H0 H1
# δ n&
For δ > 0, β = Φ % Zα − ( N(0,1) N(
δ n
, 1)
$ 2 σ ' σ
( )
Φ −zβ
− Zα 2 0
So:β ≅ Φ (−zβ )
Zα 2 δ n σ
n≅
( α /2 β )
z + z σ
δ2
• One-sided alternative hypothesis
22
n≅
( α β)
z + z σ
δ2
Example 9-3a:
Propellant Burning Rate
æ d nö æ d nö
b = Fçç Za - ÷ - Fç - Za -
÷ ç
÷
÷
è 2 s ø è 2 s ø
!" #$ !" #$
𝛽=Φ 1.96 − #
− Φ −1.96 − #
𝜷=𝜱 𝟒. 𝟒𝟔 − 𝜱 𝟎. 𝟓𝟒 =1-0.705401=0.294599
The prob is ~0.30 that this difference from 50 cm/sec
WILL NOT be detected
Power of a Test
Hypothesis Testing
Hypotheses: H0: µ = µo H1: µ ≠µo (Two-sided)
H0: µ = µo H1: µ >µo OR H1: µ <µo (One-sided)
x − µ0
Test Statistic: T0 =
s/ n
Significance Level, a
Rejection Region:
One sided test: to > tα ,n−1
Two sided test: to > tα /2,n−1
to < −tα ,n−1
Confidence Interval for t
S S
x - ta , n -1
£ µ £ x + ta ,n -1
2 n 2 n
∑x i
(0.841+ 0.819 +... + 0.866)
i=1
x= = = 0.837
15 15
15
∑( x − x )
i
(0.841− 0.837)2 +... + (0.866 − 0.837)2
s2 = i=1
= = 0.000603
15 −1 15 −1
s = s 2 = 0.02456
Example 9-6 Golf Club Design
6. Computations
x − µ 0 0.83725 − 0.82
t0 = = = 2.72
s/ n 0.02456 / 15
0.4
7. Conclusions
0.3
dt(x, 14)
t0.05,14 = 1.761
0.1
t=2.72
0.0
-4 -2 0 2 4
x
We will reject Ho:µ=0.82 at the 0.05 level of significance and
conclude that the mean coefficient of restitution differs from
0.82
9-4 Inference on the Variance of
a Population (Normal Distribution)
Hypothesis Testing
Hypotheses: Ho: s2=so2 H1: s2≠so2
2
2 (n - 1) s
Test Statistic: co = 2
so
Significance Level: a/2 (upper) or 1-a/2 (lower)
54
Confidence interval for true variance
(n - 1) s 2 (n - 1) s 2
£s2 £
ca2 2, n -1
c2 a
1- , n -1
2
55
Problem 9-84
(n - 1) s 2 (15 −1)(0.0083) 2
c o2 = = 2
= 9.6446
s o2 (0.01)
9.64
5.63 26.12
0 10 20 30 40
9.6446
0.50<P-value<0.90
=>Interpolate 9.64
0.50 13.34
5.63 26.12
x 9.6446
0.90
0.10 7.79 0 10 20 30 40
(n - 1) s 2 (n - 1) s 2
£s2 £
ca2 2, n -1
c2 a
1- , n -1
2
14(.0083) 2 14(.0083) 2
≤σ 2 ≤
26.12 5.63
0.00003692 ≤ σ 2 ≤ 0.0001713
0.00003692 ≤ σ 2 ≤ 0.0001713
0.00608 ≤ σ ≤ 0.01308