# t Test for Two Independent Group Means ```Psych 5500/6500
t Test for Two Independent Means
Fall, 2008
1
Cause and Effect Relationships
Does Variable X (cause/influence/affect)
Variable Y?
Variable X would be the independent variable
(the cause).
Variable Y would be the dependent variable
(the effect).
2
t Test for 2 Independent
Means
Used to compare two independent samples,
specifically we are comparing the means of
the samples to see whether or not we can
infer that the means of the two populations
they represent are different.
Usually we are testing a theory which
proposes that an independent variable has
3
Example 1
Question: Does gender influence respiration
rate?
Design: randomly sample 20 males and 20
females from some population and measure
their respiration rate while at rest.
4
Example 1
I.V.=
D.V.=
H0: μfemale= μmale (or) μfemale-μmale =0
HA: μfemale μmale (or) μfemale-μmale  0
5
Hypotheses
Note that the hypotheses are always about
populations.
H0: μfemale= μmale HA: μfemale μmale
H 0 : Yfemales  Ymales
H A : Yfemales  Ymales
We want to be able to generalize the results to
the populations from which we sampled, not
just to the specific participants who are in
our sample.
6
Example 2
Question: Is maze running ability affected by
the presence or absence of some specific
drug?
Design: Select 11 rats and randomly divide
them into two groups. The rats in Group 1
are given the drug, the rats in Group 2 are
not. The number of wrong turns each rat
makes before reaching the end of the maze
is recorded.
7
Example 2
I.V.=
D.V.=
H0: μdrug= μno_drug (or)
HA: μdrug μno_drug (or)
μdrug-μno_drug = 0
μdrug-μno_drug  0
8
Statistic
The statistic upon which we will base our decision
Y1  Y2
Challenge: if H0 is true then the two population
means are equal, and we expect the two sample
means to be similar, but even if H0 is true the
two sample means will not exactly equal each
other due to chance (i.e. the samples have
random bias). So if the two sample means differ
is that due to differences in the population
means or due to chance?
9
The Solution
Set up the ‘Sampling Distribution of
Y1  Y2 assuming H0 is true’ and label it
as such. Then:
•
•
The mean of that sampling distribution is
based upon H0.
The standard deviation of that sampling
distribution is estimated from the data from
the two samples
10
Sampling Distribution of the statistic if H0
is true
11
Sampling Distribution (cont.)
 Y  Y   0
1
(based upon H0 being true)
2
Computational formula for the standard error of the difference:
est. σ Y1  Y2
SS1  SS2 
 1
1 




N1  N 2  2  N1 N 2 
d.f.  N1 1  N2 1  N1  N2  2
12
Standard Error of the Difference
Let’s take a conceptual look at the standard deviation of the test
statistic (Y1 - Y2 ) This t test assumes that both populations have the same
variance, and uses this to ‘pool’ the two estimates of this population
variance into one good estimate using the following formula, which
weights the estimate based upon the size of each sample was.:
2
2
(N

1)est.σ

(N

1)est.σ
1
2
2
est. σ 2  1
N1  N 2  2
Conceptual formula for the standard error of the difference:
est. σ Y1  Y2
 1
1 

 est.σ 

 N1 N 2 
2
13
Drug Example Data
Group 1 (Drug)
Group 2 (No Drug)
7
4
8
6
6
5
10
3
6
2
5
14
Group Statistics
N2  5
N1  6
Y
Y
1
1
 42
2
 310
42
Y1 
7
6
42 2
SS1  310 
 16
6
Y
Y
2
2
 20
2
 90
20
Y2 
4
5
20 2
SS2  90 
 10
5
15
t Computations
est. σ Y1  Y2
 SS1  SS 2   1
 16  10   1 1 
1 

  
  
 

 6  5  2   6 5 
 N1  N 2  2   N1 N 2 
 26 

.17  .2  
 9  
2.89.37  
1.07  1.03
16
17
Setting up the Rejection Regions
d.f.  N1  N 2  2  6  5  2  9
t c  2.262
18
19
tobt
t obt 
t obt
Y  Y   μ
1
2
Y1  Y2
est.σ Y1  Y2

7  4  0

 2.91
1.03
20
21
Decision
We ‘reject H0’. We can conclude that the two
samples represent populations that have different
means.
We would like to then go on and state that the
independent variable (drug vs. no drug) must
have made the two population means different
from each other, but at this point we can’t, first we
have to show that there is no other reason for why
the two populations might have different means.
This takes us to the topic of ‘confounding
variables’, which we will cover in the next lecture.
22
Confidence Intervals
Confidence interval for the true difference
between μ1 and μ2 :
Y  Y  t 
1
2
c: ,df,2 - tail
est.σ
Y1  Y2

7  4  2.2621.03  3  2.33  0.67, 5.33
95% confidence interval: 0.67  (μ1 - μ2)  5.33
If a hypothesis states a value for μ1 - μ2 that is outside of that
confidence interval (e.g. H0: μ1 - μ2 = 0) then you can reject it
23
Reporting Results
A standard way of reporting the results of t tests is to
use the following format:
t(df)=tobt, p=?
From last example:
t(9)=2.91, p=...
We can use the ‘t distribution tool’ in ‘Oakley Stat
Tools’ to get the exact value of p, or we can use
SPSS to do the t test for us.
t(9) = 2.91, p=.017
24
One-Tailed Tests
So far the examples have involved non-directional
theories (which predict the two population means
will be different but don’t predict one which will be
greater than the other). This is done with a 2-tail
test.
It is also possible to test theories which are
directional (predict specifically which population
mean should be greater). This is done with a 1-tail
test, which will influence how we write our
hypotheses, and will lead to just one rejection
region in our sampling distribution.
25
One-tailed Tests
Again, express the prediction made by the
theory when you write HA, H0 is then
everything else. For testing a theory which
predicts that the mean of population one
(drugged rats) should be greater than the
mean of population two (undrugged rats):
H0: μ1  μ2 (or equivalently) μ1-μ2  0
HA: μ1 &gt; μ2 (or equivalently) μ1-μ2 &gt; 0
26
Rejection Region
27
one-tailed tests
For testing a theory which predicts that the
mean of population one (drugged rats)
should be less than the mean of population
two (undrugged rats):
H0: μ1  μ2 (or equivalently) μ1-μ2  0
HA: μ1 &lt; μ2 (or equivalently) μ1-μ2 &lt; 0
28
Rejection Region
29
Null Hypothesis
I have given two ways of expressing H0.
H0: μdrug= μno_drug (or) μdrug - μno_drug = 0
The first way is somewhat conceptually easier,
but the second has an advantage as well. I
have mentioned before that the null
hypothesis is usually, but not always, the
hypothesis of ‘no difference’. Let me now
give an example where that wouldn’t be
true…
30
Let us say that the difference in population means
between rats on the drug and those not on the drug
has been previously established as equaling 1.5.
In this experiment, however, we will have the rats
swim through the maze and we are testing a theory
which predicts that the difference between the two
groups should be influenced by swimming (i.e. it
will no longer equal 1.5) The null hypothesis is that
performance won’t be influenced by swimming.
Now our hypotheses would look like this:
H0: μdrug-μno_drug = 1.5
HA: μdrug-μno_drug  1.5
Note that conceptually H0 can still be thought of as ‘no difference’, in this
case we are saying that the difference between the drug and no drug
groups will not be different when the rats are swimming.
31
Sampling Distribution if H0 is
true
32
tobtained
The tobtained score is still simply a standard
score on the curve: i.e. the test statistic
minus the mean of the curve divided by the
standard deviation (standard error) of the
curve.
t obtained 
(Y1  Y2 )  μ (Y1  Y2 )
est.  (Y1  Y2 )
but in this case μ (Y1  Y2 )  1.5
33
Assumptions underlying this t
test
1. Independence of scores (within and
between groups)
2. Both populations normally distributed
3. The two populations have identical
variances
We will examine the assumption of
identical variances in a latter lecture.
34
Effect Size
Again the measures of effect size include:
1. Simply reporting the ‘raw’ effect size.
2. Reporting a standardized effect size.
3. Reporting the strength of association
(which we will cover next semester).
35
‘Raw’ Effect Size
This would be simply reporting the mean of the
two groups and the difference between
those means. In our experiment the mean
number of wrong turns made by the ‘drug’
group was 7, the mean number for the ‘no
drug’ group was 4, which is a difference of
3 between the two means.
36
Standardized Effect Size
We will take a look at three standardized
measures of effect size:
1. Cohen’s d
2. Hedges’s g
3. Glass’s Δ
37
Cohen’s d
For the effect size in the population (exact, not estimated):
μ1  μ 2
δ
σY
Remember that an assumption underlying this t test is that both
populations have the same variance (σY).
38
Cohen’s d
For the effect size in the sample:
Y1  Y2
d
Spooled
where Spooled 
N1S12  N 2S22
SS1  SS2

N1  N 2
N1  N 2
If you examine the formula for Spooled you can see that it is
simply the standard deviation of all the scores lumped into one
group.
39
Hedges’s g
Hedges’s g gives us an estimate of the effect size in the population
form which we sampled.
Y1  Y2
g
est.σ pooled
(N1 - 1)est.σ12  (N 2 - 1)est.σ 22
where est.σ pooled 
N1  N 2  2
est. σpooled is a ‘pooled’ estimate of the standard deviation of Y,
the formula combines the estimates of σY from the two groups,
weighting each estimate based upon how many scores were in
40
the group.
Glass’s Δ
Glass’s delta is similar to Hedges’s g, but instead of using the
scores from both groups to estimate the standard deviation of Y,
delta just uses the data from the control group to estimate it.
Y1  Y2
Δ
est.σ Control
where est.σ Control  est.σ
2
Control
41
Glass’s Δ
In an experiment designed to test the effect of some
treatment it is common to include a group that is
handled exactly like the group that gets the
treatment except without the treatment, this is
called the ‘Control Group’ and the group that gets
the treatment is called the ‘Treatment Group’. The
reason the control group is named as it is will be
covered in the lecture on confounding variables. In
our example the rats given the drug constitute the
‘treatment group’ and those not given the drug are
the ‘control group’.
42
Glass’s Δ
Glass’s delta is used when there is reason to
believe that the treatment applied to the
treatment group might have affected not only
the mean of the group but the variance of
that group as well. If this is the case then
the assumption of equal variances is not met
(we will see how to analyze the data anyway
later) and it makes no sense to use the
variance of both groups to estimate the
variance of Y, as they would actually be
measuring two different variances, not one.
43
Using these Formulas
N1  6
N2  5
42
Y1 
7
6
42 2
SS1  310 
 16
6
SS1 16
2
S1 

 2.67
N1
6
20
Y2 
4
5
20 2
SS2  90 
 10
5
SS2 10
2
S2 

 2.00
N2
5
SS1
16
est.σ 

 3.20
N1  1 5
SS2
10
est.σ 

 2.50
N2 1 4
2
1
2
2
44
Using these Formulas
Y1  Y2
d
Spooled
where Spooled 
NS N S
N1  N 2
2
1 1
2
2 2
SS1  SS2
1 6  10


 1.54
N1  N 2
11
74
d
 1.95
1.54
45
Using these Formulas
Y1  Y2
g
est.σ pooled
(N1 - 1)est.σ12  (N 2 - 1)est.σ 22
where est.σ pooled 
N1  N 2  2
(5)(3.2)  (4)(2.50)

 1.70
652
74
g
 1.76
1.7
46
Using these Formulas
Y1  Y2
Δ
est.σ Control
where est.σ Control  est.σ
2
Control
 2.50  1.58
74
Δ
 1.90
1.58
47
Useful Conversions
N1  N 2
dg
N1  N 2  2
t obt
d
p1p 2 (N1  N 2  2)
where p1  prop. of scores in group 1, p 2  prop. in group 2
‘prop’ means ‘proportion’, so if 14 of the 20 scores were in group 1, then p1 would
be 14/20 while p2 would be 6/20.
48
Useful Conversions
N1  N 2  2
gd
N1  N 2
t obt
g
p1p 2 (N1  N 2 )
where p1  prop. of scores in group 1, p 2  prop. in group 2
49
Useful Conversions
t obt  d p1p 2 (N1  N 2  2)
where p1  prop. of scores in group 1, p 2  prop. in group 2
t obt  g p1p 2 (N1  N 2 )
where p1  prop. of scores in group 1, p 2  prop. in group 2
50
```