Transcript Hypothesis

Hypothesis Tests

Structure of hypothesis tests
1. choose the appropriate test
»
»
»
»
based on: data characteristics, study objectives
parametric or nonparametric
two-sided, one-sided
t-test, rank-sum test, others…
2. establish the null and alternate hypothesis
» null hypothesis, H0, is what is assumed true until
the data indicate that it is likely to be false
» alternative hypothesis, Ha, that we will accept if
we decide to reject the null hypothesis
3. decide on an acceptable error rate a
 a is probability of making a Type I error
4. compute the test statistic from the data
5. compute the p-value
» p is the believability of the data,
6. reject the null hypothesis of p <= a

types of errors
Don’t reject
H0
H0 is true Correct
decision
Reject H0
Type I error
H0 is false Type II error
P=a
Correct
decision
P=

example:
– soil samples = 115, 125, 110, 95, 105 pcf
– 100 pcf specified
– within specifications?
» H0 :
Ha :
» Type I error:

choose a = 0.05 (95% confidence)
» Type II error:

=?
– Type of test on mean:
» test statistic: z or t
» one-tail? Upper or lower?

Upper: reject if z > za (or t)

Lower: reject if z < -za (or t)
» two-tail?

Reject if
z < - za/2 or z > za/2 (or t)
– i.e., if |t| > ta/2
– two-sided t-test on mean
» H0: m = m 0 (m - m o) = 0
Ha: m # m 0
t 
x  m0
s
n

» if t >= tcritical, (p <= a) then reject Ho
with 100(1-a)% confidence
» if t < tcritical, then do not reject Ho. No basis to
believe that the mean is different (not significantly
different).
– Calculations
» mean = 110, s = 11.2
» Test statistic: t
t = |110-100|/(11.2/2.24) = 2.000

t(0.05, 4) = 2.776

t < tcrit, do not reject H0, not out of spec
» p = 0.116

p > a, do not reject H0, not out of spec

if we chose a = 0.116, then t = tcrit

Notes on hypothesis test
– Hypothesis test about a population variance
– two-tailed or one-tailed
» one-tail: prior information or direction
– choosing a
» choose lower when have more data
» cannot change after the fact
» report p
– p
»
»
»
»
higher p means more significance to the data
observed significance level
not either / or
forget a and let the reader judge?
– Power of test
» , prob of type II error, depends on true value of
parameter (unknown)
» Power of test = 1 – 

Power is probability of rejecting null hypothesis H0, when
alternative hypothesis is true (making correct decision to
reject H0)
– Report all results, not just significant results
– careful with outliers

Two-sample hypothesis tests
– (one sample: e.g., does m = some number?)
– (m1 - m2) : difference in means
– md : mean difference; paired comparison of means
– (p1 - p2) : difference in proportions
– s21/ s22 : ratio of variances

Two-sample z test (large-sample) p.482
– independent random samples

Two-sample z test example
– example 9.4
» H0: no difference in means
» Ha: m1 - m2 < 0 (one-tail)
» a = 0.05
zcrit = -1.645
» 1: mean = 78.67, variance = 59.08, n = 100
2: mean = 102.87, variance = 69.33, n = 55
» z = -2.19 < zcrit REJECT H0 (mean 1 < mean 2)
» p = P(z < -2.19) = 0.0143

Two-sample t test (small-sample) p.485
– assuming equal variances

Matched pairs t test p.496
– use paired data to test for difference in mean
– actually, test if mean difference is zero

Comparing population variances
– use ratio of variances
– F = larger/smaller (for convenience)
– F distribution
» note on distributions

variance fits a chi-square distribution:
c2 distribution is non-negative distribution that
includes degrees of freedom
–

c2 distribution is a type of gamma distribution
F distribution is the distribution of the ratio of two
independent chi-square random variables.

Two-sample t test (small-sample)
– assuming unequal variances
x1  x2   0
t
2
1
s
n1
s
2
2
n2
2
s

s
 n  n 
1
2

df 
2
2
2
2
 s1   s2 
 n  n 
1
2


n1  1 n2  1
2
1
2
2
(round to nearest integer)

Contingency Tables
– Does one variable depend on the other?
– Is the cell count equal to that expected???
– Problem 9.58
» H0 : hotspot type and rare species type are
independent
Ha : they’re dependent
» expected butterfly-but = 68*42/105
observed
Butterfly
Dragonfly
total
But
31
11
42
Drag
17
13
30
Bird
20
13
33
total
But
27.2
14.8
42
Drag
19.4
10.6
30
Bird
21.4
11.6
33
total
68
37
105
expected
Butterfly
Dragonfly
total
68
37
105
(observed - expected)^2/expected
But
Drag
Bird
total
Butterfly
0.5
0.3
0.1
0.92246
Dragonfly
1.0
0.6
0.2
1.69533
total 1.506558 0.861486 0.249747 2.618 =c2 test
df = (rows-1)*(col-1) = 2
chi (a= 0.10) = 4.605176
c2test < c2a=0.10
Do not reject H0:
independent