Estadística II Chapter 3: Comparison of two populations

28
Chapter 3. Comparing two populations Contents I Hypothesis for the difference between two population means: matched pairs I Hypothesis for the difference between two population means: independent samples I Two normal populations with equal (unknown) variances I Two normal populations with known variances I Two nonnormal populations with unknown variances and large samples I Two Bernoulli populations I Hypothesis for the ratio of two population variances: independent samples

Transcript of Estadística II Chapter 3: Comparison of two populations

Page 1: Estadística II Chapter 3: Comparison of two populations

Chapter 3. Comparing two populations

Contents

I Hypothesis for the difference between two population means:matched pairs

I Hypothesis for the difference between two population means:independent samples

I Two normal populations with equal (unknown) variancesI Two normal populations with known variancesI Two nonnormal populations with unknown variances and large

samplesI Two Bernoulli populations

I Hypothesis for the ratio of two population variances: independentsamples

Page 2: Estadística II Chapter 3: Comparison of two populations

Chapter 3. Comparing two populations

Learning goalsAt the end of this chapter you should be able to:

I Perform a test of hypothesis for the difference between twopopulation means and for the ratio of two population variances

I Construct confidence intervals for the difference/ratio

I Distinguish situations where a test based on matched pairs issuitable from those where a test based on independent samples is

I Calculate the power of a test and the probability of Type II Error

Page 3: Estadística II Chapter 3: Comparison of two populations

Chapter 3. Comparing two populations

ReferencesI Newbold, P. ”Statistics for Business and Economics”

I Chapter 9 (9.6-9.9)

I Ross, S.I Chapter 10

Page 4: Estadística II Chapter 3: Comparison of two populations

Introduction

In this chapter, we examine the case where instead of one randomsample, two random samples are available from two populations, and thequantities of interest are:

I the difference between two population meansI case of matched pairsI case of independent samples

I the ratio between two population variancesI case of independent samples

We will draw on our experience from Chapters 1 and 2 to constructconfidence intervals and perform tests of hypothesis for theabovementioned differences/rations of population parameters.

Page 5: Estadística II Chapter 3: Comparison of two populations

Tests for the difference between two means: matched pairs

Example: In a study aimed at assessing the relationship between asubject’s brain activity while watching a tv commercial and the subject’ssubsequent ability to recall the contents of the commercial, subjects wereshown commercials for two brands of each of ten products. For eachcommercial, the ability to recall 24h later was measured, and eachmember of a pair of commercials was then designated ’high-recall’ or’low-recall’. The table below shows an index of the total amount of brainactivity of subjects while watching these commercials.

product: i 1 2 3 4 5 6 7 8 9 10high-recall: xi 137 135 83 125 47 46 114 157 57 144low-recall: yi 53 114 81 86 34 66 89 113 88 111

diff.: di = xi − yi 84 21 2 39 13 −20 25 44 −31 33

Page 6: Estadística II Chapter 3: Comparison of two populations

Tests for the difference between two means: matched pairs

I Let X be a population with mean µX and Y be a population withmean µY .

I Suppose we have a random sample of n matched pairs ofobservations from these two populations and letd1 = x1 − y1, d2 = x2 − y2, . . . , dn = xn − yn represent n differenceswith mean d and quasi-standard deviation sd . Let assume that thepopulation of differences is normal.

I In a two-tail test H0 : µX − µY = D0 against H1 : µX − µY 6= D0:I The test statistic is

T =D − D0

sD/√

n∼H0 tn−1

I The rejection region is (at significance level α):

RRα = {t : t < −tn−1;α/2 or t > tn−1;α/2}

Page 7: Estadística II Chapter 3: Comparison of two populations

Tests for the difference between two means: matched pairs

Example: cont.Population:D = ”difference between high-and low-recall”D ∼ N(µX − µY , σ

2D)

' SRS: n = 10

Sample: d = 21010 = 21

s2d = 142022−10(21)2

10−1 = 1088

Objective: test

H0 : µX − µY ≤D0︷︸︸︷0 against H1 : µX − µY > 0

(Upper-tail test)

Test statistic: T = D−D0

sD/√

n∼ tn−1

Observed test statistic:

D0 = 0 n = 10

d = 21 sd =√

1088 = 32.98

t =d − D0

sd/√

n

=21

32.98/√

10= 2.014

Page 8: Estadística II Chapter 3: Comparison of two populations

Tests for the difference between two means: matched pairsExample: cont.

p-value = P(T ≥ 2.014)

∈ (0.025, 0.05) because

t9;0.05︷ ︸︸ ︷1.833 < 2.014 <

t9;0.025︷ ︸︸ ︷2.262

Hence, given thatp-value < α = 0.05 we reject thenull hypothesis at this level.

tn−1 density| |

t=2.014

p−value =area

1.833 2.262

Conclusion: The sample data gave enough evidence to support the claimthat on the average, brain activity is higher for the high-recall than forthe low-recall group. If in fact, the mean brain activity were the same forthese two groups, then the probability of finding a sample result asextreme as or more extreme than that actually obtained would bebetween 0.025 and 0.05 (which is rather low).

Page 9: Estadística II Chapter 3: Comparison of two populations

Tests for the difference between two means: matched pairs

Example: cont. in Excel: Go to menu: Data, submenu: Data Analysis,choose function: t-Test Paired Two Sample for Means.Columns A and B (data), in yellow (the observed test statistic andp-value).

Page 10: Estadística II Chapter 3: Comparison of two populations

Two-tail test for the difference between two means via CI:matched pairs

Example: cont. Construct a 95% confidence interval for µX − µY .

CI0.95 (µX − µY ) =

(d − tn−1;0.025

sd√n, d + tn−1;0.025

sd√n

)=

(21− 2.262

32.98√10

, 21 + 2.26232.98√

10

)= (−2.59, 44.59)

Since the value of 0 belongs to this interval, we cannot reject the nullhypothesis of the equality of the two population means at a α = 0.05significance level.

Page 11: Estadística II Chapter 3: Comparison of two populations

Tests for the difference between two means: independentnormal samples, population variances equal

I Let X be a population with mean µX and variance σ2X and Y be a

population with mean µY and variance σ2Y , both normally distributed

with unknown, but equal population variances σ2 = σ2X = σ2

Y .I Suppose we have a random sample of n1 observations from X and

an independent random sample of n2 observations from Y .I In a two-tail test H0 : µX − µY = D0 against H1 : µX − µY 6= D0:

I The test statistic is

T =X − Y − D0

sp

q1n1

+ 1n2

∼H0 tn1+n2−2

where the estimator of the common population variance is

s2p =

(n1 − 1)s2X + (n2 − 1)s2

Y

n1 + n2 − 2

Note: the number of degrees of freedom is n1 + n2 − 2 (the totalnumber of observations from both samples minus two - two dfs arelost to estimate µX and µY )

I The rejection region is (at significance level α):

RRα = {t : t < −tn1+n2−2;α/2 or t > tn1+n2−2;α/2}

Page 12: Estadística II Chapter 3: Comparison of two populations

Tests for the difference between two means: independentnormal samples, population variances equal

Example: 9.8 (Newbold) A study attempted to assess the effect of thepresence of a moderator on the number of ideas generated by a group. Groupsof four members, with or without moderator, were observed. For a randomsample of four groups with a moderator, the mean number of ideas generatedper group was 78.0, and the sample quasi-standard deviation was 24.4. For anindependent sample of four groups without a moderator, the mean number ofideas generated was 63.5, and the sample quasi-standard deviation was 20.2.Assuming that the populations distributions are normal with equal variances,test the null hypothesis (α = 0.1) that the population means are equal againstthe alternative that the true mean is higher for groups with a moderator.Population 1:X = ”number of ideas in groupswith a moderator”X ∼ N(µX , σ

2X )

' SRS: n1 = 4

Sample: x = 78.0sx = 24.4

Population 2:Y = ”number of ideas in groupswithout a moderator”X ∼ N(µY , σ

2Y )

' SRS: n2 = 4

Sample: y = 63.5sy = 20.2

Assume independent normal samples and σ2X = σ2

Y = σ2

Page 13: Estadística II Chapter 3: Comparison of two populations

Tests for the difference between two means: independentnormal samples, population variances equal

Example: 9.8 (Newbold cont.)

Objective: test

H0 : µX − µY =

D0z}|{0

against

H1 : µX − µY > 0

(Upper-tail test)

Test statistic: T = X−Y

sp

r1n1

+ 1n2

∼H0tn1+n2−2

Observed test statistic:

D0 = 0 n1 = 4 n2 = 4

x = 78.0 sx = 24.4 y = 63.5 sy = 20.2

s2p =

(n1 − 1)s2x + (n2 − 1)s2

y

n1 + n2 − 2

=(4 − 1)24.42 + (4 − 1)20.22

4 + 4 − 2

= 501.7

sp =√

501.7 = 22.4

t =x − y

spp

1/n1 + 1/n2

=78.0 − 63.5

22.4p

1/4 + 1/4= 0.915

Rejection region:

RR0.1 = {t : t >

1.440z }| {t6;0.1}

Since t = 0.915 /∈ RR0.1 we cannot reject the null hypothesisat a 10% level.

Conclusion: The sample data didnot contain strong evidencesuggesting that on average, moreideas will be generated by groupswith moderators. However, for suchsmall sample sizes, we cannot expectgreat power in the test so quite largedifferences in the population meanswould be needed to reject the nullhypothesis at low significance levels.

Page 14: Estadística II Chapter 3: Comparison of two populations

Two-tail test for the difference between two means via CI:independent normal samples, population variances equal

Example: 9.8 (Newbold cont.) Construct a 99% confidence interval forµX − µY .

CI0.99 (µX − µY ) =

(x − y ∓ tn1+n2−2;0.005sp

√1

n1+

1

n2

)=

(78.0− 63.5∓ 3.707 · 22.4

√1

4+

1

4

)= (−44.22, 73.22)

Since the value of 0 belongs to this interval, we cannot reject the nullhypothesis of the equality of the two population means at a α = 0.01significance level.

Page 15: Estadística II Chapter 3: Comparison of two populations

Tests for the difference between two means: independentlarge samples or two normal populations with knownvariances

I Let X be a population with mean µX and variance σ2X and Y be a

population with mean µY and variance σ2Y .

I Suppose we have a random sample of n1 observations from X andan independent random sample of n2 observations from Y and:

I Either that both n1 and n2 are large and σ21 and σ2

2 are unknownI Or that X and Y are normally distributed and σ2

1 and σ22 are known

I In a two-tail test H0 : µX − µY = D0 against H1 : µX − µY 6= D0:I The test statistic is:

I Either

Z =X − Y − D0r

s2Xn1

+s2Yn2

∼H0, approx. N(0, 1)

I Or

Z =X − Y − D0r

σ2X

n1+σ2

Yn2

∼H0N(0, 1)

I The rejection region is (at significance level α):

RRα = {z : z < −zα/2 or z > zα/2}

Page 16: Estadística II Chapter 3: Comparison of two populations

Tests for the difference between two means: independentlarge samples or two normal populations with knownvariances

Example: 9.7 (Newbold) A survey of practicing certified public accountants onattitudes to women in the profession was carried out. Survey respondents wereasked to react on a scale from one (strongly disagree) to five (strongly agree)to the statement: ’Women in public accounting are given the same jobassignments as men’. For a sample of 186 male accountants, the meanresponse was 4.059 and the sample quasi-standard deviation was 0.839. For anindependent random sample of 172 female accountants, the mean response was3.680 and the sample quasi-standard deviation was 0.966. Test the nullhypothesis (α = 0.0001) that the two population means are equal against thealternative that the true mean is higher for male accountants.

Population 1:X = ”response of a male accountant”X ∼ µX , σ

2X

' SRS: n1 = 186

Sample: x = 4.059sx = 0.839

Population 2:Y = ”response of a female accountant”X ∼ µY , σ

2Y

' SRS: n2 = 172

Sample: y = 3.680sy = 0.966

Page 17: Estadística II Chapter 3: Comparison of two populations

Tests for the difference between two means: independentlarge samples or two normal populations with knownvariances

Example: 9.7 (Newbold cont.)

Objective: test

H0 : µX − µY =

D0z}|{0

against

H1 : µX − µY > 0

(Upper-tail test)

Test statistic: Z = X−Yss2Xn1

+s2Yn2

∼H0, approx. N(0, 1)

Observed test statistic:

D0 = 0 n1 = 186 n2 = 172

x = 4.059 sx = 0.839 y = 3.680 sy = 0.966

z =x − yq

s2x/n1 + s2

y/n2

=4.059 − 3.680q

0.8392/186 + 0.9662/172

= 3.95

Rejection region:

RR0.0001 = {z : z >

3.75z }| {z0.0001}

Since z = 3.95 ∈ RR0.0001 we reject the null hypothesis at a0.01% level.

Conclusion: The data contains verystrong evidence suggesting that thepopulation mean response is higherfor males than for females - that is,on average, males feel more stronglythan females in the profession thatwomen are given the same jobassignments as men.

Page 18: Estadística II Chapter 3: Comparison of two populations

Tests for the difference between two means: independentlarge samples or two normal populations with knownvariances

Example: 9.7 (Newbold) Construct a 95% confidence interval forµX − µY .

CI0.95 (µX − µY ) =

x − y ∓ z0.025

√s2x

n1+

s2y

n2

=

(4.059− 3.680∓ 1.96

√0.8392/186 + 0.9662/172

)= (0.19, 0.57)

Since the value of 0 does not belong to this interval, we can reject thenull hypothesis of the equality of the two population means at a α = 0.05significance level.

Page 19: Estadística II Chapter 3: Comparison of two populations

Tests for the difference between two proportions:independent large samples

I Let X ∼ Bernoulli(pX ) and let Y ∼ Bernoulli(pY ) where pX and pY

are two population proportions of individuals with a characteristic ofinterest.

I Suppose we have a random sample of n1 observations from X andan independent random sample of n2 observations from Y and thatboth n1 and n2 are large

I In a two-tail test H0 : pX = pY (= p0) against H1 : pX 6= pY :I The test statistic is:

Z =pX − pYr

p0(1− p0)“

1n1

+ 1n2

” ∼H0, approx. N(0, 1),

where

p0 =n1pX + n2pY

n1 + n2

I The rejection region is (at significance level α):

RRα = {z : z < −zα/2 or z > zα/2}

Page 20: Estadística II Chapter 3: Comparison of two populations

Tests for the difference between two proportions:independent large samples

Example: 9.9 (Newbold) In market research, when populations of individuals or households are surveyed by mail questionnaires, it is

important to achieve as high a response rate as possible. One way to improve response might be to include in the questionnaire an initial

’inducement question’, intended to increase the respondent’s interest in completing the questionnaire. Questionnaires containing an

inducement question on the importance of recreation facilities in a city were sent to a sample of 250 households, yielding 101 responses.

Otherwise identical questionnaires, but without the inducement question, were sent to an independent random sample of 250 households,

producing 75 responses. Test the null hypothesis that the two population proportions of responses would be the same against the

alternative that the response rate would be higher when the inducement question is included.

Population 1:X = 1 if a person completes thequestionnaire with the inducementquestion, and 0 otherwiseX ∼ Bernoulli(pX )

' SRS: n1 = 250

Sample: px = 101250

= 0.404

Population 2:Y = 1 if a person completes thequestionnaire without the inducementquestion, and 0 otherwiseY ∼ Bernoulli(pY )

' SRS: n2 = 250

Sample: py = 75250

= 0.300

Page 21: Estadística II Chapter 3: Comparison of two populations

Tests for the difference between two proportions:independent large samples

Example: 9.9 (Newbold cont.)

Objective: test

H0 : pX = pY

against

H1 : pX > pY

(Upper-tail test)

Test statistic:

Z =pX−pYs

p0(1−p0)

„1n1

+ 1n2

« ∼H0, approx. N(0, 1)

Observed test statistic:

n1 = 250 n2 = 250

px = 0.404 py = 0.300

p0 =n1 px + n2 py

n1 + n2

=250(0.404) + (250)(0.300)

250 + 250

= 0.352

z =px − pys

p0(1 − p0)

„1n1

+ 1n2

«

=0.404 − 0.300r

0.352(1 − 0.352)“

1250

+ 1250

” = 2.43

p-value = P(Z ≥ z) = P(Z ≥ 2.43) = 0.0075

Since p-value is very small, the null hypothesis can be rejectedat any significance level bigger than 0.0075.

Conclusion: The sample data didcontain very strong evidencesuggesting that a higher responserate will be achieved when aninducement question is includedthan when it is not.

Page 22: Estadística II Chapter 3: Comparison of two populations

Tests for the difference between two proportions:independent large samples

Example: 9.9 (Newbold cont.) Construct a 95% confidence interval forpX − pY .

CI0.95 (pX − pY ) =

(px − py ∓ z0.025

√p0(1− p0)

(1

n1+

1

n2

))

=

(0.404− 0.300∓ 1.96

√0.352(1− 0.352)

(1

250+

1

250

))= (0.1877, 0.0203)

Since the value of 0 does not belong to this interval, we can reject thenull hypothesis of the equality of the two population means at a α = 0.05significance level.

Page 23: Estadística II Chapter 3: Comparison of two populations

Tests for the ratio of variances: normal samples

I Let X be a population with mean µX and variance σ2X and Y be a

population with mean µY and variance σ2Y , both normally

distributed.

I Suppose we have a random sample of n1 observations from X andan independent random sample of n2 observations from Y .

I In a two-tail test H0 : σ2X = σ2

Y (= σ2) against H1 : σ2X 6= σ2

Y :I The test statistic is

F =s2X

s2Y

∼H0 Fn1−1,n2−1

I The rejection region is (at significance level α):

RRα = {f : f < Fn1−1,n2−1;1−α/2 or f > Fn1−1,n2−1;α/2}

Page 24: Estadística II Chapter 3: Comparison of two populations

F distributionRecall that if X1,X2, . . . ,Xn andY1,Y2,Y3, . . . ,Ym denoteindependent rvs, all following anN(0, 1) distribution. The randomvariable

F =1n1m

Pni=1 X 2

iPmi=1 Y 2

i

follows an Fn,m distribution with nand m degrees of freedom. We canview it as a ratio of two normalizedchi-square rvs. This is where theresult from the previous page comesfrom:

s2X

s2Y

=H0

1n1−1

χ2n1−1z }| {

(n1 − 1)s2X

σ2

1n2−1

(n2 − 1)s2Y

σ2| {z }χ2

n2−1

∼ Fn1−1,n2−1

F densities

0 2 4 6 8

0.0

0.2

0.4

0.6

0.8

1.0

1.2

df1=30 df2=30)df1=10 df2=15df1=8 df2=8df1=5 df2=3

Page 25: Estadística II Chapter 3: Comparison of two populations

Tests for the ratio of variances: normal samples

Example: 9.10 (Newbold) For a random sample of 17 newly issuedAAA-rated industrial bonds, the quasi-variance of maturities (in yearssquared) was 123.35. For an independent random sample of 11 issuedCCC-rated industrial bonds, the quasi-variance of maturities was 8.02. Ifthe respective population variances are denoted σ2

X and σ2Y , perform a

two-sided test at a 5% level.Population 1:X maturity of AAA-rated bonds (inyears)X ∼ N(µX , σ

2X )

' SRS: n1 = 17

Sample: s2x = 123.35

Population 2:Y maturity of CCC-rated bonds (inyears)Y ∼ N(µY , σ

2Y )

' SRS: n2 = 11

Sample: s2y = 8.02

Page 26: Estadística II Chapter 3: Comparison of two populations

Tests for the ratio of variances: normal samplesExample: 9.10 (Newbold cont.)

Objective: test

H0 : σ2X = σ2

Y

against

H1 : σ2X 6= σ2

Y

(Two-tail test)

Test statistic:F =

s2X

s2Y∼H0 Fn1−1,n2−1

Observed test statistic:

n1 = 17 n2 = 11

s2x = 123.35 s2

y = 8.02

f =123.35

8.02= 15.38

Rejection region:

RR0.10 = {f : f <

0.402z }| {F16,10;1−0.05}

∪ {f : f > F16,10;0.05| {z }2.83

}

Note: the quantile F16,10;0.05 = 2.83is directly available from the F-table,but the other one not. We can get ithowever using the following propertyof the F-distribution

Fn,m;α = 1Fm,n;1−α

Hence

F16,10;1−0.05 =1

F10,16;0.05=

1

2.49= 0.402

We see that f = 15.38 ∈ RR0.10.Conclusion: There is very strongevidence that the populationvariances are different.

Page 27: Estadística II Chapter 3: Comparison of two populations

Two-tail test for the ratio of variances via confidenceinterval

Example: 9.10 (Newbold cont.) Construct a 90% confidence interval forthe ratio of the variances.

CI0.90

(σ2

X

σ2Y

)=

(s2x

s2y

1

Fn1−1,n2−1;0.05,s2x

s2y

1

Fn1−1,n2−1;1−0.05

)=

(123.35

8.02

1

2.83,

123.35

8.02

1

0.402

)= (5.43, 38.26)

As we expected, the value of 1 does not belong to this interval, so we canreject the null hypothesis of the equality of the two population variancesat a α = 0.1 significance level.

Page 28: Estadística II Chapter 3: Comparison of two populations

Test statistics

Parameter Assumptions Test statistic

Normal differencesMatched pairs

D−D0sD/√

n∼ tn−1

Normal pops.Equal common var.

X−Y−D0

sp

r1n1

+ 1n2

∼H0tn1+n2−2

µX − µY = D0Normal pops.Known vars.

X−Y−D0sσ2

Xn1

+σ2

Yn2

∼H0N(0, 1)

Nonnormal pops.Unknown vars.Large samples

X−Y−D0ss2Xn1

+s2Yn2

∼H0, approx N(0, 1)

pX − pY = 0 Bernoulli pops.Large samples

pX−pYsp0(1−p0)

„1n1

+ 1n2

« ∼H0, approx N(0, 1)

σ2X /σ

2Y = 1 Normal pops.

s2X

s2Y

∼H0Fn1−1,n2−1

Question: How would you define RRα in upper- and lower-tail tests?