381 hypothesis testing (testing with two samples-iii) qsci 381 – lecture 32 (larson and farber,...

16
38 1 Hypothesis Testing (Testing with Two Samples-III) QSCI 381 – Lecture 32 (Larson and Farber, Sects 8.3 – 8.4)

Upload: imogen-casey

Post on 13-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 381 Hypothesis Testing (Testing with Two Samples-III) QSCI 381 – Lecture 32 (Larson and Farber, Sects 8.3 – 8.4)

381

Hypothesis Testing(Testing with Two Samples-III)

QSCI 381 – Lecture 32(Larson and Farber, Sects 8.3 – 8.4)

Page 2: 381 Hypothesis Testing (Testing with Two Samples-III) QSCI 381 – Lecture 32 (Larson and Farber, Sects 8.3 – 8.4)

381

Independent and Dependent Samples

Two samples are if the sample selected from one population is not related to the sample selected from the second population. The two samples are if each member of one sample corresponds to a member of the other sample. Dependent samples are also called or matched samples.

Page 3: 381 Hypothesis Testing (Testing with Two Samples-III) QSCI 381 – Lecture 32 (Larson and Farber, Sects 8.3 – 8.4)

381

Examples Which are independent and

dependent samples? 25 fish in each of two ponds are

weighed. Weights of 25 fish in a pond on two

successive days. Weights and lengths of 30 fish. Heights of 25 males and 25 females.

Page 4: 381 Hypothesis Testing (Testing with Two Samples-III) QSCI 381 – Lecture 32 (Larson and Farber, Sects 8.3 – 8.4)

381

t-test for the Difference Between Means-I

(Conditions)

A t-test can be used to test the difference of two population means when a sample is randomly selected from each population. The samples must be randomly selected. The samples must be dependent (paired). Both populations must be normally

distributed.

Page 5: 381 Hypothesis Testing (Testing with Two Samples-III) QSCI 381 – Lecture 32 (Larson and Farber, Sects 8.3 – 8.4)

381

t-test for the Difference Between Means-II

The approaches in lectures 30 and 31 only apply to independent samples.

Dependent data are analyzed by considering the difference for each pair:

The test statistic is the mean difference:

1, 2,i i id x x

1in

i

d d

Page 6: 381 Hypothesis Testing (Testing with Two Samples-III) QSCI 381 – Lecture 32 (Larson and Farber, Sects 8.3 – 8.4)

381

t-test for the Difference Between Means-III

The test statistic is:

and the standardized test statistic is:

is the hypothesized mean of the differences of the paired data in the population.d.f. = n-1.

1in

i

d d

/d

d

dts n

d

2 2( ) ( )

( 1)i i

d

n d ds

n n

Page 7: 381 Hypothesis Testing (Testing with Two Samples-III) QSCI 381 – Lecture 32 (Larson and Farber, Sects 8.3 – 8.4)

381

Example-I You are evaluating a program that aims to recover

degraded streams. The data available are “environmental scores” before and after the recovery program. Prior to the start of the recovery program, the contractors claimed that the “environmental score” would increase by an average of more than 5 points. Evaluate the claim at the 5% level of significance.

Page 8: 381 Hypothesis Testing (Testing with Two Samples-III) QSCI 381 – Lecture 32 (Larson and Farber, Sects 8.3 – 8.4)

381

Example-II1. H0: d 5; Ha: d > 5;2. The level of significance is 0.05, the d.f.=15-

1=14, and we have a right-tailed test. The rejection region is therefore t > 1.76.

3. The standard deviation of the differences, sd, is given by:

4. The standardized test statistic is:

5. We fail to reject the null hypothesis.

2 2( ) ( )3.622

( 1)i i

d

n d ds

n n

5.82 50.877

/ 3.622 / 15d

d

dts n

Note that but will still fail to reject the null hypothesis – why?5d

Page 9: 381 Hypothesis Testing (Testing with Two Samples-III) QSCI 381 – Lecture 32 (Larson and Farber, Sects 8.3 – 8.4)

381

Constructing a c-confidence Interval

To construct a confidence interval for d, use the following inequality:

Construct a 90% confidence interval for d for Example I.

d dc d c

s sd t d t

n n

3.622 3.6225.82 1.76 5.82 1.76

15 15d

4.173 7.467d

Page 10: 381 Hypothesis Testing (Testing with Two Samples-III) QSCI 381 – Lecture 32 (Larson and Farber, Sects 8.3 – 8.4)

381

Two sample z-test for the difference between proportions-I

We can test the difference between two population proportions p1 and p2 based on samples from each population. We can use the z-test if the following conditions are true:

The samples are randomly selected. The samples are independent. The sample sizes are large enough to use a normal

sampling distribution assumption, i.e.:1 1 1 1 2 2 2 25; 5; 5; 5;n p n q n p n q

Page 11: 381 Hypothesis Testing (Testing with Two Samples-III) QSCI 381 – Lecture 32 (Larson and Farber, Sects 8.3 – 8.4)

381

Two sample z-test for the difference between proportions-II

The sampling distribution for , the difference between the sample proportions, is a normal distribution with mean difference:

and standard error:

The standard error can be approximated by:

1 2ˆ ˆp p

1 2ˆ ˆ 1 2p p p p

1 2

1 1 2 2ˆ ˆ

1 2p p

p q p q

n n

1 1ˆ ˆ

1 2

1 1p p p q

n n

1 2

1 2

x xp

n n

Page 12: 381 Hypothesis Testing (Testing with Two Samples-III) QSCI 381 – Lecture 32 (Larson and Farber, Sects 8.3 – 8.4)

381

Two sample z-test for difference between proportions-III

1. State H0 and Ha.

2. Identify and find the critical values(s) and rejection region(s).

3. Find the weighted estimate of and :

4. Calculate the standardized test statistic:

5. Make a decision to reject or fail to reject the null hypothesis.

1p̂ 2p̂1 2

1 2

x xp

n n

1 2 1 2

1 2

ˆ ˆ( ) ( )

1 1

p p p pz

p qn n

Page 13: 381 Hypothesis Testing (Testing with Two Samples-III) QSCI 381 – Lecture 32 (Larson and Farber, Sects 8.3 – 8.4)

381

Example-I One expectation of creating a marine reserve

is that the fraction of “large” fish should increase. 100 fish are sampled from each of two areas (one a reserve and another actively fished). Test whether the fraction of “large” fish in the reserve and the fished area differ at the 1% level of significance.

Reserve Non-reserve

n1=100 n2=100

x1=17 x2=6

Page 14: 381 Hypothesis Testing (Testing with Two Samples-III) QSCI 381 – Lecture 32 (Larson and Farber, Sects 8.3 – 8.4)

381

Example-II H0: p1=p2; Ha: p1p2. =0.01; rejection region |z|>2.576. The weighted proportion estimate is:

The standardized test statistic:

We fail to reject the null hypothesis at the 1% level of significance.

1 2

1 2

17 60.115

200

x xp

n n

1 2 1 2

1 2

ˆ ˆ( ) ( ) (0.17 0.06) 02.438

0.115x 0.885x (1/100 1/100)1 1

p p p pz

p qn n

Page 15: 381 Hypothesis Testing (Testing with Two Samples-III) QSCI 381 – Lecture 32 (Larson and Farber, Sects 8.3 – 8.4)

381

Constructing a c-confidence Interval

To construct a confidence interval for p1-p2, use the following inequality:

Construct a 95% confidence interval for p1-p2 for Example I.

1 1 2 2 1 1 2 21 2 1 2 1 2

1 2 1 2

ˆ ˆ ˆ ˆ ˆ ˆ ˆ ˆˆ ˆ ˆ ˆ( ) ( )c c

p q p q p q p qp p z p p p p z

n n n n

1 2

0.17 x 0.83 0.06 x 0.94 0.17 x 0.83 0.06 x 0.940.11 1.96 0.11 1.96

100 100 100 100p p

1 20.023 0.197p p

Page 16: 381 Hypothesis Testing (Testing with Two Samples-III) QSCI 381 – Lecture 32 (Larson and Farber, Sects 8.3 – 8.4)

381

Review

Use t-test fordependent samples

Are the samplesindependent?

Are both sampleslarge?

Are bothpopulations normal?

Cannot use anyof the tests

Use a t-test forsmall independent

samples.

Are both population standard

deviations known?

Use z-test

Use z-test forlarge independent

samples

Yes

Yes

Yes

Yes

No

NoNo

No