Transcript effect size

SUMMARY
Homoscedasticity
http://blog.minitab.com/blog/statistics-and-quality-data-analysis/dont-be-a-victim-of-statistical-hippopotomonstrosesquipedaliophobia
Tests for homoscedasticity
β€’ 𝐻0 : 𝜎1 = 𝜎2
β€’ F-test of equality of variances (Hartley's test), 𝐹 𝑛𝐿 βˆ’
Power of the test
β€’ A probability that it correctly rejects the null hypothesis
(H0) when it is false.
β€’ Equivalently, it is the probability of correctly accepting the
alternative hypothesis (Ha) when it is true - that is, the ability of a
test to detect an effect, if the effect actually exists.
Probability of FP is Ξ±
Decision
Reject H0
State of
the world
H0 true
Retain H0
Type I error
H0 false
power = 1 - Ξ²
Type II error
Probability of FN is Ξ²
What factors affect the power?
To increase the power of your test, you may do any of the
following:
1. Increase the effect size (the difference between the null
and alternative values) to be detected
The reasoning is that any test will have trouble rejecting the null
hypothesis if the null hypothesis is only 'slightly' wrong. If the effect size is
large, then it is easier to detect and the null hypothesis will be soundly
rejected.
2. Increase the sample size(s) – power analysis
3. Decrease the variability in the sample(s)
4. Increase the significance level (Ξ±) of the test
The shortcoming of setting a higher Ξ± is that Type I errors will be more
likely. This may not be desirable.
NEW STUFF
Effect size
β€’ When a difference is statistically significant, it does not
necessarily mean that it is big, important or helpful in
decision-making. It simply means you can be confident
that there is a difference.
β€’ For example, you evaluate the effect of sun erruptions on
student knowledge (𝑛 = 2000).
β€’ The mean score on the pretest was 84 out of 100. The mean score
on the posttest was 83.
β€’ Although you find that the difference in scores is statistically
significant (because of a large sample size), the difference is very
small suggesting that erruptions do not lead to a meaningful
decrease in student knowledge.
Effect size
β€’ To know if an observed difference is not only statistically
significant, but also factually important, you have to
calculate its effect size.
β€’ The effect size in our case is 84 – 83 = 1.
β€’ The effect size is transformed on a common scale by
standardizing (i.e., the difference is divided by a s.d.).
Power analysis
β€’ To ensure that your sample size is big enough, you will
need to conduct a power analysis.
β€’ For any power calculation, you will need to know:
β€’ What type of test you plan to use (e.g., independent t-test)
β€’ The alpha value (usually 0.05)
β€’ The expected effect size
β€’ The sample size you are planning to use
β€’ Because the effect size can only be calculated after you
collect data, you will have to use an estimate for the
power analysis.
β€’ Cohen suggests that for t-test values of 0.2, 0.5, and 0.8 represent
small, medium and large effect sizes respectively.
Power analysis in R (paired t-test)
install.packages("pwr")
library(pwr)
pwr.t.test(d=0.8,power=0.8,sig.level=0.05,type="paired",alternative="two.sided")
Paired t test power calculation
n = 14.30278
d = 0.8
sig.level = 0.05
power = 0.8
alternative = two.sided
NOTE: n is number of *pairs*
Check for normality – histogram
Check for normality – QQ-plot
qqnorm(rivers)
qqline(rivers)
Check for normality – tests
β€’ The graphical methods for checking data normality still
leave much to your own interpretation. If you show any of
these plots to ten different statisticians, you can get ten
different answers.
β€’ H0: Data follow a normal distribution.
β€’ Shapiro-Wilk test
> shapiro.test(rivers)
Shapiro-Wilk normality test
data: rivers
W = 0.6666, p-value < 2.2e-16
p-value < 2.2e-16
log
p-value = 3.945e-05
Nonparametric statistics
β€’ Small samples from considerably non-normal
distributions.
β€’ non-parametric tests
β€’ No assumption about the shape of the distribution.
β€’ No assumption about the parameters of the distribution (thus they
are called non-parametric).
β€’ Simple to do, however their theory is extremely
complicated. Of course, we won't cover it at all.
β€’ However, they are less accurate than their parametric
counterparts.
β€’ So if your data fullfill the assumptions about normality, use
paramatric tests (t-test, F-test).
Nonparametric tests
β€’ If the normality assumption of the t-test is violated, then its
nonparametric alternative should be used.
β€’ The nonparametric alternative of t-test is Wilcoxon test.
β€’ wilcox.test()
β€’ http://stat.ethz.ch/R-manual/R-patched/library/stats/html/wilcox.test.html
ANOVA
(ANALÝZA ROZPTYLU)
A problem
β€’ You're comparing three brands of beer.
A problem
β€’ You buy four bottles of each brand for the following prices.
Primátor
Kocour
MatuΕ‘ka
15
39
65
12
45
45
14
48
32
11
60
38
β€’ What do you think, which of these brands have significantly
different prices?
β€’ No significant difference between any of these.
β€’ Primátor and Kocour
β€’ Primátor and MatuΕ‘ka
β€’ Kocour and MatuΕ‘ka
t-test
β€’ We can do three t-tests to show if there is a significant
difference between these brands.
β€’ How many t-tests would you need to compare four
samples?
β€’ 6
β€’ To compare 10 samples, you need 45 t-tests! This is a lot.
We don’t want to do a million t-tests.
β€’ But in this lesson you'll learn a simpler method.
β€’ Its called Analysis of variance (Analýza rozptylu) –
ANOVA.
Multiple comparisons problem
β€’ If you make two comparisons and assuming that both null
β€’
β€’
β€’
β€’
β€’
hypothesis are true, what is the chance that both
comparisons will not be statistically significant (𝛼 = 0.5)?
0.95 × 0.95 = 0.9025
And what is the chance that one or both comparisons will
result in a statistically significant conclusion just by
chance?
1.0 βˆ’ 0.9025 = 0.0975 ~ 10%
For N comparisons, this probability is generally 1.00 βˆ’
0.95𝑁.
So, for example, for 13 independent tests there is about
50:50 chance of obtaining at least one FP.
Multiple comparisons problem
Bennet et al., Journal of Serendipitous and Unexpected Results, 1, 1-5, 2010
http://www.graphpad.com/guides/prism/6/statistics/index.htm?beware_of_multiple_comparisons.htm
Correcting for multiple comparisons
β€’ Bonferroni correction – the simplest approach is to
divide the Ξ± value by the number of comparisons N. Then
define the particular comparison as statistically significant
when its p-value is less than 𝛼/𝑁.
β€’ For example, for 100 comparisons reject the null in each if
its p-value is less than 0.05 100 = 0.0005.
β€’ However, this is a bit too conservative, other approaches
exist.
> p.adjust()
β€’ β€œThere seems no reason to use the unmodified Bonferroni
correction because it is dominated by Holm's method”
Main idea of ANOVA
β€’ To compate three or more samples, we can use the same
ideas that underlie t-tests.
β€’ In t-test, the general form of t-statistic is
π‘₯1 βˆ’ π‘₯2
𝑑=
𝑆𝐸
Variability between sample
means
Error, variability within
samples
β€’ Similarly, for three or more samples we assess the
variability between sample means in numerator and the
error (variability within samples) in denominator.
Variability between sample means
Variability within samples
ANOVA hypothesis
β€’ 𝐻0 : πœ‡1 = πœ‡2 = πœ‡3
𝐻1 ∢ at least one pair of samples is significantly different
β€’ Follow-up multiple comparison steps – see which
means are different from each other.
F ratio
between βˆ’ group variability
𝐹=
within βˆ’ group variability
β€’ As between-group variability (variabilita mezi
skupinami) increases, F-statistic increases and this leans
more in favor of the alternative hypothesis that at least
one pair of means is significantly different.
β€’ As within-group variability (variabilita v rámci skupin)
increases, F-statistic decreases and this leans more in
favor of the null hypothesis that the means are not
siginificantly different.
Beer brands – a boxplot
13
π‘₯𝑃
Primátor
Kocour
MatuΕ‘ka
15
39
65
12
45
45
14
48
32
11
60
38
35
π‘₯𝐺
45
48
π‘₯𝐾 π‘₯𝑀
Between-group variability
SS – sum of squares, součet čtvercΕ―
MS – mean square, prΕ―mΔ›rný čtverec
SSB – součet čtvercΕ― mezi skupinami
MSB – prΕ―mΔ›rný čtverec mezi skupinami
π‘₯𝑃 βˆ’ π‘₯𝐺
2
π‘₯𝑀 βˆ’ π‘₯𝐺
π‘₯𝐾 βˆ’ π‘₯𝐺
13
π‘₯𝑃
35
π‘₯𝐺
2
𝑆𝑆𝐡 =
2
45
48
π‘₯𝐾 π‘₯𝑀
π‘›π‘˜ π‘₯π‘˜ βˆ’ π‘₯𝐺
2
π‘˜
𝑑𝑓𝐡 = π‘˜ βˆ’ 1
π‘˜ 𝑛𝐾 π‘₯π‘˜ βˆ’ π‘₯𝐺
𝑀𝑆𝐡 =
π‘˜βˆ’1
2
Within-group variability
SSW – součet čtvercΕ― uvnitΕ™ skupin
MSW – prΕ―mΔ›rný čtverec uvnitΕ™ skupin
π‘†π‘†π‘Š
π‘€π‘†π‘Š =
=
π‘‘π‘“π‘Š
π‘˜
π‘₯𝑖 βˆ’ π‘₯π‘˜
π‘βˆ’π‘˜
2
The summary of variabilities
π‘†π‘†π‘Š
π‘€π‘†π‘Š =
=
π‘‘π‘“π‘Š
π‘˜
π‘₯𝑖 βˆ’ π‘₯π‘˜
π‘βˆ’π‘˜
2
𝑆𝑆𝐡
𝑀𝑆𝐡 =
=
𝑑𝑓𝐡
π‘˜
π‘₯π‘˜ βˆ’ π‘₯𝐺
π‘˜βˆ’1
2
Primátor
Kocour
MatuΕ‘ka
15
39
65
β€’ π‘₯π‘˜ ... sample mean
12
45
45
β€’ 𝑁 ... total number of data points
14
48
32
11
60
38
β€’ π‘₯𝑖 ... value of each data point
β€’ π‘˜ ... number of samples
β€’ 𝑛𝐾 ... number of data points in each sample
β€’ π‘₯𝐺 ... grand mean
F-ratio
𝐹𝑑𝑓𝐡 ,π‘‘π‘“π‘Š
𝑀𝑆𝐡
=
π‘€π‘†π‘Š
𝑑𝑓𝐡 = π‘˜ βˆ’ 1
π‘‘π‘“π‘Š = 𝑁 βˆ’ π‘˜
F-distribution
F distribution
𝑆𝑆𝐡
𝑀𝑆𝐡 =
= 1505.3
𝑑𝑓𝐡
Beer prices
Primátor
Kocour
MatuΕ‘ka
15
39
65
12
45
45
14
48
32
11
60
38
13
48
45
2
= 3011
π‘₯π‘˜
𝑆𝑆𝐡 = 𝑛
π‘₯π‘˜ βˆ’ π‘₯𝐺
π‘†π‘†π‘Š
π‘€π‘†π‘Š =
= 95.78
π‘‘π‘“π‘Š
π‘₯𝐺 = 35.33
𝑑𝑓𝐡 = π‘˜ βˆ’ 1 = 2
π‘˜
π‘†π‘†π‘Š =
π‘₯𝑖 βˆ’ π‘₯π‘˜
2
= 862
π‘‘π‘“π‘Š = 𝑁 βˆ’ π‘˜ = 9
π‘˜
βˆ—
𝐹2,9
= 4.25
𝐹2,9
𝑀𝑆𝐡
=
= 15.72
π‘€π‘†π‘Š
F9,2
F2,9
Beer brands – ANOVA