You are on page 1of 31

Test of Hypothesis

M. Shafiqur Rahman

Institute of Statistical Research and Training


University of Dhaka

October, 2019

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 1 / 30
Outline of the lecture

Outline

1 Test of hypothesis: concept and definition


2 Test for single population mean

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 2 / 30
Test of hypothesis: concept and definition

Test of hypothesis: definition


A test of hypotheses or significance test is a procedure designed to
assess the evidence provided by the data in favor of some statement.
Based on:
The null hypothesis, H0 - statement of no effect.
The alternative hypothesis, Ha (or H1 ) - what the experimenter would
like to support.

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 3 / 30
Test of hypothesis: concept and definition

Test of hypothesis: Examples

Each of the following situations requires a significance test about a


population mean. State the appropriate null hypothesis (H0 ) and
alternative hypothesis (Ha ) in each case:
(a) The mean area of the several thousand apartments in a new
development is advertised to be 1250 square feet. A tenant group
thinks that the apartments are smaller than advertised. They hire an
engineer to measure a sample of apartments to test their suspicion
H0 :
Ha :

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 4 / 30
Test of hypothesis: concept and definition

Test of hypothesis: Examples

(b) Larry’s car consume on average 32 miles per gallon on the highway.
He now switches to a new motor oil that is advertised as increasing
gas mileage. After driving 3000 highway miles with the new oil, he
wants to determine if his gas mileage actually has increased.
H0 :
Ha :

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 5 / 30
Test of hypothesis: concept and definition

Test of hypothesis: Examples

(b) Larry’s car consume on average 32 miles per gallon on the highway.
He now switches to a new motor oil that is advertised as increasing
gas mileage. After driving 3000 highway miles with the new oil, he
wants to determine if his gas mileage actually has increased.
H0 :
Ha :
(c) The diameter of a spindle in a small motor is supposed to be 5
millimeters. If the spindle is either too small or too large, the motor
will not perform properly. The manufacturer measures the diameter in
a sample of motors to determine whether the mean diameter has
moved away from the target.
H0 :
Ha :

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 5 / 30
Test of hypothesis: concept and definition

Basic Steps in hypothesis test

1 Determine null (H0 ) and alternative Ha hypothesis


Hypothesis is statement ABOUT population parameter NOT ABOUT
sample statistic
2 Verify necessary data conditions (assumption), and if met, summarize
the data into an appropriate test statistics (using appropriate data
summary, or sample statistic)
3 Assuming the null (H0 ) hypothesis is true, find either rejection region
(critical value) or the p-value or confidence interval.
4 Decide whether H0 is rejected or not based on either rejection region
or the p-value or confidence interval.
5 Report the conclusion in the context of the problem (question of
interest).

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 6 / 30
Test of hypothesis: concept and definition

Test of hypothesis: some definitions

The test statistic:


is a summary of the data that is used to help make the decision,
is a random variable having a known probability distribution (under
the null hypothesis, H0 )
is examined for evidence for or against H0 .
p-value: is the probability of getting a test statistic as extreme or more
extreme (in the direction of Ha ) than the observed value of the test
statistic, assuming the null hypothesis(H0 ) is true. If p-value< α we reject
H0 .

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 7 / 30
Test of hypothesis: concept and definition

Test of hypothesis: decision and error

True scenario
H0 is true H0 is false
Reject H0 Type I error correct decision
Decision
Failed to reject H0 correct decision Type II error

Type I error: occurs when the decision made is to reject the true null
hypothesis
Type II error: occurs when the decision made is failed to reject the
false null hypothesis
Pr(Type I error)=α= level of significance, usually we fixed it at 1% or
5%
Pr(Type II error)=β
Power= Pr(rejecting false H0 )=1-β

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 8 / 30
Test of hypothesis: concept and definition

Test for single population mean: population variance is


known

Let us consider a random sample of n observations x1 , x2 , . . . , xn from


Normally distributed population with mean µ and known variance σ 2 . We
want to test hypothesis

H0 : µ = µ0 against Ha : µ > µ0 (right tailed test)


Pn
xi
With the sample mean x̄ = i=1 and assuming H0 true
n
x̄ − µ0 x̄ − µ0
the test statistic Z= = √ ∼ N(0, 1).
SE (x̄) σ/ n

Critical value at α level of significance=Zα


Decision rule: if Z > Zα we reject H0 .

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 9 / 30
Test of hypothesis: concept and definition

Test for single population mean: population variance is


known

Decision rule: alternatively

we reject H0 if Z > Zα which implies


x̄ − µ0
⇒ √ > Zα
σ/ n
...
reject H0 if x̄ > µ0 + Zα √σn

Decision based on p-value: if p-value=Pr (Zα > Z ) < α we reject H0 .


Decision based on CI: if 100(1 − α)% CI for µ (x̄ ± Zα √σn ) does not
include the hypothesized value µ0 we reject H0 .

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 10 / 30
Test of hypothesis: concept and definition

Test for single population mean: population variance is


known
For a left tailed test
H0 : µ = µ0 against Ha : µ < µ0

Decision rule: if Z < −Zα we reject H0


Alternatively: we reject H0 if Z < −Zα which implies
x̄ − µ0
⇒ √ < −Zα
σ/ n
...
reject H0 if x̄ < µ0 − Zα √σn

Decision based on p-value: if p-value=Pr (Zα < Z ) < α we reject H0 .


Decision based on CI: if 100(1 − α)% CI for µ (x̄ ± Zα √σn ) does not
include the hypothesized value µ0 we reject H0 .
M. Shafiqur Rahman (Institute of Statistical Research and Test
Training
of Hypothesis
University of Dhaka) October, 2019 11 / 30
Test of hypothesis: concept and definition

Test for single population mean: population variance is


known
For a two tailed test
H0 : µ = µ0 against Ha : µ 6= µ0

Decision rule: if Z > Zα/2 or Z < −Zα/2 we reject H0


Alternatively: we reject H0 if Z > Zα/2 or Z < −Zα/2 which implies
x̄ − µ0 x̄ − µ0
⇒ √ > Zα/2 or √ < −Zα/2
σ/ n σ/ n
...
reject H0 if x̄ > µ0 + Zα/2 √σn or x̄ < µ0 − Zα/2 √σn

Decision based on p-value: if p-value=2Pr (Zα/2 > Z ) < α we reject


H0 .
Decision based on CI: if 100(1 − α)% CI for µ (x̄ ± Zα/2 √σn ) does not
include the hypothesized value µ0 we reject H0 .
M. Shafiqur Rahman (Institute of Statistical Research and Test
Training
of Hypothesis
University of Dhaka) October, 2019 12 / 30
Test of hypothesis: concept and definition

Example 1

The production manager of Northern Windows, Inc., has asked you to


evaluate a proposed new procedure for producing its Regal line of
double-hung windows. The present process has a mean production of 80
units per hour with a population standard deviation of 8. The manager
does not want to change to a new procedure unless there is strong
evidence that the mean production level is higher with the new process. A
random sample of 25 production hours using the proposed new process
was obtained and the sample mean was computed as x̄ = 83.
Solution:

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 13 / 30
Test of hypothesis: concept and definition

Example 2

When the process is operating properly, the process produces ball bearings
whose weights are normally distributed with a population mean of 5
ounces and a population standard deviation of 0.1 ounce. A new
raw-material supplier was used for a recent production run, and the
manager wants to know if that change has resulted in a lowering of the
mean weight of the ball bearings. The manager will continue to use the
new supplier unless there is strong evidence that underweight ball bearings
are being produced. To solve this problem we obtained a random sample
of n = 16 observations, and the sample mean was 4.962.
Solution:

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 14 / 30
Test of hypothesis: concept and definition

Example 3

The production manager of Circuits Unlimited has asked for your


assistance in analyzing a production process. This process involves drilling
holes whose diameters are normally distributed with a population mean of
2 inches and a population standard deviation of 0.06 inch. A random
sample of nine measurements had a sample mean of 1.95 inches. Use a
significance level of α = 0.05 to determine if the observed sample mean is
unusual and, therefore, that the drilling machine should be adjusted.
Solution:

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 15 / 30
Test of hypothesis: concept and definition

Test for single population mean: population variance is


unknown
In practice population variance σ 2 might be unknown. In this case Z
statistic (which follows standard normal distribution) cannot be used
directly. It is natural in such circumstances to consider the test statistic
obtained by replacing the unknown σ by the sample standard deviation
sP
(xi − x̄)2
s=
n−1

Using the sample mean x̄ and sample standard deviation (s) an alternative
to Z statistic is given by
x̄ − µ
T = √ ∼ tn−1
s/ n

where n − 1 is the degrees of freedom.


M. Shafiqur Rahman (Institute of Statistical Research and Test
Training
of Hypothesis
University of Dhaka) October, 2019 16 / 30
Test of hypothesis: concept and definition

Test for single population mean: population variance is


unknown
For a right tailed test
H0 : µ = µ0 against Ha : µ > µ0

Decision rule: if T > tn−1,α we reject H0


Alternatively: we reject H0 if T > tn−1,α which implies
x̄ − µ0
⇒ √ > tn−1,α
s/ n
...
reject H0 if x̄ > µ0 + tn−1,α √sn

Decision based on p-value: if p-value=Pr (tn−1,α > T ) < α we reject


H0 .
Decision based on CI: if 100(1 − α)% CI for µ (x̄ ± tn−1,α √sn ) does
not include the hypothesized value µ0 we reject H0 .
M. Shafiqur Rahman (Institute of Statistical Research and Test
Training
of Hypothesis
University of Dhaka) October, 2019 17 / 30
Test of hypothesis: concept and definition

Test for single population mean: population variance is


unknown
For a left tailed test
H0 : µ = µ0 against Ha : µ < µ0

Decision rule: if T < −tn−1,α we reject H0


Alternatively: we reject H0 if T < −tn−1,α which implies
x̄ − µ0
⇒ √ < −tn−1,α
s/ n
...
reject H0 if x̄ < µ0 − tn−1,α √sn

Decision based on p-value: if p-value=Pr (tn−1,α < T ) < α we reject


H0 .
Decision based on CI: if 100(1 − α)% CI for µ (x̄ ± tn−1,α √sn ) does
not include the hypothesized value µ0 we reject H0 .
M. Shafiqur Rahman (Institute of Statistical Research and Test
Training
of Hypothesis
University of Dhaka) October, 2019 18 / 30
Test of hypothesis: concept and definition

Test for single population mean: population variance is


unknown
For a two tailed test
H0 : µ = µ0 against Ha : µ 6= µ0

Decision rule: if T > tn−1,α/2 or T < −tn−1,α/2 we reject H0


Alternatively: we reject H0 if T > tn−1,α/2 or T < −tn−1,α/2 which implies
x̄ − µ0 x̄ − µ0
⇒ √ > tn−1,α/2 or √ < −tn−1,α/2
s/ n s/ n
...
reject H0 if x̄ > µ0 + tn−1,α/2 √sn or x̄ < µ0 − tn−1,α/2 √sn

Decision based on p-value: if p-value=2Pr (tn−1,α/2 > T ) < α/2 we


reject H0 .
Decision based on CI: if 100(1 − α/2)% CI for µ (x̄ ± tn−1,α/2 √sn )
does not include the hypothesized value µ0 we reject H0 .
M. Shafiqur Rahman (Institute of Statistical Research and Test
Training
of Hypothesis
University of Dhaka) October, 2019 19 / 30
Test of hypothesis: concept and definition

Example 1

Grand Junction Vegetables is a producer of a wide variety of frozen


vegetables. The company president has asked you to determine if the
weekly sales of 16-ounce packages of frozen broccoli has increased. The
mean weekly number of sales per store has been 2,400 packages over the
past 6 months. You have obtained a random sample of sales data from
134 stores for your study, and the sample mean is found to be 3,593 with
standard deviation 4,919.
Solution:

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 20 / 30
Test of hypothesis: concept and definition

Test for a population proportion: large sample

Let us consider a random sample of n observations from a population that


has a proportion P whose members possess a particular attribute.
We would like to test

H0 : P = P0 against Ha : P > P0 right tailed test

If x is number of success then the sample proportion can be calculated as


p̂ = xn . Using the binomial setup the sample proportion p̂ has an
approximate Normal distribution with mean P and variance P(1 − P)/n. If
the sample members is large so that nP0 (1 − P0 ) > 5, then the test
statistic
p̂ − P0 p̂ − P0
Z= =q ∼ N(0, 1)
SE(p̂) Pˆ0 (1−Pˆ0 )
n

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 21 / 30
Test of hypothesis: concept and definition

Test for a population proportion: large sample

Decision rule based on critical value: if Z > Zα we reject H0 .


Decision based on p-value: if p-value=Pr (Zα > Z ) < α we reject H0 .
q
ˆ Pˆ0 )
 
Decision based on CI: if 100(1 − α)% CI for P p̂ ± Zα P0 (1−n
does not include the hypothesized value P0 we reject H0

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 22 / 30
Test of hypothesis: concept and definition

Example 1

Market Research, Inc., wants to know if shoppers are sensitive to the


prices of items sold in a supermarket. A random sample of 802 shoppers
was obtained, and 378 of those supermarket shoppers were able to state
the correct price of an item immediately after putting it into their cart.
Test at the 7% level the null hypothesis that at least one-half of all
shoppers are able to state the correct price.
Solution:

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 23 / 30
Test of hypothesis: concept and definition

Example 2

In a random sample of 361 owners of small businesses that had gone into
bankruptcy, 105 reported conducting no marketing studies prior to opening
the business. Test the hypothesis that at most 25% of all members of this
population conducted no marketing studies before opening their
businesses. Use α = 0.05.
Solution:

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 24 / 30
Test of hypothesis: concept and definition

Test for equality of two population means: matched pair


data
Suppose that we have a random sample of n matched pairs of observations
from distributions with means µx and µy . Let d̄ and sd denote the
observed sample mean and standard deviation for the n differences xi − yi .
We would like to test

H0 : µx = µy vs H0 : µx > µy (right tailed test)

Test statistic

T = √ ∼ tn−1
sd / n

Decision rule: if T > tn−1,α we reject H0


Decision based on CI: if 100(1 − α)% CI for µx − µy

(d̄ ± tn−1,α s/ n) does not include 0 we reject H0 .
M. Shafiqur Rahman (Institute of Statistical Research and Test
Training
of Hypothesis
University of Dhaka) October, 2019 25 / 30
Test of hypothesis: concept and definition

Example

A study was conducted to determine if a new feeding process produces a


significant increase in mean weight of turkeys produced in the facilities of
Turkeys Unlimited LLC. In the process they obtained a random set of
matched turkey chicks hatched from the same hen. One group of chicks is
from the hens fed using the old feeding method and the second group of
chicks is from the same hens fed using the new method. The weights for
each of the turkeys and the differences between the matched pairs are
shown in Table.
The mean differences is 1.489 with standard deviation 0.385.
Solution:

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 26 / 30
Test of hypothesis: concept and definition

Example

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 27 / 30
Test of hypothesis: concept and definition

Test for equality of two population means: independent


sample
Suppose that we have independent random samples of nx and ny
observations from normal distributions with means µx and µy and
variances sx2 and sy2 , respectively.
We would like to test
H0 : µx = µy vs H0 : µx > µy (right tailed test)
Test statistic
x̄ − ȳ
T = q ∼ tnx +ny −2
sp ( n1x + 1
ny )

where x̄=sample mean of X sample and ȳ =sample mean of Y sample and


(nx − 1)sx2 + (ny − 1)sy2
Pooled variance sp2 =
nx + ny − 2

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 28 / 30
Test of hypothesis: concept and definition

Test for equality of two population means: independent


sample

Decision rule: if T > tnx +ny −2,α we reject H0


Decision based on CI: if q 100(1 − α)% CI for µx − µy
: (x̄ − ȳ ) ± tnx +ny −2,α sp ( n1x + n1y ) does not include 0 we reject H0 .

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 29 / 30
Test of hypothesis: concept and definition

A sporting goods store operates in a medium-sized shopping mall. In order


to plan staffing levels, the manager has asked for your assistance to
determine if there is strong evidence that Monday sales are higher than
Saturday sales. To answer the question you decide to gather random
samples of 25 Saturdays and 25 Mondays from a population of several
years of data. Results based on sample observations are given below:

x̄M = 1078 sM = 633 nM = 25


ȳS = 908.2 sS = 469.8 nS = 25

where the subscripts M and S refer to Monday and Saturday sales


Solution:

M. Shafiqur Rahman (Institute of Statistical Research and Test


Training
of Hypothesis
University of Dhaka) October, 2019 30 / 30

You might also like