46
Chap 9-1 Two-Sample Tests

Two-Sample Tests

Embed Size (px)

DESCRIPTION

Two-Sample Tests. Two Sample Tests. Two Sample Tests. Population Means, Independent Samples. Means, Related Samples. Population Proportions. Population Variances. Examples:. Group 1 vs. independent Group 2. Same group before vs. after treatment. Proportion 1 vs. Proportion 2. - PowerPoint PPT Presentation

Citation preview

Page 1: Two-Sample Tests

Chap 9-1

Two-Sample Tests

Page 2: Two-Sample Tests

Chap 9-2

Two Sample Tests

Two Sample Tests

Population Means,

Independent Samples

Means, Related Samples

Population Variances

Group 1 vs. independent Group 2

Same group before vs. after treatment

Variance 1 vs.Variance 2

Examples:

Population Proportions

Proportion 1 vs. Proportion 2

Page 3: Two-Sample Tests

Chap 9-3

Difference Between Two Means

Population means, independent

samples

σ1 and σ2 known

σ1 and σ2 unknown

Goal: Test hypotheses or form a confidence interval for the difference between two population means, μ1 – μ2

The point estimate for the difference is

X1 – X2

*

Page 4: Two-Sample Tests

Chap 9-4

Independent Samples

Population means, independent

samples

Different data sources Unrelated Independent

Sample selected from one population has no effect on the sample selected from the other population

Use the difference between 2 sample means

Use Z test or pooled variance t test

*

σ1 and σ2 known

σ1 and σ2 unknown

Page 5: Two-Sample Tests

Chap 9-5

Difference Between Two Means

Population means, independent

samples

σ1 and σ2 known

σ1 and σ2 unknown

*

Use a Z test statistic

Use S to estimate unknown σ , use a t test statistic and pooled standard deviation

Page 6: Two-Sample Tests

Chap 9-6

Population means, independent

samples

σ1 and σ2 known

σ1 and σ2 Known

Assumptions:

Samples are randomly and independently drawn

population distributions are normal or both sample sizes are 30

Population standard deviations are known

*σ1 and σ2 unknown

Page 7: Two-Sample Tests

Chap 9-7

Population means, independent

samples

σ1 and σ2 known …and the standard error of

X1 – X2 is

When σ1 and σ2 are known and both populations are normal or both sample sizes are at least 30, the test statistic is a Z-value…

2

22

1

21

XX n

σ

n

σσ

21

(continued)

σ1 and σ2 Known

*σ1 and σ2 unknown

Page 8: Two-Sample Tests

Chap 9-8

Population means, independent

samples

σ1 and σ2 known

2

22

1

21

2121

μμXXZ

The test statistic for μ1 – μ2 is:

σ1 and σ2 Known

*σ1 and σ2 unknown

(continued)

Page 9: Two-Sample Tests

Chap 9-9

Hypothesis Tests forTwo Population Means

Lower-tail test:

H0: μ1 μ2

H1: μ1 < μ2

i.e.,

H0: μ1 – μ2 0H1: μ1 – μ2 < 0

Upper-tail test:

H0: μ1 ≤ μ2

H1: μ1 > μ2

i.e.,

H0: μ1 – μ2 ≤ 0H1: μ1 – μ2 > 0

Two-tail test:

H0: μ1 = μ2

H1: μ1 ≠ μ2

i.e.,

H0: μ1 – μ2 = 0H1: μ1 – μ2 ≠ 0

Two Population Means, Independent Samples

Page 10: Two-Sample Tests

Chap 9-10

Two Population Means, Independent Samples

Lower-tail test:

H0: μ1 – μ2 0H1: μ1 – μ2 < 0

Upper-tail test:

H0: μ1 – μ2 ≤ 0H1: μ1 – μ2 > 0

Two-tail test:

H0: μ1 – μ2 = 0H1: μ1 – μ2 ≠ 0

a a/2 a/2a

-za -za/2za za/2

Reject H0 if Z < -Za Reject H0 if Z > Za Reject H0 if Z < -Za/2

or Z > Za/2

Hypothesis tests for μ1 – μ2

Page 11: Two-Sample Tests

Chap 9-11

Population means, independent

samples

σ1 and σ2 known

2

22

1

21

21n

σ

n

σZXX

The confidence interval for μ1 – μ2 is:

Confidence Interval, σ1 and σ2 Known

*σ1 and σ2 unknown

Page 12: Two-Sample Tests

Chap 9-12

Population means, independent

samples

σ1 and σ2 known

σ1 and σ2 Unknown

Assumptions:

Samples are randomly and independently drawn

Populations are normally distributed or both sample sizes are at least 30

Population variances are unknown but assumed equal

*σ1 and σ2 unknown

Page 13: Two-Sample Tests

Chap 9-13

Population means, independent

samples

σ1 and σ2 known

σ1 and σ2 Unknown(continued)

*σ1 and σ2 unknown

Forming interval estimates:

The population variances are assumed equal, so use the two sample standard deviations and pool them to estimate σ

the test statistic is a t value with (n1 + n2 – 2) degrees of freedom

Page 14: Two-Sample Tests

Chap 9-14

Population means, independent

samples

σ1 and σ2 known

σ1 and σ2 Unknown

The pooled standard deviation is

(continued)

1)n()1(n

S1nS1nS

21

222

211

p

*σ1 and σ2 unknown

Page 15: Two-Sample Tests

Chap 9-15

Population means, independent

samples

σ1 and σ2 known

σ1 and σ2 Unknown

Where t has (n1 + n2 – 2) d.f.,

and

21

2p

2121

n1

n1

S

μμXXt

The test statistic for μ1 – μ2 is:

*σ1 and σ2 unknown

1)n()1(n

S1nS1nS

21

222

2112

p

(continued)

Page 16: Two-Sample Tests

Chap 9-16

Population means, independent

samples

σ1 and σ2 known

21

2p2-nn21

n

1

n

1StXX

21

The confidence interval for μ1 – μ2 is:

Where

1)n()1(n

S1nS1nS

21

222

2112

p

*σ1 and σ2 unknown

Confidence Interval, σ1 and σ2 Unknown

Page 17: Two-Sample Tests

Chap 9-17

Pooled Sp t Test: 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 NASDAQNumber 21 25Sample mean 3.27 2.53Sample std dev 1.30 1.16

Assuming both populations are approximately normal with equal variances, isthere a difference in average yield ( = 0.05)?

Page 18: Two-Sample Tests

Chap 9-18

Calculating the Test Statistic

1.5021

1)25(1)-(21

1.161251.30121

1)n()1(n

S1nS1nS

22

21

222

2112

p

2.040

251

211

5021.1

02.533.27

n1

n1

S

μμXXt

21

2p

2121

The test statistic is:

Page 19: Two-Sample Tests

Chap 9-19

Solution

H0: μ1 - μ2 = 0 i.e. (μ1 = μ2)

H1: μ1 - μ2 ≠ 0 i.e. (μ1 ≠ μ2)

= 0.05

df = 21 + 25 - 2 = 44Critical Values: t = ± 2.0154

Test Statistic: Decision:

Conclusion:

Reject H0 at a = 0.05

There is evidence of a difference in means.

t0 2.0154-2.0154

.025

Reject H0 Reject H0

.025

2.040

2.040

251

211

5021.1

2.533.27t

Page 20: Two-Sample Tests

Chap 9-20

Related Samples

Tests Means of 2 Related Populations Paired or matched samples Repeated measures (before/after) Use difference between paired values:

Eliminates Variation Among Subjects Assumptions:

Both Populations Are Normally Distributed Or, if Not Normal, use large samples

Related samples

D = X1 - X2

Page 21: Two-Sample Tests

Chap 9-21

Mean Difference, σD Known

The ith paired difference is Di , whereRelated samples

Di = X1i - X2i

The point estimate for the population mean paired difference is D : n

DD

n

1ii

Suppose the population standard deviation of the difference scores, σD, is known

n is the number of pairs in the paired sample

Page 22: Two-Sample Tests

Chap 9-22

The test statistic for the mean difference is a Z value:Paired

samples

n

σμD

ZD

D

Mean Difference, σD Known(continued)

WhereμD = hypothesized mean differenceσD = population standard dev. of differencesn = the sample size (number of pairs)

Page 23: Two-Sample Tests

Chap 9-23

Confidence Interval, σD Known

The confidence interval for D isPaired samples

n

σZD D

Where n = the sample size

(number of pairs in the paired sample)

Page 24: Two-Sample Tests

Chap 9-24

If σD is unknown, we can estimate the unknown population standard deviation with a sample standard deviation:

Related samples

1n

)D(DS

n

1i

2i

D

The sample standard deviation is

Mean Difference, σD Unknown

Page 25: Two-Sample Tests

Chap 9-25

The test statistic for D is now a t statistic, with n-1 d.f.:Paired

samples

1n

)D(DS

n

1i

2i

D

n

SμD

tD

D

Where t has n - 1 d.f.

and SD is:

Mean Difference, σD Unknown(continued)

Page 26: Two-Sample Tests

Chap 9-26

The confidence interval for D isPaired samples

1n

)D(DS

n

1i

2i

D

n

StD D

1n

where

Confidence Interval, σD Unknown

Page 27: Two-Sample Tests

Chap 9-27

Lower-tail test:

H0: μD 0H1: μD < 0

Upper-tail test:

H0: μD ≤ 0H1: μD > 0

Two-tail test:

H0: μD = 0H1: μD ≠ 0

Paired Samples

Hypothesis Testing for Mean Difference, σD Unknown

a a/2 a/2a

-ta -ta/2ta ta/2

Reject H0 if t < -ta Reject H0 if t > ta Reject H0 if t < -t /2a

or t > t /2a Where t has n - 1 d.f.

Page 28: Two-Sample Tests

Chap 9-28

Assume you send your salespeople to a “customer service” training workshop. Is the training effective? You collect the following data:

Paired Samples Example

Number of Complaints: (2) - (1)Salesperson Before (1) After (2) Difference, Di

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 -21

D = Di

n

5.67

1n

)D(DS

2i

D

= -4.2

Page 29: Two-Sample Tests

Chap 9-29

Has the training made a difference in the number of complaints (at the 0.01 level)?

- 4.2D =

1.6655.67/

04.2

n/S

μDt

D

D

H0: μD = 0H1: μD 0

Test Statistic:

Critical Value = ± 4.604 d.f. = n - 1 = 4

Reject

/2

- 4.604 4.604

Decision: Do not reject H0

(t stat is not in the reject region)

Conclusion: There is not a significant change in the number of complaints.

Paired Samples: Solution

Reject

/2

- 1.66 = .01

Page 30: Two-Sample Tests

Chap 9-30

Two Population Proportions

Goal: test a hypothesis or form a confidence interval for the difference between two population proportions,

p1 – p2

The point estimate for the difference is

Population proportions

Assumptions: n1p1 5 , n1(1-p1) 5

n2p2 5 , n2(1-p2) 5

21 ss pp

Page 31: Two-Sample Tests

Chap 9-31

Two Population Proportions

Population proportions

21

21

nn

XXp

The pooled estimate for the overall proportion is:

where X1 and X2 are the numbers from samples 1 and 2 with the characteristic of interest

Since we begin by assuming the null hypothesis is true, we assume p1 = p2

and pool the two ps estimates

Page 32: Two-Sample Tests

Chap 9-32

Two Population Proportions

Population proportions

21

21ss

n1

n1

)p1(p

ppppZ 21

The test statistic for p1 – p2 is a Z statistic:

(continued)

2

2s

1

1s

21

21

n

Xp ,

n

Xp ,

nn

XXp

21

where

Page 33: Two-Sample Tests

Chap 9-33

Confidence Interval forTwo Population Proportions

Population proportions

2

ss

1

ssss n

)p(1p

n

)p(1pZpp 2211

21

The confidence interval for p1 – p2 is:

Page 34: Two-Sample Tests

Chap 9-34

Hypothesis Tests forTwo Population Proportions

Population proportions

Lower-tail test:

H0: p1 p2

H1: p1 < p2

i.e.,

H0: p1 – p2 0H1: p1 – p2 < 0

Upper-tail test:

H0: p1 ≤ p2

H1: p1 > p2

i.e.,

H0: p1 – p2 ≤ 0H1: p1 – p2 > 0

Two-tail test:

H0: p1 = p2

H1: p1 ≠ p2

i.e.,

H0: p1 – p2 = 0H1: p1 – p2 ≠ 0

Page 35: Two-Sample Tests

Chap 9-35

Hypothesis Tests forTwo Population Proportions

Population proportions

Lower-tail test:

H0: p1 – p2 0H1: p1 – p2 < 0

Upper-tail test:

H0: p1 – p2 ≤ 0H1: p1 – p2 > 0

Two-tail test:

H0: p1 – p2 = 0H1: p1 – p2 ≠ 0

a a/2 a/2a

-za -za/2za za/2

Reject H0 if Z < -Za Reject H0 if Z > Za Reject H0 if Z < -Z /2a

or Z > Z /2a

(continued)

Page 36: Two-Sample Tests

Chap 9-36

Example: Two population Proportions

Is there a significant difference between the proportion of men and the proportion of women who will vote Yes on Proposition A?

In a random sample, 36 of 72 men and 31 of 50 women indicated they would vote Yes

Test at the .05 level of significance

Page 37: Two-Sample Tests

Chap 9-37

The hypothesis test is:H0: p1 – p2 = 0 (the two proportions are equal)

H1: p1 – p2 ≠ 0 (there is a significant difference between proportions)

The sample proportions are: Men: ps1 = 36/72 = .50

Women: ps2 = 31/50 = .62

.549122

67

5072

3136

nn

XXp

21

21

The pooled estimate for the overall proportion is:

Example: Two population Proportions

(continued)

Page 38: Two-Sample Tests

Chap 9-38

The test statistic for p1 – p2 is:

Example: Two population Proportions

(continued)

.025

-1.96 1.96

.025

-1.31

Decision: Do not reject H0

Conclusion: There is not significant evidence of a difference in proportions who will vote yes between men and women.

1.31

501

721

.549)(1.549

0.62.50

n1

n1

)p(1p

ppppz

21

21ss 21

Reject H0 Reject H0

Critical Values = ±1.96For = .05

Page 39: Two-Sample Tests

Chap 9-39

Hypothesis Tests for Variances

Tests for TwoPopulation Variances

F test statistic

H0: σ12 = σ2

2

H1: σ12 ≠ σ2

2Two-tail test

Lower-tail test

Upper-tail test

H0: σ12 σ2

2

H1: σ12 < σ2

2

H0: σ12 ≤ σ2

2

H1: σ12 > σ2

2

*

Page 40: Two-Sample Tests

Chap 9-40

Hypothesis Tests for Variances

Tests for TwoPopulation Variances

F test statistic22

21

S

SF

The F test statistic is:

= Variance of Sample 1 n1 - 1 = numerator degrees of freedom

n2 - 1 = denominator degrees of freedom = Variance of Sample 2

21S

22S

*

(continued)

Page 41: Two-Sample Tests

Chap 9-41

The F critical value is found from the F table

The are two appropriate degrees of freedom: numerator and denominator

In the F table, numerator degrees of freedom determine the column

denominator degrees of freedom determine the row

The F Distribution

where df1 = n1 – 1 ; df2 = n2 – 122

21

S

SF

Page 42: Two-Sample Tests

Chap 9-42

F 0

Finding the Rejection Region

L22

21

U22

21

FS

SF

FS

SF

rejection region for a two-tail test is:

FL Reject H0

Do not reject H0

F 0

FU Reject H0Do not

reject H0

F 0 /2

Reject H0Do not reject H0 FU

H0: σ12 = σ2

2

H1: σ12 ≠ σ2

2

H0: σ12 σ2

2

H1: σ12 < σ2

2

H0: σ12 ≤ σ2

2

H1: σ12 > σ2

2

FL

/2

Reject H0

Reject H0 if F < FL

Reject H0 if F > FU

Page 43: Two-Sample Tests

Chap 9-43

Finding the Rejection Region

F 0 /2

Reject H0Do not reject H0 FU

H0: σ12 = σ2

2

H1: σ12 ≠ σ2

2

FL

/2

Reject H0

(continued)

2. Find FL using the formula:

Where FU* is from the F table with

n2 – 1 numerator and n1 – 1

denominator degrees of freedom (i.e., switch the d.f. from FU)

*UL F

1F 1. Find FU from the F table

for n1 – 1 numerator and

n2 – 1 denominator

degrees of freedom

To find the critical F values:

Page 44: Two-Sample Tests

Chap 9-44

F Test: An 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 NASDAQNumber 21 25Mean 3.27 2.53Std dev 1.30 1.16

Is there a difference in the variances between the NYSE & NASDAQ at the = 0.05 level?

Page 45: Two-Sample Tests

Chap 9-45

F Test: Example Solution

Form the hypothesis test:

H0: σ21 – σ2

2 = 0 (there is no difference between variances)

H1: σ21 – σ2

2 ≠ 0 (there is a difference between variances)

Numerator: n1 – 1 = 21 – 1 = 20 d.f.

Denominator: n2 – 1 = 25 – 1 = 24 d.f.

FU = F.025, 20, 24 = 2.33

Find the F critical values for = .05:

Numerator: n2 – 1 = 25 – 1 = 24 d.f.

Denominator: n1 – 1 = 21 – 1 = 20 d.f.

FL = 1/F.025, 24, 20 = 1/2.41

= .41

FU: FL:

Page 46: Two-Sample Tests

Chap 9-46

The test statistic is:

0

256.116.1

30.1

S

SF

2

2

22

21

/2 = .025

FU=2.33Reject H0Do not

reject H0

H0: σ12 = σ2

2

H1: σ12 ≠ σ2

2

F Test: Example Solution

F = 1.256 is not in the rejection region, so we do not reject H0

(continued)

Conclusion: There is not sufficient evidence of a difference in variances at = .05

FL=0.41

/2 = .025

Reject H0

F