You are on page 1of 37

Testing of Statistical Hypothesis

(Two Samples Tests)

• Statistical Hypothesis testing of difference


of means
• Statistical Hypothesis testing of difference
of proportions
• Statistical Hypothesis testing of difference
of variances

QAM – II by Gaurav Garg (IIM Lucknow)


• In the last chapter, we had one sample from a
population.
• On the basis of that sample we examined the
validity of hypothetical statements about
unknown population parameters (mean,
proportion, variance)
• Now, using two samples, we compare
 Two population means
 Two population proportions
 Two population variances

QAM – II by Gaurav Garg (IIM Lucknow)


Comparing Two Means

• Example:
• In a survey of buying habits, 400 women shoppers are
chosen at random in a super market ‘A’.
• Their average weekly food expenditure is Rs. 250 with a
s.d. of Rs. 40.
• For 400 women shoppers chosen at random in some other
super market ‘B’ , the average weekly food expenditure is
Rs. 220 with a s.d. of Rs. 55.
• Do these two populations have similar shopping habits.
• Are the average weekly food expenditure of two
populations of shoppers equal.
QAM – II by Gaurav Garg (IIM Lucknow)
• Notations:
Population Population Sample size Sample mean Sample
Mean Standard Standard
Deviation Deviation
First
Second

• To test:
 H0: μ1 = μ2 H1: μ1 ≠ μ2
 H0: μ1 = μ2 H1: μ1 > μ2
 H0: μ1 = μ2 H1: μ1 < μ2 (LTT)
 H0: μ2= μ1 H1: μ2 > μ1 (RTT)
QAM – II by Gaurav Garg (IIM Lucknow)
H0: μ1 = μ2 , H1: μ1 ≠ μ2 H0: μ1 = μ2 , H1: μ1 > μ2 H0: μ1 = μ2 , H1: μ1 < μ2

σ1, σ2 known σ1, σ2 Unknown

n1, n2 small n1, n2 large n1, n2 small n1, n2 large


Both Populations Any Distributions Both Populations
Normal Normal Any Distributions

Method 1: Z test for two Method 2: Z test for two


independent samples independent samples

• Method 3: t test for two independent samples assuming equal variances


• Method 4: t test for two independent samples assuming unequal variances
• Method 5: paired t test
QAM – II by Gaurav Garg (IIM Lucknow)
• Method 1: Z test for two independent samples
• Assumptions:
 σ1 and σ2 both are known
 Both populations are normal.
 Or, sample sizes n1 and n2 are large.
• Test Statistic:

• Use N(0,1) to obtain critical value/ p-value.

QAM – II by Gaurav Garg (IIM Lucknow)


• Background of formula of test statistic:
 We know ) and )
 Samples are independent, therefore

 Or,
 Under Null hypothesis:

QAM – II by Gaurav Garg (IIM Lucknow)


• Method 2: Z test for two independent samples
• Assumptions:
 σ1 and σ2 both are unknown
 sample sizes n1 and n2 are large.
• Test Statistic:

• Use N(0,1) to obtain critical value/ p-value.

QAM – II by Gaurav Garg (IIM Lucknow)


• Example: In a survey of buying habits, 400
women shoppers are chosen at random in a
super market ‘A’.
• Their average weekly food expenditure is Rs. 250
with a s.d. of Rs. 40.
• For 400 women shoppers chosen at random in
some other super market ‘B’ , the average weekly
food expenditure is Rs. 220 with a s.d. of Rs. 55.
• Test at 1% level, if the average weekly food
expenditure of two populations of shoppers are
equal.
QAM – II by Gaurav Garg (IIM Lucknow)
• Method 3: t test for two independent samples assuming equal
variances
• Assumptions:
 σ1 and σ2 both are unknown
 sample sizes n1 and n2 are small
 Both populations are normal
 Unknown σ1 and σ2 are assumed to be equal
• Test Statistic: ,

• where

• Use distribution for critical value/ p-value.


QAM – II by Gaurav Garg (IIM Lucknow)
Example:
• You are a financial analyst for a brokerage firm. Is
there a difference in dividend yield between stocks
listed on the NYSE & NASDAQ? You collect the
following data:
NYSE NASDAQ
Number 21 25
Sample mean 3.27 2.53
Sample std dev 1.30 1.16
• Assuming both populations are approximately normal
with equal variances, is there a difference in average
yield ( = 0.05)?
• Tc =2.040
QAM – II by Gaurav Garg (IIM Lucknow)
• H0: μ1 = μ2 H1: μ1 ≠ μ2
•  = 0.05
• df = 21 + 25 - 2 = 44
• Critical Values: t = 2.0154
• Test Statistic: 2.040 Reject H0 Reject H0

.025 .025

-2.0154 0 2.0154 t
2.040

• Decision: Reject H0 at α = 0.05


• Conclusion: There is evidence of a difference in the means.

QAM – II by Gaurav Garg (IIM Lucknow)


Examples:
• Below are given the gain in weights (in lbs) of pigs fed on two diets
A and B.
A: 25, 32, 30, 34, 24, 14, 32, 24, 30, 31, 35, 25
B: 44, 34, 22, 10, 47, 31, 40, 30, 32, 35, 18, 21, 35, 29, 22
• Test if the two diets differ significantly as regards their effect on
increase in weight.
• Samples of two types of electric bulbs were tested for length of life
and following data were obtained:
Type A Type B
Sample size 8 7
Sample mean 1234Hrs 1036 Hrs
Sample s.d. 36 Hrs 40 Hrs
• Is the difference in the means sufficient to warrant that type A is
superior to type B regarding length of life.
QAM – II by Gaurav Garg (IIM Lucknow)
• Method 4: t test for two independent samples assuming
unequal variances
• Assumptions:
 σ1 and σ2 both are unknown
 sample sizes n1 and n2 are small
 Both populations are normal
 Unknown σ1 and σ2 are assumed to be unequal
• Test Statistic: ,
• Use distribution for critical value/ p-value,
• Where

QAM – II by Gaurav Garg (IIM Lucknow)


• Method 5: paired t test
• Assumptions:
 Observations are paired
 Both populations are normal
• Test Statistic:
• Where
 n is the number of pairs in the sample
 and are mean and standard deviation of differences
d = x1 – x2
• Use distribution for critical value/ p-value,

QAM – II by Gaurav Garg (IIM Lucknow)


• Example:
• Assume you send your salespeople to a “customer
service” training workshop.
• Has the training made a difference in the number of
complaints?
• You collect the following data:
Salesperson Number of Complaints Difference, di
Before (1) After (2) (2-1)

C.B. 6 4 -2
T.F. 20 6 -14
M.H. 3 2 -1
R.K. 0 0 0
M.O 4 0 -4
QAM – II by Gaurav Garg (IIM Lucknow)
• To test H0: μ1 = μ2 H1: μ1 ≠ μ2
d  4.2
Tc    1.66
sd / n 5.67 / 5
• At 10 % level and 4 d.f., Critical Value = -/+ 2.132

Reject Reject

/2 /2

• Decision: Do not reject H0


- 2.132 2.132

• Conclusion: There is no evidence


- 1.66
of a significant change
in the number of complaints

QAM – II by Gaurav Garg (IIM Lucknow)


Example: A certain stimulus administered to each of
the 12 patients resulted in the following increase of
blood pressure:
5, 2, 8, -1, 3, 0, -2, 1, 5, 0, 4, and 6
• Can it be concluded that the stimulus will, in general,
be accompanied by an increase in blood pressure?
• Example: An IQ test was given to 5 persons before
and after they were trained.
Candidates I II III IV V
IQ before training 110 120 123 132 125
IQ after training 120 118 125 136 121
• Test whether there is any improvement in IQ after
the training program (test at 1% level of significance)
QAM – II by Gaurav Garg (IIM Lucknow)
Testing the Hypothesis for Difference of
Proportions
• Example:
• Random sample of 400 men and 600 women were asked
whether they would like to have a flyover near their
residence.
• 200 men and 325 women were in favor of the proposal.
• Is the opinion of men and women the same, in general,
on this issue?
• Is the proportion of men favoring the proposal is more
than that of women?
• Is the proportion of women favoring the proposal is
more than that of men?
QAM – II by Gaurav Garg (IIM Lucknow)
• Notations:
Population proportion Sample size Sample proportion
First
Second

• To test:
• H0: 𝝅1 = 𝝅2 H1: 𝝅1 ≠ 𝝅2
• H0: 𝝅1 = 𝝅2 H1: 𝝅1 > 𝝅2
• H0: 𝝅1 = 𝝅2 H1: 𝝅1 < 𝝅2

• Assumption: Large samples (n1, n2 ≥ 30)

• Test Statistic: , where

• Use N(0,1) to obtain critical value/ p-value.


QAM – II by Gaurav Garg (IIM Lucknow)
• Background of the formula of Test Statistic:
• and
• Since, two samples are independent,
• , or
• .
• Under H0: 𝝅1 = 𝝅2 (= 𝝅, say)
• Thus, .

QAM – II by Gaurav Garg (IIM Lucknow)


• In most of the problems, 𝝅 is not known,
• we use the estimate of 𝝅, given by
n1 p1  n2 p2
ˆ 
n1  n2

• For large samples, Zc~N(0,1)


• Example: Consider the flyover’s example.
• n1=400 x1 =200 n2=600 x2=325
• Test the hypothesis that proportions of men and women
in favor of the proposal are the same at 5% level.
• Zc= -1.2926
QAM – II by Gaurav Garg (IIM Lucknow)
• Example
• Suppose the Acme Drug Company develops a new drug,
designed to prevent colds.
• The company states that the drug is equally effective for
men and women.
• A sample of 100 women and another sample of 200 men
from a population of 100,000 are taken.
• In the samples, 38% of the women caught a cold; and
51% of the men caught a cold.
• Based on these findings, can we reject the company's
claim that the drug is equally effective for men and
women?
• Use a 0.05 level of significance.
QAM – II by Gaurav Garg (IIM Lucknow)
• Example:
• Suppose the previous example is stated a little bit differently.
• Suppose the Acme Drug Company develops a new drug,
designed to prevent colds.
• The company states that the drug is more effective for
women than for men.
• A sample of 100 women and 200 men from a population of
100,000 volunteers.
• At the end of the study, 38% of the women caught a cold; and
51% of the men caught a cold.
• Based on these findings, can we conclude that the drug is
more effective for women than for men?
• Use a 0.05 level of significance.

QAM – II by Gaurav Garg (IIM Lucknow)


Testing the Hypothesis for Difference of
Variances
• Example:
• You are a financial analyst for a brokerage firm.
• You want to compare dividend yields between stocks listed on
the NYSE & NASDAQ.
• You collect the following data:
• NYSE NASDAQ
• Number 21 25
• Mean 3.27 2.53
• Std dev 1.30 1.16

• Is there a difference in the variances between the NYSE &


NASDAQ at 0.05 level?
QAM – II by Gaurav Garg (IIM Lucknow)
• Notations:
Population Variance Sample size Sample Variance
First
Second

• To test:
• H0: σ12 = σ22 H1: σ12 ≠ σ22
• H0: σ12 = σ22 H1: σ12 > σ22
• H0: σ12 = σ22 H1: σ12 < σ22

• Assumptions: both populations are normal.


• Test Statistic:
• For critical values, use Snedecor’s F distribution with degree of
freedom .

QAM – II by Gaurav Garg (IIM Lucknow)


• Background of the formula of Test Statistic (F distribution):

• If and independently, then

• For normally distributed populations,


• and

• Since the two samples are independent,

• Under H0: σ12 = σ22


• Thus, .

QAM – II by Gaurav Garg (IIM Lucknow)


• For two tail test (H0: σ12 = σ22 H1: σ12 ≠ σ22 ):
Critical Region
(α/2)
Critical Region
(α/2)
Acceptance Region
(1-α)

0
Reject H0 Accept H0 Reject H0
F(1 / 2 ) F( / 2 )

• This distribution is not symmetric.


Fc the
• Area after  Fpoint or in subscript.
( / 2 )is mentioned Fc  F(1 / 2)
• We reject H0 in the favor of H1 at α x100% level, if
QAM – II by Gaurav Garg (IIM Lucknow)
• For right tail test (H0: σ12 = σ22 H1: σ12 > σ22 ):

Critical Region
(α)
Acceptance Region
(1-α)

0
Accept H0 Reject H0
F( )

Fc  F( )
• We reject H0 in the favor of H1 at α x100% level, if
QAM – II by Gaurav Garg (IIM Lucknow)
• For left tail test (H0: σ12 = σ22 H1: σ12 < σ22 ):

Critical Region
(α)

Acceptance Region
(1-α)

0
Reject H0 F(1 ) Accept H0

Fc  F(1 )
• We reject H0 in the favor of H1 at α x100% level, if
QAM – II by Gaurav Garg (IIM Lucknow)
• The F critical value is found from the F table
• There are two appropriate degrees of freedom:
 numerator and denominator.
• In the F table,
 numerator degrees of freedom determine the column
(denoted as n1 or ν1 usually)
 denominator degrees of freedom determine the row
(denoted as n2 or ν2 usually)
 Note that
1
F(1 ) [At d.f. ( 1 , 2 ) ] 
F( ) [At d.f. ( 2 , 1 ) ]
QAM – II by Gaurav Garg (IIM Lucknow)
• Example: NYSE NASDAQ
• Number 21 25
• Mean 3.27 2.53
• Std dev 1.30 1.16
• We wish to test at 5% level of significance:
• H0: σ12 = σ22 Against H1: σ12 ≠ σ22
• Test Statistic: s 2 ( NYSE)
1 1.30 2
Fc  2
 2
 1.256
s ( NASDAQ)
1 1.16
• Critical Values at (20, 24) d.f.
• Upper Value = FU = F(0.025) [at d.f (20, 24)] = 2.33
• Lower Value = FL = F(0.975) [at d.f (20, 24)]
• = 1/F(0.025) [at d.f (24, 20)] = 1/2.41 = 0.41

QAM – II by Gaurav Garg (IIM Lucknow)


Fc  1.256
/2 = .025 /2 = .025

0 F
Reject H0 Accept H0 Reject H0
FU=2.33
FL=0.41

• Fc = 1.256 is not in the rejection region,


• so we do not reject H0
• Conclusion: There is insufficient evidence of a
difference in variances at  = .05
QAM – II by Gaurav Garg (IIM Lucknow)
• Tamara Hill, fund manager of the Hill Value Fund,
manages a portfolio of 250 common stocks.
• Tamara is searching for a 'low risk' issue to add to the
portfolio, i.e., one with a price variance less than that of
the S&P 500 index.
• Her staff reported that
 during the last nine quarters the price variance for the S&P
500 index (population 1) was 25, and
 for the last seven quarters the price variance for XYC common
(population 2) was 8.
• Assume that stock prices are normally distributed in the
population.
• Can it be concluded that price variance for XYC common
is mostly smaller?
QAM – II by Gaurav Garg (IIM Lucknow)
• Collinsville Construction Company purchases steel rods for its
projects.
• Based on previous tests, Claude Carter, Quality Assurance Manager,
has recommended purchasing rods from Redding Rods, Inc.
(population 1), rather than Stockton Steel (population 2), since
Redding's rods had less variability in length.
• Recently, Stockton revised it rod shearing operation, and Claude
has sampled the outputs from Redding's and Stockton's rod
manufacturing processes.
• The results for Redding were: sample variance = 0.10, sample size =
8, and,
• for Stockton, the results were sample variance = 0.05, sample size =
10.
• Do the two variances differ significantly?
• Assume that rod lengths are normally distributed in the population.

QAM – II by Gaurav Garg (IIM Lucknow)


Summary: Testing the Hypothesis for Difference of Means
1. Z test for two independent samples
2. Z test for two independent samples
3. t test for two independent samples assuming equal variances
, where
4. t test for two independent samples assuming unequal variances
, Where
5. paired t test

QAM – II by Gaurav Garg (IIM Lucknow)


Summary
• Testing the Hypothesis for Difference of Proportions
• , where

• Testing the Hypothesis for Difference of Variances

QAM – II by Gaurav Garg (IIM Lucknow)

You might also like