statistics for ees design of experimentsevol.bio.lmu.de/_statgen/statees/ss10/design.pdf · 2010....

131
Statistics for EES Design of Experiments Dirk Metzler http://evol.bio.lmu.de/_statgen 28. July 2010

Upload: others

Post on 23-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Statistics for EESDesign of Experiments

Dirk Metzler

http://evol.bio.lmu.de/_statgen

28. July 2010

Page 2: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

1 Warning

2 Sample sizesGeneral considerationsOne-Sample TestsTwo-sample t-TestsOne-sided testsOverviewCalculating sample sizes with R

Comparing proportionsF-Test

3 How to sampleExaggerated examplesRandomized Sampleselimination of disturbing factorsBalanced Design vs Non-Balanced Design

Page 3: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Warning

Contents1 Warning2 Sample sizes

General considerationsOne-Sample TestsTwo-sample t-TestsOne-sided testsOverviewCalculating sample sizes with R

Comparing proportionsF-Test

3 How to sampleExaggerated examplesRandomized Sampleselimination of disturbing factorsBalanced Design vs Non-Balanced Design

Page 4: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Warning

Warning

For a scientific publication you needSignificance (Ã sample size sufficient?)Appropriate sampling scheme (Ã randomization)

You have to consider this when you design your experiment!

Warning

First think, then begin to work!Otherwise weeks or months in the field or in the lab can bewasted.

Page 5: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Warning

Warning

For a scientific publication you needSignificance (Ã sample size sufficient?)Appropriate sampling scheme (Ã randomization)

You have to consider this when you design your experiment!

Warning

First think, then begin to work!Otherwise weeks or months in the field or in the lab can bewasted.

Page 6: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Warning

In the design of the experiment you have to answer the followingquestions BEFORE you start generating the data:

Which sample sizes are needed?How do I sample?

You can answer these questions if you already think about thestatistical methods that you will use to analyze the dataBEFORE you start sampling.

Page 7: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Warning

In the design of the experiment you have to answer the followingquestions BEFORE you start generating the data:

Which sample sizes are needed?How do I sample?

You can answer these questions if you already think about thestatistical methods that you will use to analyze the dataBEFORE you start sampling.

Page 8: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes

Contents1 Warning2 Sample sizes

General considerationsOne-Sample TestsTwo-sample t-TestsOne-sided testsOverviewCalculating sample sizes with R

Comparing proportionsF-Test

3 How to sampleExaggerated examplesRandomized Sampleselimination of disturbing factorsBalanced Design vs Non-Balanced Design

Page 9: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes General considerations

Contents1 Warning2 Sample sizes

General considerationsOne-Sample TestsTwo-sample t-TestsOne-sided testsOverviewCalculating sample sizes with R

Comparing proportionsF-Test

3 How to sampleExaggerated examplesRandomized Sampleselimination of disturbing factorsBalanced Design vs Non-Balanced Design

Page 10: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes General considerations

General considerations

The larger the sample,the more likely is it that an existing difference in the data(even small ones) will be detected by a statistical test

the more precisely you can estimate parametersthe more expensive will the experiment be.

It is thus important to select an appropriate sample size. To dothis you have to

decide how small the differences may be that should still bedetectable by the testestimate/predict how much variance the data will show.

Page 11: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes General considerations

General considerations

The larger the sample,the more likely is it that an existing difference in the data(even small ones) will be detected by a statistical testthe more precisely you can estimate parameters

the more expensive will the experiment be.

It is thus important to select an appropriate sample size. To dothis you have to

decide how small the differences may be that should still bedetectable by the testestimate/predict how much variance the data will show.

Page 12: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes General considerations

General considerations

The larger the sample,the more likely is it that an existing difference in the data(even small ones) will be detected by a statistical testthe more precisely you can estimate parametersthe more expensive will the experiment be.

It is thus important to select an appropriate sample size. To dothis you have to

decide how small the differences may be that should still bedetectable by the testestimate/predict how much variance the data will show.

Page 13: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes General considerations

General considerations

The larger the sample,the more likely is it that an existing difference in the data(even small ones) will be detected by a statistical testthe more precisely you can estimate parametersthe more expensive will the experiment be.

It is thus important to select an appropriate sample size. To dothis you have to

decide how small the differences may be that should still bedetectable by the testestimate/predict how much variance the data will show.

Page 14: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes General considerations

General considerations

The larger the sample,the more likely is it that an existing difference in the data(even small ones) will be detected by a statistical testthe more precisely you can estimate parametersthe more expensive will the experiment be.

It is thus important to select an appropriate sample size. To dothis you have to

decide how small the differences may be that should still bedetectable by the test

estimate/predict how much variance the data will show.

Page 15: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes General considerations

General considerations

The larger the sample,the more likely is it that an existing difference in the data(even small ones) will be detected by a statistical testthe more precisely you can estimate parametersthe more expensive will the experiment be.

It is thus important to select an appropriate sample size. To dothis you have to

decide how small the differences may be that should still bedetectable by the testestimate/predict how much variance the data will show.

Page 16: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes General considerations

General considerations

You needd = detection level: How small are the differences allowedto be if they still are supposed to be detectable.

an approximate value s for the standard distribution that youexpect to have in the data (might be a value frompreliminary experiments).α = PrH0(H0 is falsely rejected). Usually, 5%. α is thesignificance level. The Probability α is called type-1 error.β = PrAlternative(H0 is (falsely) not rejected). The choice of βdepends on the problem.. 1− β is the power, β is theprobability of a type-2 error.

Page 17: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes General considerations

General considerations

You needd = detection level: How small are the differences allowedto be if they still are supposed to be detectable.an approximate value s for the standard distribution that youexpect to have in the data (might be a value frompreliminary experiments).

α = PrH0(H0 is falsely rejected). Usually, 5%. α is thesignificance level. The Probability α is called type-1 error.β = PrAlternative(H0 is (falsely) not rejected). The choice of βdepends on the problem.. 1− β is the power, β is theprobability of a type-2 error.

Page 18: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes General considerations

General considerations

You needd = detection level: How small are the differences allowedto be if they still are supposed to be detectable.an approximate value s for the standard distribution that youexpect to have in the data (might be a value frompreliminary experiments).α = PrH0(H0 is falsely rejected). Usually, 5%. α is thesignificance level. The Probability α is called type-1 error.

β = PrAlternative(H0 is (falsely) not rejected). The choice of βdepends on the problem.. 1− β is the power, β is theprobability of a type-2 error.

Page 19: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes General considerations

General considerations

You needd = detection level: How small are the differences allowedto be if they still are supposed to be detectable.an approximate value s for the standard distribution that youexpect to have in the data (might be a value frompreliminary experiments).α = PrH0(H0 is falsely rejected). Usually, 5%. α is thesignificance level. The Probability α is called type-1 error.β = PrAlternative(H0 is (falsely) not rejected). The choice of βdepends on the problem.. 1− β is the power, β is theprobability of a type-2 error.

Page 20: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

Contents1 Warning2 Sample sizes

General considerationsOne-Sample TestsTwo-sample t-TestsOne-sided testsOverviewCalculating sample sizes with R

Comparing proportionsF-Test

3 How to sampleExaggerated examplesRandomized Sampleselimination of disturbing factorsBalanced Design vs Non-Balanced Design

Page 21: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

One-Sample Tests

Question: Is the true mean equal to µ0?

Example: Cold-stress Tolerance in Drosophila melanogaster.

photo (c) Andre Karwath

Page 22: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

One-Sample Tests

Question: Is the true mean equal to µ0?Example: Cold-stress Tolerance in Drosophila melanogaster.

photo (c) Andre Karwath

Page 23: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

One-Sample Tests

The Chill-Coma Recovery Time (CCRT) is the time in secondsafter which a fly wakes up again after chill coma and stands onits legs. In earlier experiments with Drosophila ananassae fromBangkok a mean CCRT of 46 sec was measured.

Question: Is the CCRT of Drosophila ananassae fromKathmandu (Nepal) different from 46?

Planned Test: two-sided one-sample t-test.

Aim: Find differences if they are larger than d = 4. significancelevel α = 5%. Test power 1− β = 80%.

Prior Knowledge: Standard deviation in the first experimentwas s = 11.9

Question: How many flies must I test to have a high chance toget significance if the true difference is 4 seconds or larger?

Page 24: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

One-Sample Tests

The Chill-Coma Recovery Time (CCRT) is the time in secondsafter which a fly wakes up again after chill coma and stands onits legs. In earlier experiments with Drosophila ananassae fromBangkok a mean CCRT of 46 sec was measured.

Question: Is the CCRT of Drosophila ananassae fromKathmandu (Nepal) different from 46?

Planned Test:

two-sided one-sample t-test.

Aim: Find differences if they are larger than d = 4. significancelevel α = 5%. Test power 1− β = 80%.

Prior Knowledge: Standard deviation in the first experimentwas s = 11.9

Question: How many flies must I test to have a high chance toget significance if the true difference is 4 seconds or larger?

Page 25: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

One-Sample Tests

The Chill-Coma Recovery Time (CCRT) is the time in secondsafter which a fly wakes up again after chill coma and stands onits legs. In earlier experiments with Drosophila ananassae fromBangkok a mean CCRT of 46 sec was measured.

Question: Is the CCRT of Drosophila ananassae fromKathmandu (Nepal) different from 46?

Planned Test: two-sided one-sample t-test.

Aim: Find differences if they are larger than d = 4. significancelevel α = 5%. Test power 1− β = 80%.

Prior Knowledge: Standard deviation in the first experimentwas s = 11.9

Question: How many flies must I test to have a high chance toget significance if the true difference is 4 seconds or larger?

Page 26: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

One-Sample Tests

The Chill-Coma Recovery Time (CCRT) is the time in secondsafter which a fly wakes up again after chill coma and stands onits legs. In earlier experiments with Drosophila ananassae fromBangkok a mean CCRT of 46 sec was measured.

Question: Is the CCRT of Drosophila ananassae fromKathmandu (Nepal) different from 46?

Planned Test: two-sided one-sample t-test.

Aim: Find differences if they are larger than d = 4. significancelevel α = 5%. Test power 1− β = 80%.

Prior Knowledge: Standard deviation in the first experimentwas s = 11.9

Question: How many flies must I test to have a high chance toget significance if the true difference is 4 seconds or larger?

Page 27: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

One-Sample Tests

Question: Sample size for CCRT Experiment?Solution: It is required that

n ≥s2 · (t1−α

2 ,n−1 + t1−β,n−1)2

d2 ,

where t1−α2 ,n−1<- qt(1-α/2,n-1) is the (1− α/2) quantile and

t1−β,n−1<- qt(1-β,n-1) is the (1− β) quantile of the tdistribution.

We cannot easily use this because the right side depends on n.

Either we just try out severals values und search the smallest nfor which the relation holds...

Page 28: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

One-Sample Tests

Question: Sample size for CCRT Experiment?Solution: It is required that

n ≥s2 · (t1−α

2 ,n−1 + t1−β,n−1)2

d2 ,

where t1−α2 ,n−1<- qt(1-α/2,n-1) is the (1− α/2) quantile and

t1−β,n−1<- qt(1-β,n-1) is the (1− β) quantile of the tdistribution.We cannot easily use this because the right side depends on n.

Either we just try out severals values und search the smallest nfor which the relation holds...

Page 29: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

One-Sample Tests

Question: Sample size for CCRT Experiment?Solution: It is required that

n ≥s2 · (t1−α

2 ,n−1 + t1−β,n−1)2

d2 ,

where t1−α2 ,n−1<- qt(1-α/2,n-1) is the (1− α/2) quantile and

t1−β,n−1<- qt(1-β,n-1) is the (1− β) quantile of the tdistribution.We cannot easily use this because the right side depends on n.

Either we just try out severals values und search the smallest nfor which the relation holds...

Page 30: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

One-Sample Tests... or we begin with

n0 =s2 · (z1−α

2+ z1−β)2

d2

where z1−α2<- qnorm(1-α/2) is the (1− α/2) quantile

and z1−β<- qnorm(1-β) is the (1− β) quantile of the normaldistribution,

and iterate the improvement of our estimation of the requiredsample size:

n1 =s2 · (t1−α

2 ,n0−1 + t1−β,n0−1)2

d2

n2 =s2 · (t1−α

2 ,n1−1 + t1−β,n1−1)2

d2

and so on until the value of n does not change anymore.

Page 31: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

One-Sample Tests... or we begin with

n0 =s2 · (z1−α

2+ z1−β)2

d2

where z1−α2<- qnorm(1-α/2) is the (1− α/2) quantile

and z1−β<- qnorm(1-β) is the (1− β) quantile of the normaldistribution,and iterate the improvement of our estimation of the requiredsample size:

n1 =s2 · (t1−α

2 ,n0−1 + t1−β,n0−1)2

d2

n2 =s2 · (t1−α

2 ,n1−1 + t1−β,n1−1)2

d2

and so on until the value of n does not change anymore.

Page 32: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

One-sample Tests

Back to the example:

n0 =s2 · (z1−α

2+ z1−β)2

d2 =11.92(z0.975 + z0.8)

2

42 = 69.48 ∼ 70

n1 =s2 · (t1−α

2 ,n0−1 + t1−β,n0−1)2

d2 =11.92(t0.975,69 + t0.8,69)

2

42

= 71.47 ∼ 72

n2 =s2 · (t1−α

2 ,n1−1 + t1−β,n1−1)2

d2 =11.92(t0.975,71 + t0.8,71)

2

42

= 71.41 ∼ 72

Answer: The sample size for the CCRT experiment should ben ≥ 72.

Page 33: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

One-sample Tests

Back to the example:

n0 =s2 · (z1−α

2+ z1−β)2

d2 =11.92(z0.975 + z0.8)

2

42 = 69.48 ∼ 70

n1 =s2 · (t1−α

2 ,n0−1 + t1−β,n0−1)2

d2 =11.92(t0.975,69 + t0.8,69)

2

42

= 71.47 ∼ 72

n2 =s2 · (t1−α

2 ,n1−1 + t1−β,n1−1)2

d2 =11.92(t0.975,71 + t0.8,71)

2

42

= 71.41 ∼ 72

Answer: The sample size for the CCRT experiment should ben ≥ 72.

Page 34: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

One-sample Tests

Back to the example:

n0 =s2 · (z1−α

2+ z1−β)2

d2 =11.92(z0.975 + z0.8)

2

42 = 69.48 ∼ 70

n1 =s2 · (t1−α

2 ,n0−1 + t1−β,n0−1)2

d2 =11.92(t0.975,69 + t0.8,69)

2

42

= 71.47 ∼ 72

n2 =s2 · (t1−α

2 ,n1−1 + t1−β,n1−1)2

d2 =11.92(t0.975,71 + t0.8,71)

2

42

= 71.41 ∼ 72

Answer: The sample size for the CCRT experiment should ben ≥ 72.

Page 35: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

One-sample Tests

Back to the example:

n0 =s2 · (z1−α

2+ z1−β)2

d2 =11.92(z0.975 + z0.8)

2

42 = 69.48 ∼ 70

n1 =s2 · (t1−α

2 ,n0−1 + t1−β,n0−1)2

d2 =11.92(t0.975,69 + t0.8,69)

2

42

= 71.47 ∼ 72

n2 =s2 · (t1−α

2 ,n1−1 + t1−β,n1−1)2

d2 =11.92(t0.975,71 + t0.8,71)

2

42

= 71.41 ∼ 72

Answer: The sample size for the CCRT experiment should ben ≥ 72.

Page 36: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

One-sample Tests

Remark: With a test power of 80% we get in ca. 20% of thecases (1 out of 5) no significance even if the true means have adifference of d .

If we perform such experiments 5 times, we get on average only4 times significance even if the true difference is about d .

Page 37: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

One-sample Tests

Remark: With a test power of 80% we get in ca. 20% of thecases (1 out of 5) no significance even if the true means have adifference of d .If we perform such experiments 5 times, we get on average only4 times significance even if the true difference is about d .

Page 38: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

General explanation

Aim: Choose n such that we fail to reject the null hypothesis (i.e.falsely do not reject it) with probability β or less in cases where itdoes not hold and the true mean is ≥ d .

The null hypothesis is not rejected if

|x − µ0|s/√

n≤ t1−α

2 ,n−1.

If the null hypothesis is not true and the true distribution has atrue mean of µ1 ≥ µ0 + d , the null hypothesis is falsly notrejected with probability

Prµ1

( |x − µ0|s/√

n≤ t1−α

2 ,n−1

).

This probability should be smaller than β.

Page 39: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

General explanation

Aim: Choose n such that we fail to reject the null hypothesis (i.e.falsely do not reject it) with probability β or less in cases where itdoes not hold and the true mean is ≥ d .

The null hypothesis is not rejected if

|x − µ0|s/√

n≤ t1−α

2 ,n−1.

If the null hypothesis is not true and the true distribution has atrue mean of µ1 ≥ µ0 + d , the null hypothesis is falsly notrejected with probability

Prµ1

( |x − µ0|s/√

n≤ t1−α

2 ,n−1

).

This probability should be smaller than β.

Page 40: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

General explanation

Aim: Choose n such that we fail to reject the null hypothesis (i.e.falsely do not reject it) with probability β or less in cases where itdoes not hold and the true mean is ≥ d .

The null hypothesis is not rejected if

|x − µ0|s/√

n≤ t1−α

2 ,n−1.

If the null hypothesis is not true and the true distribution has atrue mean of µ1 ≥ µ0 + d , the null hypothesis is falsly notrejected with probability

Prµ1

( |x − µ0|s/√

n≤ t1−α

2 ,n−1

).

This probability should be smaller than β.

Page 41: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

General explanation

Now we use that x−µ1s/√

n under the assumption of µ1 ≥ d is t-distributedwith df=n-1:

Prµ1

(|x − µ0|s/√

n≤ t1−α

2 ,n−1

)

≤ Prµ1

(x − µ0

s/√

n≤ t1−α

2 ,n−1

)= Prµ1

(x − µ1

s/√

n≤ µ0 − µ1

s/√

n+ t1−α

2 ,n−1

)This is smaller than β, if

µ0 − µ1

s/√

n+ t1−α

2 ,n−1 ≤ tβ,n−1 = −t1−β,n−1

da tβ,n−1 so gewahlt ist, dass pt(tβ,n−1,df=n-1)==β.

Page 42: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

General explanation

Now we use that x−µ1s/√

n under the assumption of µ1 ≥ d is t-distributedwith df=n-1:

Prµ1

(|x − µ0|s/√

n≤ t1−α

2 ,n−1

)≤ Prµ1

(x − µ0

s/√

n≤ t1−α

2 ,n−1

)

= Prµ1

(x − µ1

s/√

n≤ µ0 − µ1

s/√

n+ t1−α

2 ,n−1

)This is smaller than β, if

µ0 − µ1

s/√

n+ t1−α

2 ,n−1 ≤ tβ,n−1 = −t1−β,n−1

da tβ,n−1 so gewahlt ist, dass pt(tβ,n−1,df=n-1)==β.

Page 43: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

General explanation

Now we use that x−µ1s/√

n under the assumption of µ1 ≥ d is t-distributedwith df=n-1:

Prµ1

(|x − µ0|s/√

n≤ t1−α

2 ,n−1

)≤ Prµ1

(x − µ0

s/√

n≤ t1−α

2 ,n−1

)= Prµ1

(x − µ1

s/√

n≤ µ0 − µ1

s/√

n+ t1−α

2 ,n−1

)

This is smaller than β, if

µ0 − µ1

s/√

n+ t1−α

2 ,n−1 ≤ tβ,n−1 = −t1−β,n−1

da tβ,n−1 so gewahlt ist, dass pt(tβ,n−1,df=n-1)==β.

Page 44: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

General explanation

Now we use that x−µ1s/√

n under the assumption of µ1 ≥ d is t-distributedwith df=n-1:

Prµ1

(|x − µ0|s/√

n≤ t1−α

2 ,n−1

)≤ Prµ1

(x − µ0

s/√

n≤ t1−α

2 ,n−1

)= Prµ1

(x − µ1

s/√

n≤ µ0 − µ1

s/√

n+ t1−α

2 ,n−1

)This is smaller than β, if

µ0 − µ1

s/√

n+ t1−α

2 ,n−1 ≤ tβ,n−1 = −t1−β,n−1

da tβ,n−1 so gewahlt ist, dass pt(tβ,n−1,df=n-1)==β.

Page 45: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

General explanation

This is smaller than β, if

µ0 − µ1

s/√

n+ t1−α

2 ,n−1 ≤ tβ,n−1 = −t1−β,n−1

Therefore, we obtain (by Multiplikation with µ0 − µ1 < 0, ≤ turnsinto ≥)

√n

s≥−t1−β,n−1 − t1−α

2 ,n−1

µ0 − µ1=

t1−β,n−1 + t1−α2 ,n−1

µ1 − µ0

If µ1 − µ0 ≈ d , then the sample size must be at least

n ≥s2 · (t1−α

2 ,n−1 + t1−β,n−1)2

d2 .

Page 46: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

General explanation

This is smaller than β, if

µ0 − µ1

s/√

n+ t1−α

2 ,n−1 ≤ tβ,n−1 = −t1−β,n−1

Therefore, we obtain (by Multiplikation with µ0 − µ1 < 0, ≤ turnsinto ≥)

√n

s≥−t1−β,n−1 − t1−α

2 ,n−1

µ0 − µ1=

t1−β,n−1 + t1−α2 ,n−1

µ1 − µ0

If µ1 − µ0 ≈ d , then the sample size must be at least

n ≥s2 · (t1−α

2 ,n−1 + t1−β,n−1)2

d2 .

Page 47: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-Sample Tests

General explanation

This is smaller than β, if

µ0 − µ1

s/√

n+ t1−α

2 ,n−1 ≤ tβ,n−1 = −t1−β,n−1

Therefore, we obtain (by Multiplikation with µ0 − µ1 < 0, ≤ turnsinto ≥)

√n

s≥−t1−β,n−1 − t1−α

2 ,n−1

µ0 − µ1=

t1−β,n−1 + t1−α2 ,n−1

µ1 − µ0

If µ1 − µ0 ≈ d , then the sample size must be at least

n ≥s2 · (t1−α

2 ,n−1 + t1−β,n−1)2

d2 .

Page 48: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Two-sample t-Tests

Contents1 Warning2 Sample sizes

General considerationsOne-Sample TestsTwo-sample t-TestsOne-sided testsOverviewCalculating sample sizes with R

Comparing proportionsF-Test

3 How to sampleExaggerated examplesRandomized Sampleselimination of disturbing factorsBalanced Design vs Non-Balanced Design

Page 49: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Two-sample t-Tests

Example: Back theeths of Hipparions

HipparionPanicum miliaceum

(c) public domain

Page 50: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Two-sample t-Tests

Back teeths of HipparionsQuestion: Is there a difference in the mesiodistal length (mm) ofthe molars of Hipparion africanum and Hipparion libycumPlanned Test:

two-sided unpaired two-sample t-Test.Aim: Detect differences if they are larger than d = 2.5 mm.

Significance level α = 5%. Power 1− β = 80%.Prior knowledge: Standard deviation in H. africanum is about

sA = 2.2. Standard deviation in H. libycum is aboutsL = 4.3.

Question: For how many molars do we need to measure themesiodistal length?Solution: The sample size n of each group must fulfill

n ≥(s2

A + s2L) · (t1−α

2 ,2∗n−2 + t1−β,2∗n−2)2

d2 .

Page 51: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Two-sample t-Tests

Back teeths of HipparionsQuestion: Is there a difference in the mesiodistal length (mm) ofthe molars of Hipparion africanum and Hipparion libycumPlanned Test:

two-sided unpaired two-sample t-Test.Aim: Detect differences if they are larger than d = 2.5 mm.

Significance level α = 5%. Power 1− β = 80%.

Prior knowledge: Standard deviation in H. africanum is aboutsA = 2.2. Standard deviation in H. libycum is aboutsL = 4.3.

Question: For how many molars do we need to measure themesiodistal length?Solution: The sample size n of each group must fulfill

n ≥(s2

A + s2L) · (t1−α

2 ,2∗n−2 + t1−β,2∗n−2)2

d2 .

Page 52: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Two-sample t-Tests

Back teeths of HipparionsQuestion: Is there a difference in the mesiodistal length (mm) ofthe molars of Hipparion africanum and Hipparion libycumPlanned Test:

two-sided unpaired two-sample t-Test.Aim: Detect differences if they are larger than d = 2.5 mm.

Significance level α = 5%. Power 1− β = 80%.Prior knowledge: Standard deviation in H. africanum is about

sA = 2.2. Standard deviation in H. libycum is aboutsL = 4.3.

Question: For how many molars do we need to measure themesiodistal length?

Solution: The sample size n of each group must fulfill

n ≥(s2

A + s2L) · (t1−α

2 ,2∗n−2 + t1−β,2∗n−2)2

d2 .

Page 53: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Two-sample t-Tests

Back teeths of HipparionsQuestion: Is there a difference in the mesiodistal length (mm) ofthe molars of Hipparion africanum and Hipparion libycumPlanned Test:

two-sided unpaired two-sample t-Test.Aim: Detect differences if they are larger than d = 2.5 mm.

Significance level α = 5%. Power 1− β = 80%.Prior knowledge: Standard deviation in H. africanum is about

sA = 2.2. Standard deviation in H. libycum is aboutsL = 4.3.

Question: For how many molars do we need to measure themesiodistal length?Solution: The sample size n of each group must fulfill

n ≥(s2

A + s2L) · (t1−α

2 ,2∗n−2 + t1−β,2∗n−2)2

d2 .

Page 54: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Two-sample t-Tests

Example: Back teeths of Hipparions

n0 =(s2

A + s2L) · (z1−α

2+ z1−β)2

d2

=(2.22 + 4.32) · (z0.975 + z0.8)

2

2.52 = 29.3 ∼ 30

n1 =(s2

A + s2L) · (t1−α

2 ,2∗n0−2 + t1−β,2∗n0−2)2

d2

=(2.22 + 4.32) · (t0.975,58 + t0.8,58)

2

(2.5)2

= 30.3 ∼ 31

n2 =(s2

A + s2L) · (t1−α

2 ,2∗n1−2 + t1−β,2∗n1−2)2

d2

= 30.28 ∼ 31

Page 55: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Two-sample t-Tests

Example: Back teeths of Hipparions

n0 =(s2

A + s2L) · (z1−α

2+ z1−β)2

d2

=(2.22 + 4.32) · (z0.975 + z0.8)

2

2.52 = 29.3 ∼ 30

n1 =(s2

A + s2L) · (t1−α

2 ,2∗n0−2 + t1−β,2∗n0−2)2

d2

=(2.22 + 4.32) · (t0.975,58 + t0.8,58)

2

(2.5)2

= 30.3 ∼ 31

n2 =(s2

A + s2L) · (t1−α

2 ,2∗n1−2 + t1−β,2∗n1−2)2

d2

= 30.28 ∼ 31

Page 56: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Two-sample t-Tests

Example: Back teeths of Hipparions

n0 =(s2

A + s2L) · (z1−α

2+ z1−β)2

d2

=(2.22 + 4.32) · (z0.975 + z0.8)

2

2.52 = 29.3 ∼ 30

n1 =(s2

A + s2L) · (t1−α

2 ,2∗n0−2 + t1−β,2∗n0−2)2

d2

=(2.22 + 4.32) · (t0.975,58 + t0.8,58)

2

(2.5)2

= 30.3 ∼ 31

n2 =(s2

A + s2L) · (t1−α

2 ,2∗n1−2 + t1−β,2∗n1−2)2

d2

= 30.28 ∼ 31

Page 57: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Two-sample t-Tests

Example: Back teeths of Hipparions

Result: We have to measure at least 31 molars of H. africanumand 31 molars of H. libycum.

Page 58: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-sided tests

Contents1 Warning2 Sample sizes

General considerationsOne-Sample TestsTwo-sample t-TestsOne-sided testsOverviewCalculating sample sizes with R

Comparing proportionsF-Test

3 How to sampleExaggerated examplesRandomized Sampleselimination of disturbing factorsBalanced Design vs Non-Balanced Design

Page 59: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-sided tests

For one-sided testing we have to replace t1−α2 ,n−1 by t1−α,n−1 in

the formulas above.

Page 60: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-sided tests

Example: Growth hormon

Frage: We have to test a putative growth hormon. Is its effectsignificantly better than that of a placebo?Planned test: one-sided unpaired two-sample t-test.Aim: Find differences if they are larger than d = 2.

level of significance α = 5%. Power 1− β = 80%.

Prior knowledge: Standard deviation in each groupapprox.s = 4.Question: How many rats do we need for the test group andhow many for the control group? Solution: The number of ratsin each group must fulfill

n ≥ (s2 + s2) · (t1−α,2∗n−2 + t1−β,2∗n−2)2

d2

Result: n = 51.

Page 61: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-sided tests

Example: Growth hormon

Frage: We have to test a putative growth hormon. Is its effectsignificantly better than that of a placebo?Planned test: one-sided unpaired two-sample t-test.Aim: Find differences if they are larger than d = 2.

level of significance α = 5%. Power 1− β = 80%.Prior knowledge: Standard deviation in each groupapprox.s = 4.Question: How many rats do we need for the test group andhow many for the control group?

Solution: The number of ratsin each group must fulfill

n ≥ (s2 + s2) · (t1−α,2∗n−2 + t1−β,2∗n−2)2

d2

Result: n = 51.

Page 62: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes One-sided tests

Example: Growth hormon

Frage: We have to test a putative growth hormon. Is its effectsignificantly better than that of a placebo?Planned test: one-sided unpaired two-sample t-test.Aim: Find differences if they are larger than d = 2.

level of significance α = 5%. Power 1− β = 80%.Prior knowledge: Standard deviation in each groupapprox.s = 4.Question: How many rats do we need for the test group andhow many for the control group? Solution: The number of ratsin each group must fulfill

n ≥ (s2 + s2) · (t1−α,2∗n−2 + t1−β,2∗n−2)2

d2

Result: n = 51.

Page 63: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Overview

Contents1 Warning2 Sample sizes

General considerationsOne-Sample TestsTwo-sample t-TestsOne-sided testsOverviewCalculating sample sizes with R

Comparing proportionsF-Test

3 How to sampleExaggerated examplesRandomized Sampleselimination of disturbing factorsBalanced Design vs Non-Balanced Design

Page 64: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Overview

Two-sided one-sample t-Test

Planned test: Two-sided one-sample t-test.

Aim: Find differences that are larger then d . Level ofsignificance α. Power 1− β.

Prior knowledge: Standard deviation in prior test was s

Solution: The following must be fulfilled.

n ≥s2 · (t1−α

2 ,n−1 + t1−β,n−1)2

d2

Page 65: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Overview

two-sided unpaired two-sample t-test

Planned Test: two-sided unpaired two-sample t-test

Aim: Detect differences, that are larger d .Significance level α. Power 1− β.

Prior knowledge: The standard deviation in the two groups ares1 and s2, respectively.

Solution: In each group the sample size must fulfill

n ≥(s2

1 + s22) · (t1−α

2 ,2∗n−2 + t1−β,2∗n−2)2

d2 .

Page 66: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Overview

Two-sided paired two-sample t-Test

Planned Test: Two-sided paired two-sample t-test.

Aim: Find differences if they are larger than d .Significance level α. Power 1− β.

Prior knowledge: Standard deviation of the differences isapproximately sd .

Solution: The number n of sampled pairs must fulfill

n ≥s2

d · (t1−α2 ,n−1 + t1−β,n−1)

2

d2 .

Page 67: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Overview

One-sided one-sample t-test

Planned Test: one-sided one-sample t-Test.

Aim: Find differences that are larger than d . Level ofsignificance α. Power 1− β.

Prior knowledge: Standard deviation in prior sample was s

Solution: The sample size n must fulfill

n ≥ s2 · (t1−α,n−1 + t1−β,n−1)2

d2 .

Page 68: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Overview

One-sided unpaired two-sample t-Test

Planned Test:One-sided unpaired two-sample t-Test.

Ziel: Detect difference if it is larger than d .Level of significance α. Power 1− β.

Prior knowledge: The standard deviations in the two groupsare s1 and s2.

Solution: The sample size n for each group must fulfill

n ≥ (s21 + s2

2) · (t1−α,2∗n−2 + t1−β,2∗n−2)2

d2 .

Page 69: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Overview

One-sided paired Two-sample t-Test

Geplanter Test: One-sided paired Two-sample t-Test.

Aim: Find differences if they are larger than d .Significance level α. Power 1− β.

Prior knowledge: Standard deviateion of the differences isapproximately sd .

Solution: The number of pairs should fulfill

n ≥ s2d · (t1−α,n−1 + t1−β,n−1)

2

d2 .

Page 70: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Calculating sample sizes with R

Contents1 Warning2 Sample sizes

General considerationsOne-Sample TestsTwo-sample t-TestsOne-sided testsOverviewCalculating sample sizes with R

Comparing proportionsF-Test

3 How to sampleExaggerated examplesRandomized Sampleselimination of disturbing factorsBalanced Design vs Non-Balanced Design

Page 71: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Calculating sample sizes with R

In R we can compute the necessary sample size with:

power.t.test(n = , delta = , sd = , sig.level = ,

power = ,

type = c("two.sample","one.sample","paired"),

alternative = c("two.sided", "one.sided") )

The parameters are:

n = sample size per group or per sampledelta = d detection levelsd = s approx. standard deviation in each groupsig.level = α level of significancepower = 1− β power

One and only one of these parametersn,delta,sd,sig.level,power must be set to NULL. Thisparameter will be computed.

Page 72: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Calculating sample sizes with R

In R we can compute the necessary sample size with:

power.t.test(n = , delta = , sd = , sig.level = ,

power = ,

type = c("two.sample","one.sample","paired"),

alternative = c("two.sided", "one.sided") )

The parameters are:n = sample size per group or per sample

delta = d detection levelsd = s approx. standard deviation in each groupsig.level = α level of significancepower = 1− β power

One and only one of these parametersn,delta,sd,sig.level,power must be set to NULL. Thisparameter will be computed.

Page 73: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Calculating sample sizes with R

In R we can compute the necessary sample size with:

power.t.test(n = , delta = , sd = , sig.level = ,

power = ,

type = c("two.sample","one.sample","paired"),

alternative = c("two.sided", "one.sided") )

The parameters are:n = sample size per group or per sampledelta = d detection level

sd = s approx. standard deviation in each groupsig.level = α level of significancepower = 1− β power

One and only one of these parametersn,delta,sd,sig.level,power must be set to NULL. Thisparameter will be computed.

Page 74: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Calculating sample sizes with R

In R we can compute the necessary sample size with:

power.t.test(n = , delta = , sd = , sig.level = ,

power = ,

type = c("two.sample","one.sample","paired"),

alternative = c("two.sided", "one.sided") )

The parameters are:n = sample size per group or per sampledelta = d detection levelsd = s approx. standard deviation in each group

sig.level = α level of significancepower = 1− β power

One and only one of these parametersn,delta,sd,sig.level,power must be set to NULL. Thisparameter will be computed.

Page 75: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Calculating sample sizes with R

In R we can compute the necessary sample size with:

power.t.test(n = , delta = , sd = , sig.level = ,

power = ,

type = c("two.sample","one.sample","paired"),

alternative = c("two.sided", "one.sided") )

The parameters are:n = sample size per group or per sampledelta = d detection levelsd = s approx. standard deviation in each groupsig.level = α level of significance

power = 1− β powerOne and only one of these parametersn,delta,sd,sig.level,power must be set to NULL. Thisparameter will be computed.

Page 76: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Calculating sample sizes with R

In R we can compute the necessary sample size with:

power.t.test(n = , delta = , sd = , sig.level = ,

power = ,

type = c("two.sample","one.sample","paired"),

alternative = c("two.sided", "one.sided") )

The parameters are:n = sample size per group or per sampledelta = d detection levelsd = s approx. standard deviation in each groupsig.level = α level of significancepower = 1− β power

One and only one of these parametersn,delta,sd,sig.level,power must be set to NULL. Thisparameter will be computed.

Page 77: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Calculating sample sizes with R

In R we can compute the necessary sample size with:

power.t.test(n = , delta = , sd = , sig.level = ,

power = ,

type = c("two.sample","one.sample","paired"),

alternative = c("two.sided", "one.sided") )

The parameters are:n = sample size per group or per sampledelta = d detection levelsd = s approx. standard deviation in each groupsig.level = α level of significancepower = 1− β power

One and only one of these parametersn,delta,sd,sig.level,power must be set to NULL. Thisparameter will be computed.

Page 78: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Calculating sample sizes with R

Example:CCRT in D. ananassae: d = 4, s = 11.9, α = 5%, β = 0.2

> power.t.test(n=NULL, delta=4, sd=11.9,

+ sig.level=0.05, power=0.8,

+ type="one.sample", alternative="two.sided")

One-sample t test power calculation

n = 71.41203

delta = 4

sd = 11.9

sig.level = 0.05

power = 0.8

alternative = two.sided

Page 79: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Calculating sample sizes with R

Example:CCRT in D. ananassae: d = 4, s = 11.9, α = 5%, β = 0.2

> power.t.test(n=NULL, delta=4, sd=11.9,

+ sig.level=0.05, power=0.8,

+ type="one.sample", alternative="two.sided")

One-sample t test power calculation

n = 71.41203

delta = 4

sd = 11.9

sig.level = 0.05

power = 0.8

alternative = two.sided

Page 80: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Calculating sample sizes with R

Example:CCRT in D. ananassae: d = 4, s = 11.9, α = 5%, β = 0.2

> power.t.test(n=NULL, delta=4, sd=11.9,

+ sig.level=0.05, power=0.8,

+ type="one.sample", alternative="two.sided")

One-sample t test power calculation

n = 71.41203

delta = 4

sd = 11.9

sig.level = 0.05

power = 0.8

alternative = two.sided

Page 81: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Calculating sample sizes with R

Back teeths of Hipparions:d = 2.5, s =

√(2.22 + 4.32)/2, α = 5%, β = 0.2

> power.t.test(n=NULL, delta=2.5,

+ sd=sqrt( (2.2^2+4.3^2)/2 ),

+ sig.level=0.05, power=0.8,

+ type="two.sample", alternative="two.sided")

Two-sample t test power calculation

n = 30.28929

delta = 2.5

sd = 3.415406

sig.level = 0.05

power = 0.8

alternative = two.sided

NOTE: n is number in *each* group

Page 82: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Calculating sample sizes with R

Back teeths of Hipparions:d = 2.5, s =

√(2.22 + 4.32)/2, α = 5%, β = 0.2

> power.t.test(n=NULL, delta=2.5,

+ sd=sqrt( (2.2^2+4.3^2)/2 ),

+ sig.level=0.05, power=0.8,

+ type="two.sample", alternative="two.sided")

Two-sample t test power calculation

n = 30.28929

delta = 2.5

sd = 3.415406

sig.level = 0.05

power = 0.8

alternative = two.sided

NOTE: n is number in *each* group

Page 83: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Calculating sample sizes with R

Growth hormons: (one-sided Test)d = 2, s = 4, α = 5%, β = 0.2

> power.t.test(n=NULL, delta=2, sd=4,

+ sig.level=0.05, power=0.8,

+ type="two.sample", alternative="one.sided")

Two-sample t test power calculation

n = 50.1508

delta = 2

sd = 4

sig.level = 0.05

power = 0.8

alternative = one.sided

NOTE: n is number in *each* group

Page 84: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Calculating sample sizes with R

Growth hormons: (one-sided Test)d = 2, s = 4, α = 5%, β = 0.2

> power.t.test(n=NULL, delta=2, sd=4,

+ sig.level=0.05, power=0.8,

+ type="two.sample", alternative="one.sided")

Two-sample t test power calculation

n = 50.1508

delta = 2

sd = 4

sig.level = 0.05

power = 0.8

alternative = one.sided

NOTE: n is number in *each* group

Page 85: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Calculating sample sizes with R

The command power.t.test() can also be used to computethe power of the test for a given sample size.

Example:CCRT in D. ananassae: n = 100, d = 4, s = 11.9, α = 5%

> power.t.test(n=100, delta=4, sd=11.9,

+ sig.level=0.05, power=NULL,

+ type="one.sample", alternative="two.sided")

One-sample t test power calculation

n = 100

delta = 4

sd = 11.9

sig.level = 0.05

power = 0.9144375

alternative = two.sided

Page 86: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Calculating sample sizes with R

The command power.t.test() can also be used to computethe power of the test for a given sample size.Example:CCRT in D. ananassae: n = 100, d = 4, s = 11.9, α = 5%

> power.t.test(n=100, delta=4, sd=11.9,

+ sig.level=0.05, power=NULL,

+ type="one.sample", alternative="two.sided")

One-sample t test power calculation

n = 100

delta = 4

sd = 11.9

sig.level = 0.05

power = 0.9144375

alternative = two.sided

Page 87: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Comparing proportions

Contents1 Warning2 Sample sizes

General considerationsOne-Sample TestsTwo-sample t-TestsOne-sided testsOverviewCalculating sample sizes with R

Comparing proportionsF-Test

3 How to sampleExaggerated examplesRandomized Sampleselimination of disturbing factorsBalanced Design vs Non-Balanced Design

Page 88: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Comparing proportions

Comparing proportions

Example: Is the sex ratio in cowbird immediately after hatchingfrom the sex ratio in adult cowbirds?

photo (c) public domain

Page 89: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Comparing proportions

Comparing proportions

We can use the R command power.prop.test.

We need to have guess the proportions, lets say we guess thatthe proportion of females is 0.45 after hatching and 0.5 for adultbirds.

As always we have to specify the significance level and the testpower.

Page 90: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Comparing proportions

Comparing proportions

We can use the R command power.prop.test.

We need to have guess the proportions, lets say we guess thatthe proportion of females is 0.45 after hatching and 0.5 for adultbirds.

As always we have to specify the significance level and the testpower.

Page 91: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Comparing proportions

Comparing proportions

We can use the R command power.prop.test.

We need to have guess the proportions, lets say we guess thatthe proportion of females is 0.45 after hatching and 0.5 for adultbirds.

As always we have to specify the significance level and the testpower.

Page 92: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Comparing proportions

> power.prop.test(n=NULL,p1=0.45,p2=0.5,sig.level=0.05,power=0.8)

Two-sample comparison of proportions power calculation

n = 1564.672

p1 = 0.45

p2 = 0.5

sig.level = 0.05

power = 0.8

alternative = two.sided

NOTE: n is number in *each* group

The required sample sizes are immense and should make usthink whether it is worth starting this project.

Page 93: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes Comparing proportions

> power.prop.test(n=NULL,p1=0.45,p2=0.5,sig.level=0.05,power=0.8)

Two-sample comparison of proportions power calculation

n = 1564.672

p1 = 0.45

p2 = 0.5

sig.level = 0.05

power = 0.8

alternative = two.sided

NOTE: n is number in *each* group

The required sample sizes are immense and should make usthink whether it is worth starting this project.

Page 94: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes F-Test

Contents1 Warning2 Sample sizes

General considerationsOne-Sample TestsTwo-sample t-TestsOne-sided testsOverviewCalculating sample sizes with R

Comparing proportionsF-Test

3 How to sampleExaggerated examplesRandomized Sampleselimination of disturbing factorsBalanced Design vs Non-Balanced Design

Page 95: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes F-Test

Example: Blood clotting times in rats.

Question: Does the clotting time depend on which of fourtreetments is applied.

Planned Test: F-Test.

Significance level: α = 5%

Power: 1− β = 90%.

Prior knowledge: Standard deviation in each group is aboutswithin = 2.4. Note: s2

within = SSwithin/ dfwithin.Standard deviation between the groups is about sbtw = 1.2.Note: s2

btw = SSbtw/ dfbtw.

Question: How many rats do we need?

Page 96: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes F-Test

Example: Blood clotting times in rats.

Question: Does the clotting time depend on which of fourtreetments is applied.

Planned Test: F-Test.

Significance level: α = 5%

Power: 1− β = 90%.

Prior knowledge: Standard deviation in each group is aboutswithin = 2.4. Note: s2

within = SSwithin/ dfwithin.Standard deviation between the groups is about sbtw = 1.2.Note: s2

btw = SSbtw/ dfbtw.

Question: How many rats do we need?

Page 97: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes F-Test

Example: Blood clotting times in rats.

Question: Does the clotting time depend on which of fourtreetments is applied.

Planned Test: F-Test.

Significance level: α = 5%

Power: 1− β = 90%.

Prior knowledge: Standard deviation in each group is aboutswithin = 2.4. Note: s2

within = SSwithin/ dfwithin.Standard deviation between the groups is about sbtw = 1.2.Note: s2

btw = SSbtw/ dfbtw.

Question: How many rats do we need?

Page 98: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

Sample sizes F-Test

Example: Blood clotting times in rats.

> power.anova.test(groups=4, n=NULL, between.var=1.2^2,

+ within.var=2.4^2, sig.level=0.05, power=0.9)

Balanced one-way analysis of variance power calculation

groups = 4

n = 19.90248

between.var = 1.44

within.var = 5.76

sig.level = 0.05

power = 0.9

NOTE: n is number in each group

Answer: We need 80 rats, 20 Ratten for each treatment.

Page 99: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample

Contents1 Warning2 Sample sizes

General considerationsOne-Sample TestsTwo-sample t-TestsOne-sided testsOverviewCalculating sample sizes with R

Comparing proportionsF-Test

3 How to sampleExaggerated examplesRandomized Sampleselimination of disturbing factorsBalanced Design vs Non-Balanced Design

Page 100: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Exaggerated examples

Contents1 Warning2 Sample sizes

General considerationsOne-Sample TestsTwo-sample t-TestsOne-sided testsOverviewCalculating sample sizes with R

Comparing proportionsF-Test

3 How to sampleExaggerated examplesRandomized Sampleselimination of disturbing factorsBalanced Design vs Non-Balanced Design

Page 101: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Exaggerated examples

We illustrate the problems of finding and appropriate samplingscheme with exaggerated examples.

To predict the results of the next elections for the Germangovernment we ask 1000 adult inhabitants of Martinsriedwhich party they will vote. Sample not representative!

Page 102: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Exaggerated examples

We illustrate the problems of finding and appropriate samplingscheme with exaggerated examples.

To predict the results of the next elections for the Germangovernment we ask 1000 adult inhabitants of Martinsriedwhich party they will vote.

Sample not representative!

Page 103: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Exaggerated examples

We illustrate the problems of finding and appropriate samplingscheme with exaggerated examples.

To predict the results of the next elections for the Germangovernment we ask 1000 adult inhabitants of Martinsriedwhich party they will vote. Sample not representative!

Page 104: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Exaggerated examples

photo (c) Andre Karwath (Bild zeigt eine Drosophila melanogaster )

To compare the Chill-Coma Recovery Time (CCRT) of theEuropean Drosophila melanogaster population with that ofthe Taiwanese D. melanogaster population we sample fliesfrom 30 different places in France, Spain and Italy.

No representative sample!

Northern Europe is underrepresented.

Page 105: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Exaggerated examples

photo (c) Andre Karwath (Bild zeigt eine Drosophila melanogaster )

To compare the Chill-Coma Recovery Time (CCRT) of theEuropean Drosophila melanogaster population with that ofthe Taiwanese D. melanogaster population we sample fliesfrom 30 different places in France, Spain and Italy.

No representative sample!

Northern Europe is underrepresented.

Page 106: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Exaggerated examples

photo (c) Andre Karwath (Bild zeigt eine Drosophila melanogaster )

To compare the Chill-Coma Recovery Time (CCRT) of theEuropean Drosophila melanogaster population with that ofthe Taiwanese D. melanogaster population we sample fliesfrom 30 different places in France, Spain and Italy.

No representative sample!

Northern Europe is underrepresented.

Page 107: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Exaggerated examples

photo (c) Malene Thyssen (Bild zeigt einen Rotbuchenwald in Danemark)

To measure the density of leaves in Bavarian forests wewalk along several forest tracks in 10 randomly selectedforests and count the leaves.

No representative sample!

Trees may have more leaves if they stand at a forest track.

Page 108: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Exaggerated examples

photo (c) Malene Thyssen (Bild zeigt einen Rotbuchenwald in Danemark)

To measure the density of leaves in Bavarian forests wewalk along several forest tracks in 10 randomly selectedforests and count the leaves.

No representative sample!

Trees may have more leaves if they stand at a forest track.

Page 109: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Exaggerated examples

photo (c) Malene Thyssen (Bild zeigt einen Rotbuchenwald in Danemark)

To measure the density of leaves in Bavarian forests wewalk along several forest tracks in 10 randomly selectedforests and count the leaves.

No representative sample!

Trees may have more leaves if they stand at a forest track.

Page 110: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Exaggerated examples

20 randomly selected students are invited to participate in asurvey. The first 10 Students that arrive get a glass of waterbefore they have to solve some exercises, the other 10students get a cup of coffee.

The two groups are not identically distributed!

The students of the first group were in time, which maymean that they are themore efficient students.

Page 111: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Exaggerated examples

20 randomly selected students are invited to participate in asurvey. The first 10 Students that arrive get a glass of waterbefore they have to solve some exercises, the other 10students get a cup of coffee.

The two groups are not identically distributed!

The students of the first group were in time, which maymean that they are themore efficient students.

Page 112: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Exaggerated examples

20 randomly selected students are invited to participate in asurvey. The first 10 Students that arrive get a glass of waterbefore they have to solve some exercises, the other 10students get a cup of coffee.

The two groups are not identically distributed!

The students of the first group were in time, which maymean that they are themore efficient students.

Page 113: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Randomized Samples

Contents1 Warning2 Sample sizes

General considerationsOne-Sample TestsTwo-sample t-TestsOne-sided testsOverviewCalculating sample sizes with R

Comparing proportionsF-Test

3 How to sampleExaggerated examplesRandomized Sampleselimination of disturbing factorsBalanced Design vs Non-Balanced Design

Page 114: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Randomized Samples

Example

Aim: We would like to accomplish a survey with a representativesample of 50 Biology students. The best way to make sure thatthe sample is representative is to select them randomly. Thismeans not arbitrary but with the help of a random generator.

If the total number N of students is known we can give eachstudent a number from 1 to N and then sample the numbers ofthe 50 students by

sample(1:N, size=50, replace=FALSE)

Page 115: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Randomized Samples

Example

Aim: We would like to accomplish a survey with a representativesample of 50 Biology students. The best way to make sure thatthe sample is representative is to select them randomly. Thismeans not arbitrary but with the help of a random generator.

If the total number N of students is known we can give eachstudent a number from 1 to N and then sample the numbers ofthe 50 students by

sample(1:N, size=50, replace=FALSE)

Page 116: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Randomized Samples

This is sometimes impossible becausethe total size of the population is unknown (zB: Number ofAnts or D. melanogaster)it may be difficult to assing a number to each individual in alarge population.

Page 117: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Randomized Samples

Example

Aim: Sample 100 mice.Note: For the statistical analysis we need independence.Especially, the mice must not be closely related.

Wrong: 100 mice from the same farm.

Practical approach, accepted in scientific publications:One mouse per farmDistance between farms must be more than 1km.

Page 118: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Randomized Samples

Example

Aim: Sample 100 mice.Note: For the statistical analysis we need independence.Especially, the mice must not be closely related.

Wrong: 100 mice from the same farm.

Practical approach, accepted in scientific publications:One mouse per farmDistance between farms must be more than 1km.

Page 119: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Randomized Samples

Example

Aim: Sample 100 mice.Note: For the statistical analysis we need independence.Especially, the mice must not be closely related.

Wrong: 100 mice from the same farm.

Practical approach, accepted in scientific publications:One mouse per farmDistance between farms must be more than 1km.

Page 120: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Randomized Samples

Example

Note: If all mice are sampled in southern Bavaria, they may berepresentative for mice in southern Bavaria but not for Germanor European mice.

Page 121: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample elimination of disturbing factors

Contents1 Warning2 Sample sizes

General considerationsOne-Sample TestsTwo-sample t-TestsOne-sided testsOverviewCalculating sample sizes with R

Comparing proportionsF-Test

3 How to sampleExaggerated examplesRandomized Sampleselimination of disturbing factorsBalanced Design vs Non-Balanced Design

Page 122: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample elimination of disturbing factors

Try to keep factors constant:Same experimenter for all experiments

In Medicine: double-blindThe same or at least equal lab conditionsRandomized sequence of test group and control group (Noteven: test, control, test, control,... . . . )

Page 123: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample elimination of disturbing factors

Try to keep factors constant:Same experimenter for all experimentsIn Medicine: double-blind

The same or at least equal lab conditionsRandomized sequence of test group and control group (Noteven: test, control, test, control,... . . . )

Page 124: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample elimination of disturbing factors

Try to keep factors constant:Same experimenter for all experimentsIn Medicine: double-blindThe same or at least equal lab conditions

Randomized sequence of test group and control group (Noteven: test, control, test, control,... . . . )

Page 125: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample elimination of disturbing factors

Try to keep factors constant:Same experimenter for all experimentsIn Medicine: double-blindThe same or at least equal lab conditionsRandomized sequence of test group and control group (Noteven: test, control, test, control,... . . . )

Page 126: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Balanced Design vs Non-Balanced Design

Contents1 Warning2 Sample sizes

General considerationsOne-Sample TestsTwo-sample t-TestsOne-sided testsOverviewCalculating sample sizes with R

Comparing proportionsF-Test

3 How to sampleExaggerated examplesRandomized Sampleselimination of disturbing factorsBalanced Design vs Non-Balanced Design

Page 127: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Balanced Design vs Non-Balanced Design

Balanced Design means that the sample size is the same for allgroups (and all combination of factors).

For experimental data

with controlled conditions, a balanced design is usuallypreferred. Advantage:

Many statistical methods require a balanced design. (z.BTukey’s HSD).

Disadavantage:Sample not representative

Page 128: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Balanced Design vs Non-Balanced Design

Balanced Design means that the sample size is the same for allgroups (and all combination of factors). For experimental data

with controlled conditions, a balanced design is usuallypreferred.

Advantage:

Many statistical methods require a balanced design. (z.BTukey’s HSD).

Disadavantage:Sample not representative

Page 129: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Balanced Design vs Non-Balanced Design

Balanced Design means that the sample size is the same for allgroups (and all combination of factors). For experimental data

with controlled conditions, a balanced design is usuallypreferred. Advantage:

Many statistical methods require a balanced design. (z.BTukey’s HSD).

Disadavantage:Sample not representative

Page 130: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Balanced Design vs Non-Balanced Design

Balanced Design means that the sample size is the same for allgroups (and all combination of factors). For experimental data

with controlled conditions, a balanced design is usuallypreferred. Advantage:

Many statistical methods require a balanced design. (z.BTukey’s HSD).

Disadavantage:Sample not representative

Page 131: Statistics for EES Design of Experimentsevol.bio.lmu.de/_statgen/StatEES/SS10/design.pdf · 2010. 7. 29. · In earlier experiments with Drosophila ananassae from Bangkok a mean CCRT

How to sample Balanced Design vs Non-Balanced Design

Balanced Design means that the sample size is the same for allgroups (and all combination of factors). For experimental data

with controlled conditions, a balanced design is usuallypreferred. Advantage:

Many statistical methods require a balanced design. (z.BTukey’s HSD).

Disadavantage:Sample not representative