+ All Categories
Home > Documents > 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

Date post: 11-Jan-2016
Category:
Upload: ashlee-king
View: 215 times
Download: 0 times
Share this document with a friend
Popular Tags:
24
9 Inferences Based on Two Samples
Transcript
Page 1: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

9 Inferences Based on Two Samples

Page 2: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

9.1-9.2 The Two-Sample test and Confidence Interval

Page 3: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

Comparing two samples

We often compare two treatments used on independent samples.

Independent samples: Subjects in one samples are completely unrelated to

subjects in the other sample.

Example: We want to compare the means of heights of 10-year-old girls and boys.

Population 1

Sample 1

Population 2

Sample 2

Page 4: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

Two-sample z statistic

We have two independent SRSs (simple random samples) possibly

coming from two distinct populations with () and (). We use 1

and 2 to estimate the unknown and .

When both populations are normal, the sampling distribution of ( 1− 2)

is also normal, with standard deviation :

Then the two-sample z statistic

has the standard normal N(0, 1)

sampling distribution.

2

22

1

21

nn

2

22

1

21

2121 )()(

nn

xxz

x

x

x

x

Page 5: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

Two independent samples t distributionWe have two independent SRSs (simple random samples) possibly

coming from two distinct populations with () and () unknown.

We use ( 1,s1) and ( 2,s2) to estimate () and (), respectively.

To compare the means, both populations should be normally

distributed. However, in practice, it is enough that the two distributions

have similar shapes and that the sample data contain no strong outliers.

x

x

Page 6: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

2

22

1

21

n

s

n

sSE

s12

n1

s2

2

n2

df

1-2

x 1 x 2

The two-sample t statistic follows approximately the t distribution with a

standard error SE (spread) reflecting

variation from both samples:

1)/(

1)/(

2

22

22

1

21

21

2

2

22

1

21

nns

nns

ns

ns

df

Page 7: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

t (x 1 x 2) (1 2)

SE

Two-sample t significance test The null hypothesis is that both the difference between population means

and is equal to 0.

H0: − 0

with either a one-sided or a two-sided alternative hypothesis.

We find how many standard errors (SE) away

from ( − ) is ( 1− 2) by standardizing with t:

Because in a two-sample test H0

poses ( − 0, we simply use

with

2

22

1

21

021 )(

ns

ns

xxt

x

x

1)/(

1)/(

2

22

22

1

21

21

2

2

22

1

21

nns

nns

ns

ns

df

Page 8: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

Does smoking damage the lungs of children exposed

to parental smoking?

Forced vital capacity (FVC) is the volume (in milliliters) of

air that an individual can exhale in 6 seconds.

FVC was obtained for a sample of children not exposed to

parental smoking and a group of children exposed to

parental smoking.

We want to know whether parental smoking decreases

children’s lung capacity as measured by the FVC test.

Is the mean FVC lower in the population of children

exposed to parental smoking?

Parental smoking FVC s n

Yes 75.5 9.3 30

No 88.2 15.1 30

x

Page 9: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

Parental smoking FVC s n

Yes 75.5 9.3 30

No 88.2 15.1 30

The difference in sample averages

follows approximately the t distribution:

We calculate the t statistic:

,0 22

no

no

smoke

smoke

n

s

n

st

9.3 6.79.2

7.12

301.15

303.9

2.885.752222

t

ns

ns

xxt

no

no

smoke

smoke

nosmoke

In t-table, for df 45 we find:

|t| > 3.659 => p < 0.0005 (one sided)

It’s a very significant difference, we reject H0.

H0: smoke = no <=> (smoke − no) = 0

Ha: smoke < no <=> (smoke − no) < 0 (one sided)

Lung capacity is significantly impaired in children of smoking parents.

x

4.45

130)30/1.15(

130)30/3.9(

301.15

303.9

2222

222

df

Page 10: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

Two-sample t confidence intervalBecause we have two independent samples we use the difference

between both sample averages ( 1 − 2) to estimate ( − ).

C

t*−t*

m m

SE s1

2

n1

s2

2

n2

Practical use of t: t*

C is the area between −t* and t*.

We find t* in the line of t-table

for df and the column for

confidence level C.

The margin of error m is:

SEtn

s

n

stm **

2

22

1

21

x

x

Page 11: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

Can directed reading activities in the classroom help improve reading ability?

A class of 21 third-graders participates in these activities for 8 weeks while a

control classroom of 23 third-graders follows the same curriculum without the

activities. After 8 weeks, all children take a reading test (scores in table).

95% confidence interval for (µ1 − µ2), with df = 37 conservatively t* = 2.03:

With 95% confidence, (µ1 − µ2), falls within 9.96 ± 8.75 or 1.21 to 18.71.

75.831.4*03.2*;)(:2

22

1

21

21 n

s

n

stmmxxCI

Page 12: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

When both populations have the same standard deviation, the pooled estimator of σ2 is:

The sampling distribution for (x1 − x2) has exactly the t distribution with (n1 + n2 − 2) degrees of freedom.

A level C confidence interval for µ1 − µ2 is

(with area C between −t* and t*).

To test the hypothesis H0: µ1 = µ2 against a one-sided or a two-sided alternative, compute the pooled two-sample t statistic for the t(n1 + n2 − 2) distribution.

2

2

1

2

21

n

s

n

s

xxt

pp

2

2

1

2

21 *n

s

n

stxx pp

sp2

(n1 1)s12 (n2 1)s2

2

(n1 n2 2)

Pooled Two-Sample Procedures

Page 13: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

9.3 Analysis of Paired Data

Page 14: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

Matched pairs t proceduresSometimes we want to compare treatments or conditions at the

individual level. These situations produce two samples that are not

independent — they are related to each other. The members of one

sample are identical to, or matched (paired) with, the members of the

other sample.

Example: Pre-test and post-test studies look at data collected on the

same sample elements before and after some experiment is performed.

Example: Twin studies often try to sort out the influence of genetic

factors by comparing a variable between sets of twins.

Example: Using people matched for age, sex, and education in social

studies allows canceling out the effect of these potential lurking

variables.

Page 15: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

Sweetening colas (revisited)

The sweetness loss due to storage was evaluated by 10 professional

tasters (comparing the sweetness before and after storage):

Taster Sweetness loss 1 2.0 2 0.4 3 0.7 4 2.0 5 −0.4 6 2.2 7 −1.3 8 1.2 9 1.1 10 2.3

We want to test if storage

results in a loss of

sweetness, thus:

H0: = 0 versus Ha: > 0

Although the text didn’t mention it explicitly, this is a pre-/post-test design and

the variable is the difference in cola sweetness before minus after storage.

A matched pairs test of significance is indeed just like a one-sample test.

Page 16: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

In these cases, we use the paired data to test the difference in the two

population means. The variable studied becomes Xdifference = (X1 − X2),

and

H0: µdifference= 0; Ha: µdifference> 0 (or < 0, or ≠ 0)

Conceptually, this is not different from tests on one population.

Page 17: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

Does lack of caffeine increase depression?

Individuals diagnosed as caffeine-dependent are

deprived of caffeine-rich foods and assigned

to receive daily pills. Sometimes, the pills

contain caffeine and other times they contain

a placebo. Depression was assessed.

There are 2 data points for each subject, but we’ll only look at the difference.

The sample distribution appears appropriate for a t-test.

SubjectDepression

with CaffeineDepression

with PlaceboPlacebo - Cafeine

1 5 16 112 5 23 183 4 5 14 3 7 45 8 14 66 5 24 197 0 6 68 0 3 39 2 15 1310 11 12 111 1 0 -1

11 “difference” data points.

-5

0

5

10

15

20

DIF

FE

RE

NC

E

-2 -1 0 1 2Normal quantiles

Page 18: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

Does lack of caffeine increase depression?

For each individual in the sample, we have calculated a difference in depression

score (placebo minus caffeine).

There were 11 “difference” points, thus df = n − 1 = 10.

We calculate that = 7.36; s = 6.92

H0: difference = 0 ; H0: difference > 0

53.311/92.6

36.70

ns

xt

SubjectDepression

with CaffeineDepression

with PlaceboPlacebo - Cafeine

1 5 16 112 5 23 183 4 5 14 3 7 45 8 14 66 5 24 197 0 6 68 0 3 39 2 15 1310 11 12 111 1 0 -1

For df = 10, 3.169 < t = 3.53 < 3.581 0.005 > p > 0.0025

Caffeine deprivation causes a significant increase in depression.

x

Page 19: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

9.4 Inferences Concerning a Difference Between Population Proportions

Page 20: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

Comparing two independent samplesWe often need to compare two treatments used on independent

samples. We can compute the difference between the two sample

proportions and compare it to the corresponding, approximately normal

sampling distribution for ( 1 – 2):p̂ p̂

Page 21: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

Large-sample CI for two proportionsFor two independent SRSs of sizes n1 and n2 with sample proportion

of successes 1 and 2 respectively, an approximate level C

confidence interval for p1 – p2 is

2

22

1

11

21

)ˆ1(ˆ)ˆ1(ˆ**

error ofmargin theis ,)ˆˆ(

n

pp

n

ppzSEzm

mmpp

diff

Use this method only when the populations are at least 10 times larger

than the samples and the number of successes and the number of

failures are each at least 10 in each sample.

C is the area under the standard normal curve between −z* and z*.

p̂ p̂

Page 22: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

Cholesterol and heart attacks

How much does the cholesterol-lowering drug Gemfibrozil help reduce the risk

of heart attack? We compare the incidence of heart attack over a 5-year period

for two random samples of middle-aged men taking either the drug or a placebo.

So the 90% CI is (0.0414 − 0.0273) ± 1.645*0.0057 = 0.0141 ± 0.0094

We estimate with 90% confidence that the percentage of middle-aged men who

suffer a heart attack is 0.47% to 2.35% lower when taking the cholesterol-

lowering drug.

Standard error of the difference p1− p2:

2

22

1

11 )ˆ1(ˆ)ˆ1(ˆ

n

pp

n

ppSE

SEzpp *)ˆˆ( is interval confidence The 21

SE 0.0273(0.9727)

2051

0.0414(0.9586)

2030 0.000325 0.0057

Heart attack

n

Drug 56 2051 2.73%

Placebo 84 2030 4.14%

Page 23: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

If the null hypothesis is true, then we can rely on the properties of the sampling distribution to estimate the probability of drawing 2 samples with proportions 1 and 2 at random.

Test of significance

This test is appropriate when the populations are at least 10 times as large as the samples and all counts are at least 5 (number of successes and number of failures in each sample).

22

11)ˆ1(ˆ

nnpp

=0

21

21

21

21

210

11)ˆ1(ˆ

ˆˆ

countcount

nsobservatio total

successes totalˆ

proportion sample pooled the

,ˆ is of estimatebest Our

:

nnpp

ppz

nnp

pp

pppH

p̂ p̂

Page 24: 9 Inferences Based on Two Samples. 9.1-9.2 The Two-Sample test and Confidence Interval.

Gastric Freezing

Gastric freezing was once a treatment for ulcers. Patients would swallow a deflated balloon with tubes, and a cold liquid would be pumped for an hour to cool the stomach and reduce acid production, thus relieving ulcer pain. The treatment was shown to be safe, significantly reducing ulcer pain and widely used for years.

A randomized comparative experiment later compared the outcome of gastric freezing with that of a placebo: 28 of the 82 patients subjected to gastric freezing improved, while 30 of the 78 in the control group improved.

Conclusion: The gastric freezing was no better than a placebo (p-value 0.69), and this treatment was abandoned. ALWAYS USE A CONTROL!

H0: pgf = pplacebo

Ha: pgf > pplacebo

568.0025.0*231.0

044.0

781

821

637.0*363.0

385.0341.0

11)ˆ1(ˆ

ˆˆ

21

21

nnpp

ppz

3625.07882

3028ˆ

pooledp


Recommended