0% found this document useful (0 votes)
17 views118 pages

11 Hypothesis Testing

Uploaded by

Quỳnh Như
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views118 pages

11 Hypothesis Testing

Uploaded by

Quỳnh Như
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 118

Hypothesis testing

1 / 113
Outline
• Principle of hypothesis testing
• Test for population mean
• when the population variance is known
• when the population variance is unknown
• Test for population variance
• Test for comparing two means
2 / 113
Table of contents
1 Statistical Hypotheses: General Concepts

2 Testing a Statistical Hypothesis

3 Single Sample

4 Two samples

3 / 113
Introduction

• Problem: there are two competing claims about


the value of a parameter, and the engineer must
determine which claim is correct
• Procedure to make decision based on empirical
data: hypothesis testing

4 / 113
Example
• The propellant in the rocket motor of an air crew
escape system should have a mean burning rate of
50 cm/sec.
• If the burning rate is too low, the ejection seat may
not function properly, leading to an unsafe ejection
and possible injury of the pilot. Higher burning
rates may imply instabilty in the propellant or an
ejection seat that is too powerful, again leading to
possible pilot injury. 5 / 113
In this example, we are interested in burning rate of a
solide propellant used to power air crew system
• Burning rate is a random variable that is decribed
by a distribution
• Our interest focus on the mean burning rate
(parameter of distribution)
• Specifically, we are interested in deciding whether
or not the mean burning rate is 50 centimeters
per second.
6 / 113
Table of contents
1 Statistical Hypotheses: General Concepts

2 Testing a Statistical Hypothesis

3 Single Sample

4 Two samples

7 / 113
Statistical hypothesis

A statistical hypothesis is a statement about one or more


populations.
Null Hypothesis H0 Alternative Hypothesis Ha or H1
assumption to test an opposite of null hypothesis

8 / 113
Statistical hypothesis

A statistical hypothesis is a statement about one or more


populations.
Null Hypothesis H0 Alternative Hypothesis Ha or H1
assumption to test an opposite of null hypothesis

8 / 113
Remark
Hypothesis is a statement about population, not about
sample statistic
Example
Want to decide whether the average number of TV set in
U.S. Homes is equal to three

9 / 113
Example
We are interested in deciding whether or not the
mean
| burning
{z rate} is 50 centimeters per second.
µ
We may express this formally as

H0 : µ = 50 centimeter per second


H1 : µ ̸= 50 centimeter per second

10 / 113
Since the alternative hypothesis H1 : µ ̸= 50 specifies
values of µ that could be either greater or less than 50
centimeters per second, it is called a two-sided
alternative hypothesis. In some situations, we may wish
to formulate a one-sided alternative hypothesis, as in

H0 : µ = 50 vs H1 : µ > 50

or
H0 : µ = 50 vs H1 : µ < 50

11 / 113
One - sided and Two - sided test about parameter θ

• One-sided test
• Upper-tail test
H0 : θ = θ0 H1 : θ > θ0
• Lower-tail test
H0 : θ = θ0 H1 : θ < θ0
• Two-sided test
H0 : θ = θ0 H1 : θ ̸= θ0
12 / 113
Remark

• H0 always contains ”=” or ≤ or ≥


• H1: contains ” ̸= ”, ” > ”, ” < ”

The name of test depends on the sign in H1.

13 / 113
Remark

• H0 always contains ”=” or ≤ or ≥


• H1: contains ” ̸= ”, ” > ”, ” < ”

The name of test depends on the sign in H1.

13 / 113
Example
• Producer advertises that
their cable have an average breaking strength of at least 7,000 psi.
| {z }
statement about qualify of cable which is described by the mean - µ
Express formally as

H0 :µ ≥ 7000psi − the statement


H1 :µ < 7000psi − opposite of the statement

14 / 113
Example
Need to decide whether the new fuel injection system will
provide a |mean miles-per-gallon
{z rating} exceeding 24
µ
Express formally as

H0 :µ ≤ 24miles-per-gallon rating − opposite of the claim


H1 :µ > 24miles-per-gallon rating − the claim

15 / 113
Test of a hypothesis
• A procedure leading to a decision about a particular
hypothesis is called a test of a hypothesis.
• Hypothesis-testing procedures rely on using the
evidence from information in a random sample
from the population of interest.
• reject H0 in favor of H1 if the evidence is
inconsistent with H0
• fail to reject H0 if the evidence is consistent
with H 16 / 113
The truth or falsity of a particular hypothesis can never
be known with certainty, unless we can examine the
entire population.

17 / 113
Hypothesis Testing Process

18 / 113
Rejecting or Accepting H0?

Sample mean X̄ can take many values


19 / 113
Evidence support H0?
• Even H0 is true, the sample mean x̄ can be close or
far from 50. We are more confident that the true
mean is 50 if the sample mean x̄ is ”close” to 50
• ”How close is enough”. For example, if the sample
mean is between 48.5 and 51.5 then we can
consider that H0 is acceptable
• Decide to reject H0 when either x̄ > 51.5 or
x̄ < 48.5
20 / 113
Critical values - Rejection Region

• The values 48.5 and 51.5 are called critical values


• The interval [48.5; 51.5] is called acceptance region
• The interval (−∞, 48.5) ∪ (51.5, ∞) is called
rejection region or critical region

21 / 113
What happens if true population mean age µ = 50 but the
observed sample mean is 58?
We can reject H0 even when H0 is true
Face to a wrong decision making

22 / 113
Error in Decision Making
• Type I error Rejecting the null hypothesis H0 when it is true
• Type II error Failing to reject the null hypothesis when it is
false

23 / 113
Level of significance

Because our decision is based on random variables,


probability of type I error

α = P(reject H0 when H0 is true)

is called to be level of significance

24 / 113
Fixed level of significance
• Typical value for level of significance α are 1%, 5%,
10%
• is selected by the researcher at the beginning
• provides critical values for the test
• defines rejection region of the sampling distribution

25 / 113
Critical Region for Fixed level of significance

26 / 113
Disadvantage of fixed significant
level testing
• the null hypothesis was or was not rejected at a
specified level of significance ⇒ no idea about the
statistic is just barely in or far in rejection region
• Level of significance is not usually set up in
advance but rather look at in data to determine a
level
27 / 113
P-value
P - value is the smallest level of
significance that would lead to rejection
of null hypothesis with a given data.
P-value is the observed significance level when we use
value of evidence that we observe from data as critical
value

28 / 113
General Procedure
for Hypothesis Testing (1)

1 Determine parameter of interest

2 State null and alternative hypothesis

3 Choose a test statistic and compute value of the test statistic


vobs .

29 / 113
General Procedure for Hypothesis Testing (2)
Critical value approach P- value approach
4 Determine critical value
4 Compute the P - value
and reject region Wα based
based on the value of test
on level of significane α,
statistic vobs
distribution of test statistic
and type of test
5 Draw conclusion

5 Draw conlusion • P-value < α: reject


• vobs ∈ Wα : reject H0 H0
• P-value > α: fail to
• vobs ∈
/ Wα : fail to
reject H0
reject H0
30 / 113
Table of contents
1 Statistical Hypotheses: General Concepts

2 Testing a Statistical Hypothesis

3 Single Sample

4 Two samples

31 / 113
Tests for Single Mean µ
when Population Variance σ2
Known

32 / 113
Problem
Test
H0 : µ = µ0
vs

H1 : µ ̸= µ0 (two-sided test)
or H1 : µ > µ0 (upper tail test)
or H1 : µ < µ0 (lower tail test)

33 / 113
Z-test
Normal population or large sample size n ≥ 30
If H0 : µ = µ0 is true then by central limit theorem or
property of sample mean for normal population, test
statistics
X̄ − µ0
Z= √ ,→ N(0, 1) called Z-test
σ/ n
x̄−µ
√0
The value of Z computed from observed data zobs = σ/ n
34 / 113
Z-test
Normal population or large sample size n ≥ 30
If H0 : µ = µ0 is true then by central limit theorem or
property of sample mean for normal population, test
statistics
X̄ − µ0
Z= √ ,→ N(0, 1) called Z-test
σ/ n
x̄−µ
√0
The value of Z computed from observed data zobs = σ/ n
34 / 113
Conclusion with Critical value(s)
Two-tailed test Upper-tailed test Lower-tailed test
N(0,1) N(0,1) N(0,1)
Critical region Critical region Critical region

α /2 Acceptance α /2 Acceptance α α Acceptance


region region region
–zα /2 0 zα /2 Z0 0 zα –zα 0 Z
(a) (b) (c)

Reject H0 if zobs is in the reject (critical) region

|zobs| > z α2 |zobs| > zα

Two - sided test One - sided test 35 / 113


Conclusion with P-value

• Two-sided test: P-value = 2P(Z > |z0|)


• One-sided test: P-value = P(Z > |z0|)

Reject H0at level of significance α if Pvalue < α

36 / 113
Example
A random sample of 100 recorded deaths in the United
States during the past year showed anaverage life span of
71.8 years. Assuming a population standard deviation
of 8.9 years, does this seem to indicate that the mean life
span today is greater than 70 years? Use a 0.05 level of
significance.

37 / 113
Solution
• Parameter of interest: mean life span today µ
• H0 : µ = 70, H1 : µ > 70
• population std σ = 8.9, sample size n = 100,
sample mean x̄ = 71.8
• Z-test
x̄ − µ0 71.8 − 70
zobs = √ = √ = 2.02
σ/ n 8.9/ 100
38 / 113
Solution
• Parameter of interest: mean life span today µ
• H0 : µ = 70, H1 : µ > 70
• population std σ = 8.9, sample size n = 100,
sample mean x̄ = 71.8
• Z-test
x̄ − µ0 71.8 − 70
zobs = √ = √ = 2.02
σ/ n 8.9/ 100
38 / 113
Approach 1 - Draw conclusion with critical value

Upper-tailed test
N(0,1)
Critical region Critical region

Acceptance α
region

• Level of significance α = .05 = 5% ⇒ zα = 1.65


• zobs > zα : reject H0 at 5% level of significance.
39 / 113
Find zα = z0.05 = 1.65

40 / 113
Approach 2 - Draw conclusion with P-value

• P-value = P(Z > 2.02) = .0217 = 2.17%


• Level of significance α = .05 = 5%
• P-value < α ⇒ reject H0
• Comment: the evidence in favor of H1 is even
stronger than that suggested by a 0.05 level of
significance. 41 / 113
Find P-value = P(Z > 2.02) = .0217 = 2.17%

42 / 113
Remark

In order to draw conclusion, you can choose either


critical value approach or P-value approach. They always
prodive the same conclusion.

43 / 113
Example
A manufacturer of sports equipment has developed a new
synthetic fishing line that the company claims has a mean
breaking strength of 8 kilograms with a standard
deviation of .5 kilogram. Test the hypothesis that µ = 8
kilograms against the alternative that µ ̸= 8 kilograms if
a random sample of 50 lines is tested and found to have a
mean breaking strength of 7.8 kilograms. Use a .01 level
of significance
44 / 113
Solution
• H0 : µ = 8, H1 : µ ̸= 8
• σ = .5, n = 50, x̄ = 7.8
• Z-test
x̄ − µ0 7.8 − 8
zobs = √ = √ = 2.83
σ/ n .5/ 50

45 / 113
Critical value approach
Two-tailed test
N(0,1)
Critical region Critical region

α /2 Acceptance α /2
region
–zα /2 0 zα /2 Z0

• Level of significance α = .01 = 1% ⇒ z α = 2.58


2

• zobs > z α : reject H0 at 1% level of significance.


2

46 / 113
Find z α2 = z.005 = 2.58

47 / 113
P-value approach

• For two - sided test:


P-value = 2P(Z > 2.83) = .0046
• Level of significance α = .01 = 1%
• P-value < α ⇒ reject H0 that µ = 8 kg
48 / 113
P
Find 2 = .0023

49 / 113
Practice
A researcher wishes to test the claim that the average cost
of tuition and fees at a four year public college is greater
than $5700. She selects a random sample of 36 four-year
public colleges and finds the mean to be $5950. The
population standard deviation is $659. Is there evidence
to support the claim at α = 0.05?

50 / 113
Test for mean µ when population
variance σ 2 is unknown

51 / 113
Problem
Test
H0 : µ = µ0
vs

H1 : µ ̸= µ0 (two-sided test)
or H1 : µ > µ0 (upper tail test)
or H1 : µ < µ0 (lower tail test)

52 / 113
T-test
normal population
If H0 : µ = µ0 is true then test statistics
X̄ − µ0
T= √ ,→ Tn−1
s/ n
called T-test
t - distribution with n − 1 degree of freedom
The value of T computed from data tobs = x̄−µ √0
s/ n
53 / 113
T-test
normal population
If H0 : µ = µ0 is true then test statistics
X̄ − µ0
T= √ ,→ Tn−1
s/ n
called T-test
t - distribution with n − 1 degree of freedom
The value of T computed from data tobs = x̄−µ √0
s/ n
53 / 113
Conclusion with Critical value
tn – 1 tn – 1 tn – 1

α /2 α /2 α α

–tα /2, n – 1 0 tα /2, n – 1 0 tα , n – 1 –tα , n – 1 0 T0


(a) (b) (c)

Reject H0 if tobs is in the reject (critical) region

|tobs| > t α2 ,n−1 |tobs| > tα,n−1

Two - sided test One - sided test 54 / 113


Conclusion with P-value
• Two-sided test: P-value = 2P(T > |tobs|)
• One-sided test: P-value = P(T > |tobs|)

Conclusion
• Reject H0 if P-value < α
• Fail to reject H0 if P-value > α

55 / 113
Example
If a random sample of 12 homes included in a planned
study indicates that vacuum cleaners use an average of 42
kilowatt hours per year with a standard deviation of 11.9
kilowatt hours. Does this suggest at the .05 level of
significance that vacuum cleaners use, on average, less
than 46 kilowatt hours annually?
Assume the population of kilowatt hours to be normal.

56 / 113
Solution
• Parameter of interest: average kwh that vacuum
cleaners use µ
• H0 : µ = 46, H1 : µ < 46
• Given n = 12, x̄ = 42, s = 11.9
• T-test
x̄ − µ0 42 − 46
tobs = √ = √ = −1.16
s/ n 11.9/ 12
57 / 113
Draw conclusion with Critical value - rejection region
tn – 1

–tα , n – 1 0 T0

• α = 5% ⇒ tα,n−1 = t.05,11 = 1.796


• tobs > −tα,n−1: fail to reject H0
58 / 113
Find tα,n−1 = t.05,11 = 1.796

59 / 113
Draw conclusion with P- value

• P-value = P(T > |tobs|) = P(T > 1.16) = .135


• Level of significance α = .05
• P-value > α
• Decision: fail to reject H0 and conclude that the
average number of kilowatt hours used annually by
home vacuum cleaners is not significantly less than
46.
60 / 113
Find P-value = P(T > |tobs|) = P(T > 1.16) = .135 (=
tdist(1.16, 11, 1) in Excel)

61 / 113
Example
A public health official claims that the mean home water
use is 350 gallons a day. 20 randomly selected homes was
investigated with the average daily water uses as follows:

62 / 113
Do the data contradict the claim with level of significant
α = 1%? Assume that the population has normal
distribution.

63 / 113
Solution
• Parameter of interest: mean home water use µ
• Hypothesis H0 : µ = 350, H1 : µ ̸= 350
• x̄ = 353.8, s = 21.8478, n = 20
• T-test
x̄ − µ0 353.8 − 350
tobs = √ = 21.8478
= .7778
s/ n 20

64 / 113
• Critical value for two - sided test tα/2,n−1 =???
(look up table value of t-distribution with 19 degree
of freedom)
• Conclusion??

65 / 113
Practice
A medical investigation claims that the average number
of infections per week at a hospital in southwestern
Pennsylvania is 16.3. A random sample of 10 weeks had
a mean number of 17.7 infections. The sample standard
deviation is 1.8. Is there enough evidence to reject the
investigator’s claim at α = 0.05? Suppose that
population has normal distribution

66 / 113
Test for population mean - z - test or t-test

X̄ − µ0
X̄ − µ0 T= √
Z= √ S/ n
σ/ n
normal population 67 / 113
Test for variance σ2 of normal
population
H0 : σ 2 = σ02
vs
• H1 : σ 2 ̸= σ02 (Two-sided test)
• H1 : σ 2 > σ02 (Upper tail test)
• H1 : σ 2 < σ02 (Lower tail test)
68 / 113
χ2 - test
normal population

If H0 : σ 2 = σ02 is true then test statistic

2 (n − 1)S2
χ = 2
∼ χ2n−1
σ0
distribution with n − 1 degree of freedom

(n−1)s2
Observed value of χ2 computed from data χ2obs = σ02
69 / 113
Conclusion with critical value(s)
Reject H0 if χ2obs is in the reject region
f (x) f (x) f (x)
2 2 2
n–1 n–1 n–1

α /2 α
α /2 α

0 2 2 x 0 2 x 0 2 x
1 – α /2, n – 1 α /2, n – 1 α, n – 1 1 – α, n – 1

χ2obs < χ21−α ,n−1


2 χ2obs > χ2α,n−1 χ2obs < χ21−α,n−1
or χ2obs > χ2α ,n−1
2
Two - sided test Upper - tail test Lower - tail test
70 / 113
Example
A manufacturer of car batteries claims that the life of the
company’s batteries is approximately normally
distributed with a standard deviation equal to 0.9 year.If a
random sample of 10 of these batteries has a standard
deviation of 1.2 years, do you think that σ > 0.9 year?
Use a 0.05 level of significance.

71 / 113
Solution
• Hypothesis H0 : σ 2 = 0.92 = 0.81 vs
H1 : σ 2 > 0.81
• n = 10, s = 1.2 or s2 = 1.22 = 1.44, σ02 = 0.81
• χ2 - test value
(n − 1)s2
χ2obs = = 16.0
σ02

72 / 113
Draw conclusion with Critical value - rejection region

• Critical value for upper


tail test
α = .05 ⇒ χ2α,n−1 =
χ20.05,9 = 16.916
v =9

• χ2obs < χ2.05,9 ⇒ accept


H0. There is not 0
0.05
16.919
χ
2

enough evidence that


σ > 0.9
73 / 113
Find χ2.05,9 = 16.916

74 / 113
Practice
A machine that automatically controls the amount of
ribbon on a tape has recently been installed. This
machine will be judged to be effective if the standard
deviation σ of the amount of ribbon on a tape is no
greater than .15 cm. If a sample of 20 tapes yields a
sample variance of s2 = .025 cm2, are we justified in
concluding that the machine is ineffective? Use a 0.05
level of significance.
75 / 113
Test for population
proportion

76 / 113
Problem
H 0 : p = p0
vs
H1 : p ̸= p0
H1 : p < p0
H1 : p > p0
For one-sided test, the null hypothesis can be p ≥ p0 or
p ≤ p0
77 / 113
Z-test for large sample size
If p = p0 is true then the number of success in the sample
X ∼ Bin(n, p0) is approximated by N (np0, np0(1 − p0)).
Z-test

X − np0(1 − p0)) P̂ − p0
Z= p =q ∼ N (0, 1)
np0(1 − p0) p0 (1−p0 )
n

with observed value zobs = q p̂−p0 where p̂ = x


is the
p0 (1−p0 ) n
n
78 / 113
Conclusion with Critical value(s)
Two-tailed test Upper-tailed test Lower-tailed test
N(0,1) N(0,1) N(0,1)
Critical region Critical region Critical region

α /2 Acceptance α /2 Acceptance α α Acceptance


region region region
–zα /2 0 zα /2 Z0 0 zα –zα 0 Z
(a) (b) (c)

Reject H0 if zobs is in the reject (critical) region

|zobs| > z α2 |zobs| > zα

Two - sided test One - sided test 79 / 113


Conclusion with P-value

• Two-sided test: P-value = 2P(Z > |z0|)


• One-sided test: P-value = P(Z > |z0|)

Reject H0at level of significance α if Pvalue < α

80 / 113
Example
A commonly prescribed drug for relieving nervous
tension is believed to be only 60% effective.
Experimental results with a new drug administered to a
random sample of 100 adults who were suffering from
nervous tension show that 70 received relief. Is this
sufficient evidence to conclude that the new drug is
superior to the one commonly prescribed? Use a 0.05
level of significance
81 / 113
Solution
• Problem statement
H0 : p = 0.6 vs H1 : p > 0.6
• Given: n = 100, x = 70, p̂ = 70
100 = 0.7.
• Test statistic

0.7 − 0.6
zobs = q = 2.04
(0.6)(1−0.6)
100
82 / 113
• with α = 0.5 and lower tail-test, the critical value
zα = 1.65
• Conclusion: |zobs| > zα implies to reject H0 at 5%,
that is the new drug is superior

83 / 113
Practice
According to the U.S. Bureau of the Census, 25.5 percent
of the population of those age 18 or over smoked in 1990.
A scientist has recently claimed that this percentage has
since increased, and to prove her claim she randomly
sampled 500 individuals from this population. If 138 of
them were smokers, is her claim proved? Use the 5
percent level of significance.

84 / 113
Table of contents
1 Statistical Hypotheses: General Concepts

2 Testing a Statistical Hypothesis

3 Single Sample

4 Two samples

85 / 113
Comparison means of two populations -
Known variances

Sample 1 Sample 2 Sample 1 Sample 2


– – – –
X1 X2 X1 X2

Population Population 1 Population 2


m1 = m2 m1 m2

(a) Difference is not significant (b) Difference is significant


86 / 113
Comparison problem

• Distribution of two population are N(µX , σX2 ), and


N(µY , σY2 ) or large sample sizes
• Know σX , σX , don’t know µX , µY
• Want to compare µX and µY

87 / 113
Problem statement
H0 : µX − µY = d0
vs
H1 :µX − µY =
̸ d0 two -sided test
H1 :µX − µY > d0 upper - tail test
H1 :µX − µY < d0 lower - tail test

88 / 113
Sampling Distribution
• Sample mean X̄ population 1 is used to estimate µX
• Sample mean X̄ population 2 is used to estimate µY
• X̄ − Ȳ is an estimator for µX − µY
• If both population have normal distributions
N(µX , σX2 ), and N(µY , σY2 ) or large sample sizes
σX2 σY2
then X̄ − Ȳ ∼ N(µX − µY , + ) given H0 is true
nX nY
89 / 113
z- test
two normal populations and variance known

If H0 : µX − µY = d0 is true then
Test statistics is Z-test
X̄ − Ȳ − d0
Z= q ∼ N(0, 1)
σx2 σY2
nX + nY

90 / 113
P-value
• Two-sided test: P-value = 2P(Z > |zobs|)
• One-sided test: P-value = P(Z > |zobs|)

where zobs is the value of Z computed from data


x̄ − ȳ − d0
zobs = q
σx2 σy2
nX + nY

91 / 113
Critical value - Reject region
Two-tailed test Upper-tailed test Lower-tailed test
N(0,1) N(0,1) N(0,1)
Critical region Critical region Critical region

α /2 Acceptance α /2 Acceptance α α Acceptance


region region region
–zα /2 0 zα /2 Z0 0 zα –zα 0 Z
(a) (b) (c)
Reject H0 if

|zobs| > z α2 |zobs| > zα

Two - sided test One - sided test


92 / 113
Example
A company produces a sample of 10 tires using method 1
and a sample of 8 using method 2. They want to show
that there is no difference in the average life time of tires.
The first tire set is tested at location A where the standard
deviation is known to be 4000 km, and second set is
tested at location B where sd is 6000. What conclusion
can be drawn with 5% level of significance from the
following data? Suppose that both populations have
normal distributions.
93 / 113
94 / 113
Solution
• H0 : µA = µB vs H1 : µA ̸= µB
• nA = 10, x̄A = 61.65, σA = 4000
• nB = 8, x̄B = 60.025, σB = 6000
• Z-test
x̄A − x̄B
zobs = q 2 = .066
σA σB2
nA + nB

95 / 113
• Critical value?
• Rejection region?
• Conclusion?

96 / 113
Practice
A real estate agent compares the selling prices of homes
in two municipalities in southwestern Pennsylvania to see
if there is a difference. Is there enough evidence to reject
the claim that the average cost of a home in both
locations is the same? Use α = 0.01.
Scott Lionier
x̄1 = $93, 430 x̄2 = $98, 043
σ1 = $5, 602 σ2 = $4732
n1 = 35 n2 = 40
97 / 113
Comparison means of two population -
Unknown variance

98 / 113
Comparison problem

• Distribution of two population are N(µX , σX2 ), and


N(µY , σY2 ) or large sample sizes
• Don’t know σX , σX
• Want to compare µX and µY

99 / 113
Problem statement
H0 : µX − µY = d0
vs
H1 :µX − µY =
̸ d0 two -sided test
H1 :µX − µY > d0 upper - tail test
H1 :µX − µY < d0 lower - tail test

100 / 113
T- test
two normal populations and unknown variances but equal
If H0 : µX − µY = d0 is true then
Test statistics is T-test
X̄ − Ȳ − d0
T= q ∼ T(nx + ny − 2)
Sx2 Sy2
nX + nY

(Xi −X̄)2 (Yi −Ȳ)2


P P
Sx2
where = nx −1 , = Sy2 ny −1 are sample
variances of two samples
101 / 113
Pooled estimator for common
variance σx2 = σy2 = σ2

(nx − 1)Sx2 + (ny − 1)Sy2


Sp2 =
nx + ny − 2

102 / 113
T-test with pooled estimator
X̄ − Ȳ − d0
T=r   ∼ T(nx + ny − 2)
Sp2 n1x + n1y

with
x̄ − ȳ − d0
tobs = r   ∼ T(nx + ny − 2)
s2p n1x + n1y

103 / 113
Conclusion with Critical value
tn – 1 tn – 1 tn – 1

α /2 α /2 α α

–tα /2, n – 1 0 tα /2, n – 1 0 tα , n – 1 –tα , n – 1 0 T0


(a) (b) (c)

Reject H0 if tobs is in the reject (critical) region

|tobs| > t α2 ,n−1 |tobs| > tα,n−1

Two - sided test One - sided test 104 / 113


Conclusion with P-value
• Two-sided test: P-value = 2P(T > |tobs|)
• One-sided test: P-value = P(T > |tobs|)

Conclusion
• Reject H0 if P-value < α
• Fail to reject H0 if P-value > α

105 / 113
Example
Duration for treatment cold

106 / 113
Do the data listed prove that taking 4 grams daily of
vitamin C reduces the mean length of time a cold lasts?
Use α = 5%.
Assume normal populations, equal population variances.

107 / 113
Solution
Test

H0 : µc − µp ≥ 0 vs H1 : µcµp < 0 lower-tail test

where µc is the mean time a cold lasts when the vitamin


C tablets are taken and µp is the mean time when the
placebo is taken.

108 / 113
Given nx = 10, ny = 12, x̄ = 6.450, ȳ = 7.125,
s2x = 0.581, s2y = 0.778. We have

(10 − 1)s2x + (12 − 1)s2y


s2p = = 0.689
10 + 12 − 2
The value of the test statistic is
x̄ − ȳ 6.450 − 7.125
tobs = r   = q
1 1
 = −1.90
s2p n1x + n1y 0.689 10 + 12

109 / 113
|tobs| = 1.90 > t0.5,20 = 1.725
Conclusion: Reject H0 at 5% level of significance. That
is, at the 5% level of significance the evidence is
significant in establishing that vitamin C reduces the
mean time that a cold persists

110 / 113
Practice

111 / 113
Z- test
two normal populations and unknown and unequal

variances but large sample sizes


If H0 : µX − µY = d0 is true then Test statistics is Z-test
X̄ − Ȳ − d0
Z= q ∼ N (0, 1)
Sx2 Sy2
nX + nY

(Xi −X̄)2 (Yi −Ȳ)2


P P
where Sx2 = nx −1 , Sy2 = ny −1
112 / 113
Practice
Sample weights (in pounds) of newborn babies born in
two adjacent counties in Western Pennsylvania yielded
the following data.

nx = 53, x̄ = 6.8, s2x = 5.2


ny = 44, ȳ = 7.2, s2y = 4.9

Consider a test of the hypothesis that the mean weight of


newborns is the same in both counties. Use α = 5%
113 / 113

You might also like