Beruflich Dokumente
Kultur Dokumente
Estimation continued
Least Squares (OLS)
Likelihood
non-parametric tests
assumptions
Mann-Whitney-Wilcoxon
OLS = min ( y i y )
i=1
SS = d 2
b
parameter value
constraints of ML estimators:
L(y; ) = f (y i ; )
i=1
Log-Likelihood function:
n
n
ln L = ln f (y i ; ) = ln[ f ( y i ; )]
i=1
i=1
instead, we maximize the log-likelihood function rather than
the likelihood function because
working with products is computationally difficult and the probability
distribution of L is poorly known
natural logarithm of L is easy to work with and large sample sizes
are approximately 2 distributed
Hypothesis testing
main approach to statistical inference in biology
So far covered:
collecting data samples
estimating parameters from sample statistics
calculated SE and CI as estimators of reliability
of these statistics
Now, we want
some objective way to decide whether our sample
differs from some expected distribution, or from
other similarly collected samples
correct
decision
Type I
error
False
Type II
error
correct
decision
H0
Power of a test
Power = probability that we
correctly accept Ha
power = 1-
once we specify , then P(type I),
P(type II) and power are set
decreasing increases and
thus decreases power
increasing decreases and
thus increases power
why is a one-tailed test more
powerful than a two-tailed test?
Power of a test
with a constant and a given
s2, the power decreases as
the location (mean) of the
distribution of Ha approaches
that of Ho
power also decreases as
spread (s2) increases
thus, increase power by
reducing spread (s2), (i.e.,
maximize n)
or test for large effects (big
difference between means)
the t-test
review: t statistic development of a confidence interval
y y
t=
=
s / n SEM
t=
(y )
s/ n
2.
t(s / n ) = (y )
Review
= y t(s / n )
and
= y + t(s / n )
Review
Probability
Degrees of Freedom
.01
.02
.05
.10
.20
63.66
31.82
12.71
6.314
3.078
9.925
6.965
4.303
2.920
1.886
5.841
4.541
3.182
2.353
1.638
4.604
3.747
2.776
2.132
1.533
4.032
3.365
2.571
2.015
1.476
10
3.169
2.764
2.228
1.812
1.372
15
2.947
2.602
2.132
1.753
1.341
20
2.845
2.528
2.086
1.725
1.325
25
2.787
2.485
2.060
1.708
1.316
38
2.705
2.426
2.020
1.685
1.302
95%
61.92
Sample mean
SEM
DF
61.92
0.84
38
y t(s / n )
61.92 2.02(0.84)
60.22
y + t(s / n )
61.92 + 2.02(0.84)
<<
63.62
Assumptions of t-test
t-tests are parametric tests
thus, the t statistic only follows t distribution if:
variable has normal distribution (normality assumption)
two groups have equal population variances
(homogeneity of variance assumption)
observations are independent or specifically paired
(independence assumption)
t-statistic
general form of the t statistic:
St
SE
where
St is sample statistic
is parameter value specified in H0
SE is standard error of sample statistic
t=
y y
=
SEM s n
value of mean
specified in H0
sampling distribution of t
P(t)
t<0
t=0
t>0
one-tailed tests
1)
y
SE
>0
2)
y
SE
<0
1) only reject H0 for large + values of t, i.e. when sample mean is
much greater than
2) only reject H0 for large - values of t, i.e. when sample mean is
much less than
(1)
(2)
two-tailed tests
y
SE
0
/ 2 = 0.025
t<0
t=0
t>0
.005/.01
.01/.02
.025/.05
.05/.10
.10/.20
63.66
31.82
12.71
6.314
3.078
9.925
6.965
4.303
2.920
1.886
5.841
4.541
3.182
2.353
1.638
4.604
3.747
2.776
2.132
1.533
4.032
3.365
2.571
2.015
1.476
10
3.169
2.764
2.228
1.812
1.372
15
2.947
2.602
2.132
1.753
1.341
20
2.845
2.528
2.086
1.725
1.325
25
2.787
2.485
2.060
1.708
1.316
2.575
2.326
1.960
1.645
1.282
2 tailed
1 tailed
95%
-2.78
+2.78
-5 -4 -3 -2 -1 0 1 2 3 4 5
95%
1 tailed
+2.132
-5 -4 -3 -2 -1 0 1 2 3 4 5
-2.132
95%
-5 -4 -3 -2 -1 0 1 2 3 4 5
Ourworld.syd
t=
1.
2.
3.
Box plot
Normal approximation
Dot plot
8
7
6
5
4
3
2
H0: = 1.25
1
0
pe
ro
Eu
ic
am
Isl
w
Ne
ld
or
W
Two-sample t-test
used to compare two populations, each of which has
been sampled
the simplest form of tests comparing populations
example: does the average annual income differ for
males and females?
H0: 1 = 2; income (males) = income (females)
Survey2.syd
t=
y1 y2 ( 1 2 ) y1 y2
y y2
=
= 1
s y1 y2
s y1 y2
0.4
Probability of t
Ho true
H A: 1 > 2
1) if Ho is true then the
null distribution is
known (for a set df)
0.3
0.2
0.1
0.0
-5 -4 -3 -2 -1 0
t=
If Ho is true: 1 = 2
0.4
y1 y2
sp
1
n1
1
n2
(given 4 df)
Ho true
t 0.05, 4 df = 2.14
0.3
0.2
0.1
0.0
HA true
-5 -4 -3 -2 -1 0
If Ho is false: 1 > 2
0.4
(given 4 df)
HA true
t 0.05, 4 df = 2.14
0.3
0.2
0.1
0.0
-5 -4 -3 -2 -1 0
Results of example
Two-sample t-test on INCOME Grouped by SEX$ vs Alternative = 'not equal'
Standard
GROUP
N
Mean
Deviation
-------+--------------------------Female 152
20.25658
14.82771
Male
104
24.97115
16.41776
Separate Variance
Difference in Means
95.00% Confidence Interval
t
df
p-value
: -4.71457
: -8.67643 to -0.75272
: -2.34611
: 206.23313
:
0.01992
Pooled Variance
Difference in Means
95.00% Confidence Interval
t
df
p-value
: -4.71457
: -8.59712 to -0.83203
: -2.39138
: 254.00000
:
0.01751
60
60
70
INCOME
50
40
30
20
50
40
30
n=152
n=104
20
10
10
0
50 40 30 20 10 0 10 20 30 40 50
Count
Count
SEX
Female
Male
Female
Male
SEX
H 0:
d = 0
t=
d
d
=
sd sd / n d
where
d = the difference between paired observations
sd = standard deviation of the differences
df = n - 1 where n is number of pairs
: -312.57143
: -641.43752 to 16.29466
:
-2.24827
:
6.98755
:
0.05942
Pooled Variance
Difference in Means
95.00% Confidence Interval
t
df
p-value
: -312.57143
: -615.48591 to -9.65695
:
-2.24827
barely significant
:
12.00000
:
0.04413
WHY?
equal variances?
1200
1000
800
600
400
200
0
Orange
Purple
Color of seastars
indicates that:
purples are more
common
by a constant ratio
rather than by a
constant amount
y
s n
One-sample test
y1 y 2
1 1
sp
+
n1 n 2
Two-sample test
Paired test
d
sd
nd
One-sample test
Two-sample test sp
(calculation based on
pooled variance term)
s
n
1 1
+
n1 n 2
Variance (s2)
s2 =
SS
(n 1)
s2p =
SS1 + SS2
(n1 1) + (n 2 1)
sd2 =
SSd
(n d 1)
or
(n 1)s 2 + (n 1)s 2 1 1
1
2
2
1
+
n
+
n
2
n1 n 2
1
2
Paired test
sd
nd
Results:
The mean number of eggs per capsule from the
mussel zone was significantly greater than that
from the littorinid zone (t = 5.39, df = 77, P <
0.001; Fig. 2).
Solutions:
transformations
dont worry, run it anyway, give disclaimer
if there is another appropriate test where assumptions
are met, use it instead, but often violations make little
difference in reported P-value
Solutions
transformations
run it anyway same comments as for normality
assumption
70
60
Count
50
40
30
20
10
0
0 10 20 30 40 50 60 70 80 90
Limpet numbers per quadrat
2. SKEWED
3. OUTLIERS
*
*
*
4. UNEQUAL VARIANCES
Boxplots
raw data
log transformed
Pop_1990
Lpop1990
Europe
441
0.17
Islamic
1378
0.30
Newworld
1042
0.34
Greatest
ratio
3.12:1
2:1
Ourworld.syd
Nonparametric Tests
these tests dont assume particular underlying
distribution of data
normal distributions not necessary
df =
s
2
s
+ 2
1
n1
n2
s1
n1
(n1 + 1) + (s2
n2
+ ( n 2 + 1)
2