Stats 95 t-Tests • Single Sample • Paired Samples

advertisement
Stats 95
t-Tests
William Sealy Gosset
• Single Sample
• Paired Samples
• Independent Samples
t Distributions
• t dist. are used when we
know the mean of the
population but not the SD of
the population from which
our sample is drawn
• t dist. are useful when we
have small samples.
• t dist is flatter and has fatter
tails
• As sample size approaches
30, t looks like z (normal)
dist.
• Same Three Assumptions
• Dependent Variable is scale
• Random selection
• Normal Distribution
Fat Tails Lose Weight With Larger
Sample Size
The Robust Nature of the t
Statistics
Unfortunately, we very seldom know the if the population is
normal because usually all the information we have about a
population is in our study, a sample of 10-20.
Fortunately,
1) distributions in social sciences often approximate a normal
curve, and
2) according to Central Limit Theorem the sample mean you have
gathered is part of a normal distribution of sample means, and
3) in practice t tests statisticians have found the test is accurate
even with populations far from normal
The Robust Nature of the t
Statistics
• The only situation in which using a t test is
likely to give a seriously distorted result is
when you are using a one-tailed test and the
population is highly skewed.
When To Use Single Sample
t-Statistic
• 1 Nominal Independent Variable
• 1 Scale Dependent Variable
• Population Mean, No Population Standard
Deviation
Check Assumptions
• Random Selection
• Normal Shape Distribution
z Statistic Versus t Statistic
z Statistic
• When you know the Mean
and Standard deviation of a
population.
t Statistic
• When you do not know the
Mean and Standard
Deviation of the population
– E.g., a farmer picks 200,000
apples, the mean weight is
112 grams, the SD is
12grams.
– E.g., a farmer picks 30 out of
his 200,000 apples, and finds
the sample has a Mean of 112
grams.
• Calculate the Standard Error
of the sample mean
• Calculate the Estimate of
the Standard Error of the
sample mean
Scenarios When you would use a
Single Sample t test
• A newspaper article reported that the typical American family spent an
average of $81 for Halloween candy and costumes last year. A sample of N
= 16 families this year reported spending a mean of M = $85, with s = $20.
What statistical test would we use to determine whether these data indicate
a significant change in holiday spending?
• Many companies that manufacture lightbulbs advertise their 60-watt bulbs
as having an average life of 1000 hours. A cynical consumer bought 30
bulbs and burned them until they failed. He found that they burned for an
average of M = 1233, with a standard deviation of s = 232.06. What
statistical test would this consumer use to determine whether the average
burn time of lightbulbs differs significantly from that advertised?
Difference Between Calculating
z Statistic and t Statistic
z Statistic
 
 X   
N
m 
z
t Statistic

N
(M  M )
M
2
( X  M ) 2
s
N 1
sm 
s
N
(M   m )
t
sm
Standard Deviation
of a Sample:
Estimates the
Population
Standard Deviation
Standard Error of a
Sample: estimates
the Sample Error of
the Population
t Statistic
for SingleSample t
Test
Estimating Population from a
Sample
• Main difference between t Tests and z score:
– use the standard deviation of the sample to estimate the
standard deviation of the population.
• How? Subtract 1 from sample size! (called degrees of
freedom)
SD 
 X   
N
2
( X  M )
s
N 1
2
Standard Deviation
of a Sample:
Estimates the
Population
Standard Deviation
• Use degrees of freedom (df) in the t distribution chart
t Distribution
Table
Example of Single Sample t Test
• The mean emission of all engines of a new design needs to be below
20ppm if the design is to meet new emission requirements. Ten engines are
manufactured for testing purposes, and the emission level of each is
determined. Data:
• 15.6, 16.2, 22.5, 20.5, 16.4, 19.4, 16.6, 17.9, 12.7, 13.9
• Does the data supply sufficient evidence to conclude that type of engine
meets the new standard, assuming we are willing to risk a Type I error
(false alarm, reject the Null when it is true) with a probability = 0.01?
• Step 1: Assumptions: dependent variable is scale, Randomization, Normal
Distribution
• Step 2: State H0 and H1:
– H0 Emissions are equal to (or lesser than) 20ppm;
– H1
Emissions are greater than 20ppm (One-Tailed Test)
Example of Single Sample t Test
• The mean emission of all engines of a new design needs to be below
20ppm if the design is to meet new emission requirements. Ten engines are
manufactured for testing purposes, and the emission level of each is
determined. Data:
• 15.6, 16.2, 22.5, 20.5, 16.4, 19.4, 16.6, 17.9, 12.7, 13.9
2
• Step 3: Determine Characteristics of Sample
Mean =
Standard Deviation of Sample =
Standard Error of Sample =
• Step 4: Determine Cutoff
– df = N-1 = 10-1 =9
m
– t statistic cut-off = -2.822
( X  M )
s
N 1
s

s
N
Example of Single Sample t Test
• The mean emission of all engines of a new design needs to be below
20ppm if the design is to meet new emission requirements. Ten engines are
manufactured for testing purposes, and the emission level of each is
determined. Data:
• 15.6, 16.2, 22.5, 20.5, 16.4, 19.4, 16.6, 17.9, 12.7, 13.9
• Step 3: Determine Characteristics of Sample
Mean
M = 17.17
( X  M )
s

Standard Deviation of Sample
= 2.98
N s1
s
Standard Error of Sample
= 0.942
s msm
N
• Step 4: Determine Cutoff
– df = N-1 = 10-1 =9
Step 5: Calculate t Statistic
– t statistic cut-off = -2.822
2
(M   m )
t
sm
Example of Single Sample t Test
• The mean emission of all engines of a new design needs to be below
20ppm if the design is to meet new emission requirements. Ten engines are
manufactured for testing purposes, and the emission level of each is
determined. Data:
• 15.6, 16.2, 22.5, 20.5, 16.4, 19.4, 16.6, 17.9, 12.7, 13.9
• Mean M = 17.17
Standard Deviation of Sample
Standard Error of Sample
sm = 0.942
Step 5: Calculate t Statistic
s
= 2.98
Step 6: Decide (Draw It)
t statistic cut-off = -2.822
(M   m ) (17.17  20)
t

 3.00
sm
0.942
t statistic = -3.00
Decide to reject the Null
Hypothesis
How to Write Results
•
•
•
•
•
t(7) = -.79, p < .265, d = -.29
t Indicates that we are using a t-Test
(9) Indicates the degrees of freedom associated with this t-Test
-.79 Indicates the obtained t statistic value
p < .265 Indicates the probability of obtaining the given t
value by chance alone
• d = -.29 Indicates the effect size for the significant effect (the
magnitude of the effect is measured in standard deviation
units)
Paired Sample t Test
• The paired samples test is a kind of research called repeated
measures test (aka, within-subjects design), commonly used in
before-after-designs.
• Comparing a mean of difference scores to a distribution of
means of difference scores
• Checklist for Paired-Samples:
–
–
–
–
1 Nominal DICHOTOMOUS (with two levels) Independent Variable
1 Scale Dependent Variable
Paired Observations are Dependent
Assumptions
• Random selection & Shape
Paired-Samples t-Test
Paired Sample t Test
• The paired samples test is a kind of research called repeated
measures test (aka, within-subjects design), commonly used in
before-after-designs.
• Comparing a mean of difference scores to a distribution of
means of difference scores
– Population of measures at Time 1 and Time 2
– Population of difference between measures at Time 1 and Time 2
– Population of mean difference between measures at Time 1 and Time 2
–
(Whew!)
Paired Sample t Test
Single-Sample
• Single observation from
each participant
• The observation is
independent from that of
the other participants
• Comparing a mean score to
a distribution of mean
scores .
Paired-Sample
• Two observations from each
participant
• The second observation is
dependent upon the first
since they come from the
same person.
• Comparing a mean of
difference scores to a
distribution of means of
difference scores
•
(I don’t make this stuff up)
Paired Sample t Test
• Two distribution of scores.
• A distribution of
differences between scores.
• Central Limit Theorem Revisited. If you plot the mean of
randomly sampled observations, the plot will approach a
normal distribution. This is true for scores and for
differences between matched scores.
Difference Between Calculating
Single-Sample t and Paired-Sample t Statistic
Single Sample t Statistic
( X  M ) 2
SS
s

N 1
N 1
sm 
s
Paired Sample t Statistic
Standard
Deviation
of a
Sample
s
Standard Error of a
Sample
N
(M   m )
t
sm
( D x  y  M x  y ) 2
N 1
Standard Deviation of Sample
Differences
sm 
t Statistic for
SingleSample t
Test
t

SS
N 1
s
N
(M x y   x y )
sm
Standard Error of
Sample
Differences
t Statistic for
Paired-Sample t
Test
Paired Sample t Test Example
• We need to know if there is a difference in the salary for the same job in
Boise, ID, and LA, CA. The salary of 6 employees in the 25th percentile in
the two cities is given .
Profession
Boise
Los Angeles
Executive Chef
53,047
62,490
Genetics Counselor
49,958
58,850
Grants Writer
41,974
49,445
Librarian
44,366
52,263
School teacher
40,470
47,674
Social Worker
36,963
43,542
• Six Steps of Hypothesis testing for Paired Sample Test
Paired Sample t Test Example
• We need to know if there is a difference in the salary for the
same job in Boise, ID, and LA, CA.
• Step 1: Define Pops. Distribution and Comparison
Distribution and Assumptions
– Pop. 1. Jobs in Boise
– Pop. 2.. Jobs in LA
– Comparison distribution will be a distribution of mean differences, it
will be a paired-samples test because every job sampled contributes
two scores, one in each condition.
– Assumptions: the dependent variable is scale, we do not know if the
distribution is normal, we must proceed with caution; the jobs are not
randomly selected, so we must proceed with caution
Paired Sample t Test Example
•
•
•
We need to know if there is a difference in the salary for the same job in Boise, ID,
and LA, CA.
Step 3: Determine the Characteristics of Comparison Distribution (mean,
standard deviation, standard error)
M = 7914.333
Sum of Squares (SS) = 5,777,187.333
s
SS
5,777,186.333

 1074.93
N 1
5
Profession
Boise
Los Angeles
sm 
X-Y
s
N

1074.93
D (X-Y)-M
6
 438.83
D^2
M = -7914.33
Executive Chef
53,047
62,490
-9,443
-1,528.67 2,336,821.78
Genetic Counselor
Grants Writer
Librarian
School teacher
Social Worker
49,958
41,974
44,366
40,470
36,963
58,850
49,445
52,263
47,674
43,542
-8,892
-7,471
-7,897
-7,204
-6,579
-977.67 955,832.11
443.33 196,544.44
17.33
300.44
710.33 504,573.44
1,335.33 1,783,115.11
Paired Sample t Test Example
• We need to know if there is a difference in the salary for the
same job in Boise, ID, and LA, CA.
• Step 4: Determine Critical Cutoff
• df = N-1 = 6-1= 5
• t statistic for 5 df , p < .05, two-tailed, are -2.571 and 2.571
• Step 5: Calculate t Statistic
t
(M x y   x y )
sm
• Step 6 Decide
(7914.333  0)

 18.04
438.333
How to Write Results
•
•
•
•
•
t(5) = 18.04, p < .00001, d = xxxx.
t Indicates that we are using a t-Test
(5) Indicates the degrees of freedom associated with this t-Test
18.04 Indicates the obtained t statistic value
p < .000001 Indicates the probability of obtaining the given t
value by chance alone
• d = xxxx Indicates the effect size for the significant effect (the
magnitude of the effect is measured in units of standard
deviations)
Independent t-Test
Independent t Test
• Compares the difference between two means of
two independent groups.
• You are comparing a difference between means to
a distribution of differences between means.
– Sample means from Group 1 and Group 2 compared to a
Population of differences between means of Group 1
and Group 2
Independent t Test
Paired-Sample
• Two observations from each
participant
• The second observation is
dependent upon the first
since they come from the
same person.
• Comparing a mean
difference to a distribution
of mean difference scores
Independent t Test
• Single observation from each
participant from two
independent groups
• The observation from the
second group is independent
from the first since they come
from different subjects.
• Comparing the difference
between two means to a
distribution of differences
between mean scores .
Independent t Test: Steps
Step 1
Calculate the corrected
variance for each sample
Calculate the degrees of
Step 2 freedom
Step 3 Calculate the pooled
variance
In a z test you find SD, for ind.
t, you take weighted avg of SD2
Step 4 Calculate the squared
estimate of the standard
error for each sample
Step 5 Calculate estimated variance
of the dist. of mean
differences
2
2

(
X

M
)

(
Y

M
)
s x2 
s y2 
N 1
N 1
df total  df x  df y
s
s
2
pooled
2
Mx

 df x  2  df y  2
s y
s x  
 
 df total 
 df total 
s 2pooled
Nx
s
2
My

s 2pooled
Ny
2
2
2
s Difference
 s Mx
 s My
Like the
Standard
error in a
z test
Independent t Test: Steps
Step 4
Step 5
Calculate the squared
estimate of the standard
error for each sample
Calculate estimated variance
of the dist. of mean
differences
Calculate estimated standard
Step 6 deviation of the dist. of mean
differences
Step 7
t Statistic for an independentSamples t Test
2
s Mx

s 2pooled
Nx
2
s My

s 2pooled
Ny
2
2
2
s Difference
 s Mx
 s My
2
s Difference  s Difference
(M X  M Y )
t
s Difference
Confidence Interval
for Independent
Samples t-test
( M X  M Y ) Lower  t ( s Difference)  ( M X  M Y ) Sample
( M X  M Y )Upper  t ( s Difference)  ( M X  M Y ) Sample
Confidence Interval for Paired Sample
t-test with example from Stroop
question.
M
Lower
 t ( s m )  M Sample  2.365(2.052)  13.556  8.70302
M Upper  t ( s m )  M Sample  2.365(2.052)  13.556  18.4089
Effect Size for
Independent Samples
t-test
(M X  M Y )
d
s pooled
Effect Size for
Dependent Samples ttest
d
(M   )
s
sm 
s
N
Standard Error of a Sample:
estimates the Sample Error of
the Population
( X  M )
s
N 1
df  N  1
(M   m )
t
sm
2
Standard Deviation of a Sample:
Estimates the Population Standard
Deviation
x
t
s Difference
Degrees of Freedom for Single
Sample t Test, and Paired Sample
( X  M )
s 
N 1
2
(M  M y )
2
Variance for a
sample
t
(M x y   x y )
sm
t Statistic
for SingleSample t
Test
t
Statistic
for
Indepen
dent t
Test
T Statistic for
Paired-Sample t
Test
df  df ( x)  df ( y )
s Pooled
2
2
s Mx

s
Degrees of Freedom for
Independent Samples t Test
 df x  2  df y 
s
s x  
 
 df total 
 df total 
s
2
pooled
s
Nx
2
Difference
s
2
My
2
Mx
s Difference  s

s
s 2pooled
Pooled Variance. Like adding
2 together the weighted average of
y the variance from Variable X and
Variable Y.
Variance for a Distribution of
means for Indep.-Samples t Test
Ny
2 Variance for a Distribution of
My Differences between Means
SD of the distribution of
2
Differences Between Means
Difference
2

(
Y

M
)
( X  M )
SS s 760 760  SS  272  272  136.333
2
sx 



 190
N

1
df 3  1
2
N 1
df 5  1
4
2
2
y
2
2
2
s Difference
 sMx
 sMy
 34.422  57.37  91.792
s
2
pooled
 df x  2  df y  2
4
2
s y   190   136.333  172.11
s x  
 
6
6
 df total 
 df total 
df total  df x  df y  4  2  6
s 2pooled

s Difference
91.792

s 2pooled

172.11
 57.37
3
   11.333  .1235
172.11
(
M

47  58.333
s 
X  M Y ) 34.422
5
t  Nx

2
Mx
s
2
My
Ny
91.792
2
s
5
.
804862
5
.804862

(
M


)
SS 2.052329
61.09
x

y
x

y
2
ssm 





2
.
82843
N
8
N 1
N 1 6 1
( M   m ) 29.86  30
t

 -0.2171
sm
.645
s
s
( M x  y   x  y ) 2
N 1
( M x  y   x  y ) 2
N 1


sm 
SS

Ns 1
3.49543


6
N
SS
 12.218
N 1
( X  M ) 2
SSx
760
s 


190
N 1
N 1
4
2
x
df total  df s dfy
2
x Mx
s
s
2
Mx

s
2
pooled
2
pooled
Nx
s 2pooled
Nx
172.1

 34.42
6 2
2
2
s
2
My

s 2pooled
Ny

s Difference  sMx  sMy  34.42  57.37  91.7926
 df x  2  df y  2
4
2
s y   190   136.3  172.1
s x  
 
6
6
 df total 
 df total 
2
s My

s
2
pooled
2
s Difference  s Difference
 91.7926  9.580845
Ny
( M X  M Y ) 47  58.333  11.333
t


 1.18292
s Difference
9.580845
9.580845
2
2
2
s Difference
 s Mx
 s My
M 
172.1
 57.37
3
(Y  M ) 2
SSy
272.667
s 


 136.3
 17.5  20.4  2N.9 1
N 1
2
2
y
Central Limit Theorem in Single
Independent T-tests: Samples
Two samples (moms/non-moms; drunk /sober students
etc.) independent of each other (subjects participate in
only one condition) which you draw from a universe of
respective possible samples.
Central Limit Theorem in Single Independent t-tests:
Distribution of Samples
Two samples (moms/non-moms; drunk /sober students
etc.) independent of each other (subjects participate in
only one condition) is drawn from a hypothetical
distribution of samples of the same size, with mean of
samples and a standard error.
Central Limit Theorem in Single Independent t-tests:
Distribution of Samples
Difference between the
means. Δ Mx-My
Difference between the means. Would it
occur with a probability of 5% or less?
We want to know if there is a statistically significant
difference between the means.
Central Limit Theorem in Single Independent t-tests:
Distribution of Differences Between Means
Difference between the means, Δ MxMy, comes from a distribution of Δ MxMy that has a standard deviation drawn
from the pooled variance of the sample
distributions
We want to know if there is a statistically significant
difference between the means.
Central Limit Theorem in Single
Independent T-tests
Download