statistics for ees design of experimentsevol.bio.lmu.de/_statgen/statees/ss10/design.pdf · 2010....
TRANSCRIPT
Statistics for EESDesign of Experiments
Dirk Metzler
http://evol.bio.lmu.de/_statgen
28. July 2010
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
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
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.
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.
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.
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.
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
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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
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
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?
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?
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?
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?
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...
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...
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...
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.
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.
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.
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.
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.
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.
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 .
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 .
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 β.
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 β.
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 β.
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)==β.
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)==β.
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)==β.
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)==β.
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 .
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 .
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 .
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
Sample sizes Two-sample t-Tests
Example: Back theeths of Hipparions
HipparionPanicum miliaceum
(c) public domain
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 .
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 .
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 .
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 .
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
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
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
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.
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
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.
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.
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.
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.
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
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
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 .
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 .
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 .
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 .
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 .
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
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.
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.
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.
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.
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.
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.
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.
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
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
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
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
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
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
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
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
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
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
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
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.
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.
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.
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.
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.
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
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?
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?
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?
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.
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
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
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!
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!
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!
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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)
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)
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.
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.
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.
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.
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.
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
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,... . . . )
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,... . . . )
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,... . . . )
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,... . . . )
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
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
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
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
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
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