Student’s t-test. This will happen occasionally, just due to chance. 5% of the time, α From Last...
-
Upload
aleesha-rice -
Category
Documents
-
view
214 -
download
0
Transcript of Student’s t-test. This will happen occasionally, just due to chance. 5% of the time, α From Last...
Student’s t-test
The Truth Ho is true Ho is false
Ho is
rejected
Type I Error
No Error
W
hat
your
dat
a sa
y
Ho is not rejected
No Error
Type II Error
This will happen occasionally, just due to chance.
5% of the time, α
From Last Week
The Truth Ho is true Ho is false
Ho is
rejected
Type I Error
No Error
W
hat
your
dat
a sa
y
Ho is not rejected
No Error
Type II Error
This will happen occasionally, just due to chance.
Rate traditionally not specified, β
The Truth Ho is true Ho is false
Ho is
rejected
Type I Error
No Error
W
hat
your
dat
a sa
y
Ho is not rejected
No Error
Type II Error
Power, 1-β
The Truth Ho is true Ho is false
Ho is
rejected
Type I Error
No Error
W
hat
your
dat
a sa
y
Ho is not rejected
No Error
Type II Error
Significance level1-α
To calculate Z ,..
• we need to know 3 things:
1. Sample mean
2. Population or Hypothesized mean
3. Standard Error of the mean
ZX
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.
nX
2
n
ssX
2
We know how to calculate …
Population standard error
Sample standard error is the same
Xs
XZ
Xs X
So now, …
• Calculate Z as:
• But is a poor estimator of
• Requires HUGE sample size to be unbiased.
Xs
XZ
Xs
Xt
The solution ???
• Toss Z!!
I said ….
• is a poor estimator of
• Also, as sample size :
Xs X
Xs 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.
= 1
= 3
=
Degrees of Freedom () influence the shape of the t-distribution.
= n-1
0.025 0.025
Z
1.96-1.96 0
Critical Z’s …
0.025 0.025
t
0
Critical t’s …
? ?
0.025 0.025
t4.303-4.303 0
= 2
0.025 0.025
t
2.064-2.064 0
= 24
Critical t’s …
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
– if |tobserved| tcritical; reject H0
• Calculating t and finding the probability of …
– p(t observed value) = ...
Alpha = 0.05
Alpha = 0.05
Alpha = 0.05
• In a 2-tail test2-tail test with = 9, our critical value of t is: 2.262
• We would write this as:
– t0.05(2), 9 = 2.262
0.025 0.025
t2.262-2.262 0
= 9
Alpha = 0.05
• In a 2-tail test2-tail test with = 24, our critical value of t is: 2.064
• We would write this as:
– t0.05(2), 24 = 2.064
0.025 0.025
t2.064-2.064 0
= 24
Crabs held at 24.3 oC.
25.8 27.324.6 24.026.1 24.522.9 23.925.1 26.224.3 24.824.6 23.523.3 26.325.5 25.428.1 25.523.9 27.024.8 22.925.4
Ho: = 24.3 oC
HA: 24.3 oC
= 0.05n = 25 ( = 24)
Xs
Xt
Critical t
t
_
.. ( )0 05 2 24 2 064
Crabs held at 24.3 oC.
25.8 27.324.6 24.026.1 24.522.9 23.925.1 26.224.3 24.824.6 23.523.3 26.325.5 25.428.1 25.523.9 27.024.8 22.925.4
Xs
Xt
X
s
sX
25 03
180
180
250 27
2
.
.
..
Crabs held at 24.3 oC.
tX
sobs
X
25 03 24 3
0 272 704
. .
..
064.2
_
24)2(05.0 t
tCritical
criticalobserved tt ||
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 test2-tailed test
• We can also ask “Is it BIGGER or smaller than some hypothesized value– 1-tailed test1-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.05n = 12 ( = 11)
X
s
sX
0 61
0 4008
0 4008
12018
2
.
.
..
Atkins mice
389.318.0
61.0
X
obs s
Xt
796.1
_
11)1(05.0 t
tCritical
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),
-tX
st
X
0 05 2 0 05 2. ( ), . ( ),
The probability of is 95%.
Confidence Limits
• 95% of all sample means should produce t’s that lie between
• - t0.05(2), and t0.05(2),.
-tX
st
X
0 05 2 0 05 2. ( ), . ( ),
-t s X t sX X0 05 2 0 05 2. ( ), . ( ),* *
X - t s X t sX X0 05 2 0 05 2. ( ), . ( ),* *
A little math magic ...
X t s X t sX X- 0 05 2 0 05 2. ( ), . ( ),* *
95% probability that the interval includes
“95% confidence interval”
Lower confidence limit
Upper confidence limit
XstXCI *%95 ),2(05.0
XX stXCIstX *%95*- ),2(05.0),2(05.0
More magic …
Crabs held at 24.3 oC
25.8 27.324.6 24.026.1 24.522.9 23.925.1 26.224.3 24.824.6 23.523.3 26.325.5 25.428.1 25.523.9 27.024.8 22.925.4
0642242050 .)(. t
XstXCI *%95 ),2(05.0
X
s
sX
25 03
180
180
250 27
2
.
.
..
27.0*064.203.25%95 CI
56.003.25%95 CI
59.2556.059.25%95 CIUpper
47.2456.003.25%95 CILower
25.5924.47
95% confident that the population mean lies between these values
24.3
95% Confidence interval
• Does not include the hypothesized μ
XstXCI *%95 ),2(05.0
n
ssX As this gets bigger,
this gets smaller.
The Magnitude of Confidence Limits
• is Influenced by Sample Size
For examplePopulationN=1000=25=1
Draw random samples of:n=100n=50n=25n=10
from the population.
n Mean 95% CI Lower Upper100 24.84079 0.1816 24.65918 25.0223950 24.91241 0.31996 24.59245 25.2323725 24.86719 0.40142 24.46577 25.2686110 25.16212 0.859 24.30312 26.02112
The Magnitude of Confidence Limits …
So far, we’ve looked at …
• One sample tests,
• Z and t
• comparing a sample to some specified value.
Hypotheses:
2-tailedHo: A = B
HA: A B
1-tailedHo: A B
HA: A < B
Ho: A B
HA: A > B
or
Two-sample t-test
• testing for differences between two means.
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?
Xs
Xt
Calculating t for a 2-sample testCalculating t for a 2-sample test
• Recall that
Ho: A = B
HA: A B
Ho: A - B = 0
HA: A - B 0
BA XX
BA
s
XXt
Standard error of the difference between the means
B
p
A
pXX n
s
n
ss
BA
22
BA
BAp
SSSSs
2
Hypotheses:
2-tailed
Ho: A = B (A-B= 0)
HA: A B (A-B 0)
1-tailedHo: A B (A-B 0)
HA: A < B (A-B<0)
Ho: A B (A-B 0)
HA: A > B (A-B>0)
),2(05.0ttobserved
),2(05.0ttobserved
),2(05.0ttobserved
Reject Ho
if
if
Reject Ho
Reject Ho
if
BAXX n
s
n
ss pp
BA
22
BA
BA SSSSsp
2
blood clotting times in humans given two experimental drugs.
Drug B8.88.47.98.79.19.6
Drug G9.99.0
11.19.68.7
10.49.5
Scatterplot (sumofsq.STA 10v*25c)
Drug Treatment
Clo
ttin
g T
ime
(M
inu
tes)
7.5
8.0
8.5
9.0
9.5
10.0
10.5
11.0
11.5
Drug B Drug G
Drug B8.88.47.98.79.19.6
Drug G9.99.0
11.19.68.7
10.49.5
Ho: DrugB = DrugG
HA: DrugB DrugG
DrugGDrugB XX
DrugGDrugB
s
XXt
What do we need?Xbar for each drugSS for each drugPooled varianceStdErr of Diff b/w Means
TimeB
SSDrugBSSDrugG
Mean Mean
8.8 0.0025 9.9 0.02568.4 0.1225 9 0.54767.9 0.7225 11.1 1.84968.7 0.0025 9.6 0.01969.1 0.1225 8.7 1.08169.6 0.7225 10.4 0.4356
52.5 1.695 9.5 0.057668.2 4.0172
n=6 n=78.75 9.742857
TimeG(Xi-8.75) (Xi-9.74)
Pooled Variance,
DrugGDrugB
DrugGDrugBp
SSSSs
2
5193.011
7121.5
65
0172.4695.12
ps
Standard Error of the Difference Between the Means:
DrugGDrugBXX n
s
n
ss pp
DrugGDrugB
22
40.0
1608.00742.00866.0
7
5193.0
6
5193.0
DrugGDrugB XXs
Drug B8.88.47.98.79.19.6
Drug G9.99.0
11.19.68.7
10.49.5
Ho: DrugB = DrugG
HA: DrugB DrugG
475.24.0
74.975.8
DrugGDrugB XX
DrugGDrugB
s
XXt
475.2observedt
?),2( ttcirtical
What value do we use fordegrees of freedom?
Our total degrees of freedom = sum of degrees of freedom for each drug.
DrugGDrugB
201.211),2(05.0),2( tttcirtical
11),2(05.0201.2475.2 ttobserved
Therefore, reject Ho, there is a difference between the means.
Drug B8.88.47.98.79.19.6
Drug G9.99.0
11.19.68.7
10.49.5
Ho: DrugB = DrugG
HA: DrugB DrugG
475.24.0
74.975.8
DrugGDrugB XX
DrugGDrugB
s
XXt
201.211),2(05.0),2( tttcirtical
2 Sample, 2 tail t-test
11),2(05.0201.2475.2 ttobserved --> Reject Ho
2 Sample, 1 tail t-test
Testing the prediction that dietary supplements increase growthrate in lab mice.
Control Group175132218151200219234149
Treatment Group142311337262302195253199
Ho: treatment control
HA: treatment > control
397.2
controltreatment XX
controltreatment
s
XXt
761.114),1(05.0 ttcirtical
Reject Ho, dietary supplements increased growth rate
Paired sample t-test --> examine the difference between means that are not drawn from independent samples
--> often used in before and after experiments
The 2-sample tests that we have looked at assumes that the 2 samples are independent
Before366044
119355177
After457346124335783
Effects of Monoxodil on density of active hair follicles
Guy#1234567
What we are interested in is: Has there been an appreciable differencedifference within the pairing?
Before366044
119355177
After457346124335783
Effects of Monoxodil on density of active hair follicles
Guy#1234567
The first step is to calculate the difference between the after and before.
After-Before9
1325-266
Ho: before - after= 0
HA: before - after 0
Ho: difference = 0
HA: difference 0
or
(looks a lot like a one sample test)
Before366044
119355177
After457348124335783
Guy#1234567
After-Before9
1345-266
57.57
39
n
diffsX difference
08.381.1
57.5
differenceX
difference
s
Xt
447.26),2(05.0 ttcirtical
Reject Ho
Standard error of the mean difference
Before366044
119355177
After457348124335783
Guy#1234567
After-Before9
1345-266
943.16),1(05.0 ttcirtical
We could have set this up as a 1-tail test as well.
Ho: difference 0
HA: difference > 0
Reject Ho
08.381.1
57.5
differenceX
difference
s
Xt