Download 2-tail test

Document related concepts
no text concepts found
Transcript
Student’s t-test
From Last Week
This will happen occasionally, just due to chance.
What your data say
5% of the time, α
The Truth
Ho is true Ho is false
Ho is
rejected
Type I
Error
No Error
Ho is not
rejected
No Error
Type II
Error
This will happen occasionally, just due to chance.
What your data say
Rate traditionally
not specified, β
The Truth
Ho is true Ho is false
Ho is
rejected
Type I
Error
No Error
Ho is not
rejected
No Error
Type II
Error
What your data say
Power, 1-β
The Truth
Ho is true Ho is false
Ho is
rejected
Type I
Error
No Error
Ho is not
rejected
No Error
Type II
Error
What your data say
Significance level
1-α
The Truth
Ho is true Ho is false
Ho is
rejected
Type I
Error
No Error
Ho is not
rejected
No Error
Type II
Error
To calculate Z ,..
• we need to know 3
things:
1. Sample mean
2. Population or
Hypothesized mean
3. Standard Error of the
mean
Z
X 
X
…and where do we get those values?
1. Sample mean - calculate from your sample
2. Hypothesized mean - specify based on your
research question
3. Standard Error of the mean - typically don’t
have, so must calculate the sample standard
deviation of the mean, or standard error.
We know how to calculate …
Population standard error
X 
Sample standard error is the same
sX 

2
n
2
s
n
So now, …
• Calculate Z as:
• But
sX
X 
Z
sX
is a poor estimator of
X
• Requires HUGE sample size to be unbiased.
The solution ???
• Toss Z!!
X 
Z
sX
X 
t
sX
I said ….
•
sX
is a poor estimator of
• Also, as sample size :
sX
X
X
The consequences of this are:
• For every n, there is a unique distribution of t.
• As n approaches infinity, the t-distribution
becomes more and more like the Z-distribution.
Degrees of Freedom () influence
the shape of the t-distribution.
=
 = n-1
=3
=1
Critical Z’s …
Z
0.025
-1.96
0.025
0
1.96
Critical t’s …
t
0.025
?
0.025
0
?
Critical t’s …
0.025
 = 24
=2
0.025
0.025
0.025
-2.064
-4.303
0
tt
2.0644.303
T-table from Samuels and Witmer
Hypothesis testing using t
• Calculating t and comparing it to t from a table
– if |tobserved| < tcritical; do not reject H0
Alpha = 0.05
– if |tobserved|  tcritical; reject H0
• Calculating t and finding the probability of …
– p(t  observed value) = ...
Alpha = 0.05
Alpha = 0.05
• In a 2-tail
t is: 2.262
test with  = 9, our critical value of
• We would0.025
write this as:
0.025
=9
– t0.05(2), 9 = 2.262
-2.262
0
t
2.262
Alpha = 0.05
• In a 2-tail test with  = 24, our critical value
of t is: 2.064
• We would0.025
write this as:
0.025
 = 24
– t0.05(2), 24 = 2.064
-2.064
0
t
2.064
Crabs held at 24.3 oC.
25.8
24.6
26.1
22.9
25.1
24.3
24.6
23.3
25.5
28.1
23.9
24.8
25.4
27.3
24.0
24.5
23.9
26.2
24.8
23.5
26.3
25.4
25.5
27.0
22.9
Ho:  = 24.3 oC
HA:   24.3 oC
 = 0.05
n = 25 ( = 24)
X 
t
sX
Critical _ t
t0.05( 2 )24  2.064
Crabs held at 24.3 oC.
25.8
24.6
26.1
22.9
25.1
24.3
24.6
23.3
25.5
28.1
23.9
24.8
25.4
27.3
24.0
24.5
23.9
26.2
24.8
23.5
26.3
25.4
25.5
27.0
22.9
X 
t
sX
X  25.03
s  180
.
2
180
.
sX 
 0.27
25
Crabs held at 24.3 oC.
tobs
X 

sX
25.03  24.3

0.27
 2.704
Critical _ t
t0.05( 2) 24  2.064
| tobserved | tcritical
Therefore, reject Ho, the sample likely came from
a population having a mean that is not 24.3oC.
In the last example...
• We asked “Is there a difference?”
– 2-tailed test
• We can also ask “Is it BIGGER or smaller than
some hypothesized value
– 1-tailed test
Atkins Mice
• To test the Atkins diet you put a set of mice on a
low carb food regime
• If it works, all mice should lose weight
– weight gain on diet should be negative, <0
Atkins mice
0.2
-0.5
-1.3
-1.6
-0.7
0.4
-0.1
0.0
-0.6
-1.1
-1.2
-0.8
Ho:   0
HA:  < 0
 = 0.05
n = 12 ( = 11)
X  0.61
s  0.4008
2
sX 
0.4008
 018
.
12
Atkins mice
Critical _ t
t0.05(1)11  1.796
tobs
X 

sX
 0.61

0.18
 3.389
Therefore, reject Ho, likely does not come from
a population ….
Confidence Limits
• When we set  = 0.05,
• if we have a population with mean 
• we expect that 5% of all samples drawn randomly
from the population, will produce t values that are
– larger than t0.05(2),
– smaller than - t0.05(2),
– leaving 95% of the remaining samples to have means
that yield t’s between - t0.05(2), and t0.05(2),
Confidence Limits
• 95% of all sample means should produce t’s that
lie between
• - t0.05(2), and t0.05(2),.
The probability of
-t0.05( 2 ),
X 

 t0.05( 2 ),
sX
is 95%.
A little math magic ...
-t0.05( 2 ),
X 

 t0.05( 2 ),
sX
-t0.05( 2), * sX  X    t0.05( 2), * sX
X - t0.05( 2), * sX    X  t0.05( 2), * sX
X - t0.05( 2), * sX    X  t0.05( 2 ), * sX
95% probability that the interval includes 
“95% confidence interval”
Lower confidence limit
Upper confidence limit
More magic …
X - t0.05( 2), * sX  95%CI  X  t0.05( 2), * sX
95%CI  X  t0.05( 2), * sX
Crabs held at 24.3 oC
25.8
24.6
26.1
22.9
25.1
24.3
24.6
23.3
25.5
28.1
23.9
24.8
25.4
27.3
24.0
24.5
23.9
26.2
24.8
23.5
26.3
25.4
25.5
27.0
22.9
95%CI  X  t0.05( 2), * sX
t0.05( 2 ) 24  2.064
95%CI  25.03  2.064 * 0.27
X%
CI
25.03
95
 25.03  0.56
Upper
s2  180
.95%CI  25.59  0.56  25.59
180
. %CI  25.03  0.56  24.47
Lower95
sX 
 0.27
25
95% Confidence interval
• Does not include the hypothesized μ
24.3
24.47
25.59
95% confident that the population
mean lies between these values
The Magnitude of Confidence Limits
• is Influenced by Sample Size
95%CI  X  t0.05( 2), * sX
s
sX 
n
As this gets bigger,
this gets smaller.
The Magnitude of Confidence Limits …
For example
Population
N=1000
=25
=1
n
100
50
25
10
Mean
24.84079
24.91241
24.86719
25.16212
Draw random samples of:
n=100
n=50
n=25
n=10
from the population.
95% CI
0.1816
0.31996
0.40142
0.859
Lower
24.65918
24.59245
24.46577
24.30312
Upper
25.02239
25.23237
25.26861
26.02112
So far, we’ve looked at …
• One sample tests,
• Z and t
• comparing a sample to some specified value.
Two-sample t-test
• testing for differences between two means.
Hypotheses:
2-tailed
Ho: A = B
HA: A  B
1-tailed
Ho: A  B
HA: A < B
Ho: A  B
or
HA: A > B
Basically, what we want
• To know is, “ Is it likely that two samples were
drawn from the same population? Or is it likely
that they were drawn from two different
populations?
Calculating t for a 2-sample test
• Recall that
X 
t
sX
Ho: A = B
Ho: A - B = 0
HA: A  B
HA: A - B  0
XA  XB  
t
sX A  X B
Standard error of the difference between the means
sX A  X B 
s
2
p
nA

s
nB
SS A  SS B
s 
 A  B
2
p
2
p
Hypotheses:
2-tailed
Ho: A = B (A-B= 0)
HA: A  B (A-B  0)
tobserved  t0.05( 2),
if
Reject Ho
1-tailed
Ho: A  B (A-B 0)
if
HA: A < B (A-B<0)
Reject Ho
Ho: A  B (A-B 0)
if
HA: A > B (A-B>0)
tobserved  t0.05( 2 ),
tobserved  t0.05( 2 ),
Reject Ho
2
sX A  X B 
sp
nA
2

sp
nB
SS A  SS B
sp 
 A  B
2
blood clotting times in humans given two experimental
drugs.
Drug B
8.8
8.4
7.9
8.7
9.1
9.6
Drug G
9.9
9.0
11.1
9.6
8.7
10.4
9.5
S
c
a
tte
rp
lo
t(s
u
m
o
fs
q
.S
T
A1
0
v
*2
5
c
)
1
1
.5
1
1
.0
1
0
.5
1
0
.0
ClotingTime(Minutes)
9
.5
9
.0
8
.5
8
.0
7
.5
D
ru
gB
D
ru
gG
D
ru
gT
re
a
tm
e
n
t
Drug B
8.8
8.4
7.9
8.7
9.1
9.6
Drug G
9.9
9.0
11.1
9.6
8.7
10.4
9.5
What do we need?
Xbar for each drug
SS for each drug
Pooled variance
StdErr of Diff b/w Means
Ho: DrugB = DrugG
HA: DrugB  DrugG
t
X DrugB  X DrugG
s X Dru g B X Dru g G
TimeB
8.8
8.4
7.9
8.7
9.1
9.6
52.5
(Xi-8.75)
0.0025
0.1225
0.7225
0.0025
0.1225
0.7225
1.695
n=6
9.9
9
11.1
9.6
8.7
10.4
9.5
68.2
0.0256
0.5476
1.8496
0.0196
1.0816
0.4356
0.0576
4.0172
n=7
9.742857
8.75
Mean
TimeG (Xi-9.74)
SSDrugB
Mean
SSDrugG
Pooled Variance,
s 
2
p
SSDrugB  SSDrugG
 DrugB   DrugG
1.695  4.0172 5.7121
sp 

56
11
 0.5193
2
Standard Error of the Difference Between the Means:
2
2
s X Dru g B X Dru g G 
s X Dru g B X Dru g G 

sp
nDrugB

nDrugG
0.5193 0.5193

6
7
0.0866  0.0742 
 0.40
sp
0.1608
Drug B
8.8
8.4
7.9
8.7
9.1
9.6
t
Drug G
9.9
9.0
11.1
9.6
8.7
10.4
9.5
X DrugB  X DrugG
s X Dru gB X Dru gG
Ho: DrugB = DrugG
HA: DrugB  DrugG
8.75  9.74

 2.475
0.4
tobserved  2.475
tcirtical  t ( 2 ),  ?
What value do we use for
degrees of freedom?
Our total degrees of freedom = sum of degrees of freedom for
each drug.
   DrugB   DrugG
tcirtical  t ( 2 ),  t0.05( 2 ),11  2.201
tobserved  2.475 2.201  t0.05( 2),11
Therefore, reject Ho, there is a difference between the means.
Drug B
8.8
8.4
7.9
8.7
9.1
9.6
t
Drug G
9.9
9.0
11.1
9.6
8.7
10.4
9.5
X DrugB  X DrugG
s X Dru gB X Dru gG
2 Sample, 2 tail t-test
Ho: DrugB = DrugG
HA: DrugB  DrugG
8.75  9.74

 2.475
0.4
tcirtical  t ( 2 ),  t0.05( 2 ),11  2.201
tobserved  2.475 2.201  t0.05( 2),11 --> Reject Ho
2 Sample, 1 tail t-test
Testing the prediction that dietary supplements increase growth
rate in lab mice.
Control Group Treatment Group
175
142
132
311
218
337
151
262
200
302
219
195
234
253
149
199
Ho: treatment  control
HA: treatment > control
X treatment  X control
t
 2.397
s X trea tmen t X co n tro l
tcirtical  t0.05(1),14  1.761
Reject Ho, dietary supplements increased growth rate
The 2-sample tests that we have looked at
assumes that the 2 samples are independent
Paired sample t-test --> examine the difference
between means that are not drawn from
independent samples
--> often used in before and after experiments
Effects of Monoxodil on density of active hair follicles
Guy# Before
1
36
2
60
3
44
4
119
5
35
6
51
7
77
After
45
73
46
124
33
57
83
What we are interested in is: Has there been an appreciable
difference within the pairing?
Effects of Monoxodil on density of active hair follicles
Guy# Before
1
36
2
60
3
44
4
119
5
35
6
51
7
77
After After-Before
45
9
73
13
46
2
124
5
33
-2
57
6
83
6
Ho: before - after= 0
HA: before - after 0
or
Ho: difference = 0
HA: difference  0
The first step is to calculate the difference between the
after and before.
(looks a lot like a one sample test)
Guy# Before
1
36
2
60
3
44
4
119
5
35
6
51
7
77
X difference
t
After After-Before
45
9
73
13
48
4
124
5
33
-2
57
6
83
6
Standard error of the
mean difference
diffs 39



 5.57
n
X difference
s X difference
7
5.57

 3.08
1.81
tcirtical  t0.05( 2 ), 6  2.447
Reject Ho
Guy# Before
1
36
2
60
3
44
4
119
5
35
6
51
7
77
t
X difference
s X difference
After After-Before
45
9
73
13
48
4
124
5
33
-2
57
6
83
6
5.57

 3.08
1.81
tcirtical  t0.05(1), 6  1.943
We could have set this
up as a 1-tail test as
well.
Ho: difference  0
HA: difference > 0
Reject Ho
Related documents