04a independent sample t-test
TRANSCRIPT
-
8/6/2019 04a Independent Sample T-Test
1/37
11
Independent Samples tIndependent Samples t--TestTest
(or 2(or 2--Sample tSample t--Test)Test)
Advanced Research Methods in PsychologyAdvanced Research Methods in Psychology
-- lecturelecture --
Matthew RockloffMatthew Rockloff
-
8/6/2019 04a Independent Sample T-Test
2/37
22
When to use the independentWhen to use the independent
samples tsamples t--testtest The independent samples tThe independent samples t--test is probably thetest is probably the
single most widely used test in statistics.single most widely used test in statistics.
It is used toIt is used to compare differencescompare differences betweenbetweenseparate groups.separate groups.
In Psychology, these groups are often composedIn Psychology, these groups are often composedby randomly assigning research participants toby randomly assigning research participants toconditions.conditions.
However, this test can also be used to exploreHowever, this test can also be used to exploredifferences in naturally occurring groups.differences in naturally occurring groups.
For example, we may be interested in differencesFor example, we may be interested in differencesof emotional intelligence between males andof emotional intelligence between males andfemales.females.
-
8/6/2019 04a Independent Sample T-Test
3/37
33
When to use the independent samplesWhen to use the independent samples
tt--testtest (cont.)(cont.)
Any differences between groups can beAny differences between groups can beexplored with the independent texplored with the independent t--test, astest, as
long as the tested members of eachlong as the tested members of eachgroup are reasonably representative ofgroup are reasonably representative ofthe populationthe population. [1]. [1]
[1][1]There are some technicalThere are some technicalrequirements as well. Principally,requirements as well. Principally,each variable must come from aeach variable must come from a
normal (ornearlynormal) distribution.normal (ornearlynormal) distribution.
-
8/6/2019 04a Independent Sample T-Test
4/37
-
8/6/2019 04a Independent Sample T-Test
5/37
55
Example 3.1Example 3.1 (cont.)(cont.)
At the end of the week, we measureAt the end of the week, we measure
weight gain by each participant.weight gain by each participant.
Which diet causes more weight gain?Which diet causes more weight gain?
In other words, the null hypothesis is:In other words, the null hypothesis is:
Ho: wt. gain pizza diet =wt. gain beer diet.Ho: wt. gain pizza diet =wt. gain beer diet.
-
8/6/2019 04a Independent Sample T-Test
6/37
66
Example 3.1Example 3.1 (cont.)(cont.)
Why?Why?
The null hypothesis is the opposite ofThe null hypothesis is the opposite of
what we hope to find.what we hope to find.
In this case, our research hypothesis isIn this case, our research hypothesis is
that there ARE differences between the 2that there ARE differences between the 2
diets.diets.
Therefore, our null hypothesis is thatTherefore, our null hypothesis is that
there are NO differences between these 2there are NO differences between these 2
diets.diets.
-
8/6/2019 04a Independent Sample T-Test
7/37
77
XX11 : Pizza: Pizza XX22 : Beer: Beer
11 33 11 1122 44 00 00
22 44 00 00
22 44 00 00
33 55 11 11
22 44
0.40.4 0.40.4
!'1
2
11 )( ''
!' 2
2
22 )( ''
!''
!
n
sx
2
2)(
Example 3.1Example 3.1 (cont.)(cont.)
Column 3 Column 4
-
8/6/2019 04a Independent Sample T-Test
8/37
88
Example 3.1Example 3.1 (cont.)(cont.)
The first step in calculating theThe first step in calculating the
independent samples tindependent samples t--test is to calculatetest is to calculate
thethe variancevariance andand meanmean in each condition.in each condition.
In the previous example, there are a totalIn the previous example, there are a total
of 10 people, with 5 in each condition.of 10 people, with 5 in each condition.
Since there are different people in eachSince there are different people in eachcondition, these samples arecondition, these samples are
independentindependent of one another; of one another;
giving rise to the name of the test.giving rise to the name of the test.
-
8/6/2019 04a Independent Sample T-Test
9/37
99
Example 3.1Example 3.1 (cont.)(cont.)
The variances and means are calculatedThe variances and means are calculatedseparately for each conditionseparately for each condition
(Pizza and Beer).(Pizza and Beer). A streamlined calculation of theA streamlined calculation of the variancevariance forfor
each condition was illustrated previously.each condition was illustrated previously.(See Slide 7.)(See Slide 7.)
In short, we take each observed weight gainIn short, we take each observed weight gainfor the pizza condition, subtract it from thefor the pizza condition, subtract it from themean gain of the pizza dieters (mean gain of the pizza dieters ( 22) and) andsquare the result (seesquare the result (see column 3column 3).).
!'1
-
8/6/2019 04a Independent Sample T-Test
10/37
1010
Example 3.1Example 3.1 (cont.)(cont.)
Next, add up column 3 and divide by theNext, add up column 3 and divide by the
number of participants in that conditionnumber of participants in that condition
(n(n11 = 5) to get the= 5) to get the sample variancesample variance,,
The same calculations are repeated forThe same calculations are repeated for
the beer condition.the beer condition.
4.02!
xs
-
8/6/2019 04a Independent Sample T-Test
11/37
1111
FormulaFormula
The formula forThe formula for
thethe independent samples tindependent samples t--testtest is:is:
112
2
1
2
21
21
''
n
S
n
S
t
xx
, df = (n1-1) + (n2-1)
-
8/6/2019 04a Independent Sample T-Test
12/37
-
8/6/2019 04a Independent Sample T-Test
13/37
1313
Some theorySome theory
The t is calculated under theThe t is calculated under the
assumption, called theassumption, called the null hypothesisnull hypothesis,,
that there are no differences between thethat there are no differences between the
pizza and beer diet.pizza and beer diet.
If this were true, when we repeatedlyIf this were true, when we repeatedlysample 10 people from the populationsample 10 people from the population
and put them in our 2 diets, most oftenand put them in our 2 diets, most often
we would calculate a t of 0.we would calculate a t of 0.
-
8/6/2019 04a Independent Sample T-Test
14/37
1414
Some theorySome theory -- Why?Why?
Look again at the formula for the t.Look again at the formula for the t.
Most often the numerator (XMost often the numerator (X11--XX22) will be) will be
0, because the0, because the meanmean of the twoof the twoconditions should be theconditions should be the samesame under theunder the
null hypothesis.null hypothesis.
That is, weight gain is the same underThat is, weight gain is the same under
both the pizza and beer diet.both the pizza and beer diet.
-
8/6/2019 04a Independent Sample T-Test
15/37
1515
Some theorySome theory -- WhyWhy (cont.)(cont.)
Sometimes the weight gain might be a bitSometimes the weight gain might be a bithigher under the pizza diet, leading to ahigher under the pizza diet, leading to apositive t value.positive t value.
In other samples of 10 people, weightIn other samples of 10 people, weightgain might be a little higher under thegain might be a little higher under thebeer diet, leading to a negative t value.beer diet, leading to a negative t value.
TheThe important pointimportant point, however, is that, however, is thatunder the null hypothesis we shouldunder the null hypothesis we shouldexpect that most t values that weexpect that most t values that wecompute are close to 0.compute are close to 0.
-
8/6/2019 04a Independent Sample T-Test
16/37
1616
Some theorySome theory (cont.)(cont.)
Our computed tOur computed t--value is not 0, but it is in factvalue is not 0, but it is in fact
negative (t(8) =negative (t(8) = --4.47).4.47).
Although the tAlthough the t--value is negative, this should notvalue is negative, this should notbother us.bother us.
Remember that the tRemember that the t--value is onlyvalue is only -- 4.474.47
because we named the pizza diet Xbecause we named the pizza diet X11 and theand the
beer diet Xbeer diet X22..
This is, of course,This is, of course, completely arbitrarycompletely arbitrary..
If we had reversed our order of calculation, withIf we had reversed our order of calculation, with
the pizza diet as Xthe pizza diet as X22 and the beer diet as Xand the beer diet as X11, then, then
our calculated tour calculated t--value would be positive 4.47.value would be positive 4.47.
-
8/6/2019 04a Independent Sample T-Test
17/37
1717
Example 3.1Example 3.1 (again)(again) CalculationsCalculations
The calculated tThe calculated t--value is 4.47 (notice, Ivevalue is 4.47 (notice, Ive
eliminated the unnecessary eliminated the unnecessary -- sign sign),),
and the degrees of freedom are 8.and the degrees of freedom are 8. In the research question we did notIn the research question we did not
specify which diet should cause morespecify which diet should cause more
weight gain, therefore this tweight gain, therefore this t--test is a sotest is a so--
calledcalled 22--tailed t.tailed t.
-
8/6/2019 04a Independent Sample T-Test
18/37
1818
Example 3.1Example 3.1 (again)(again) CalculationsCalculations
In theIn the last steplast step, we need to find the, we need to find thecritical value for a 2critical value for a 2--tailed t with 8tailed t with 8
degrees of freedom.degrees of freedom. This is available from tables that are inThis is available from tables that are in
the back of any Statistics textbook.the back of any Statistics textbook.
Look in the back for Critical Values ofLook in the back for Critical Values of
the tthe t--distribution, or something similar.distribution, or something similar. The value you should find is:The value you should find is:
C.V.C.V. t(8), 2t(8), 2--tailedtailed = 2.31= 2.31..
-
8/6/2019 04a Independent Sample T-Test
19/37
1919
Example 3.1Example 3.1 (cont.)(cont.)
The calculated tThe calculated t--value of 4.47 is larger invalue of 4.47 is larger inmagnitude than the C.V. of 2.31, therefore wemagnitude than the C.V. of 2.31, therefore wecan reject the null hypothesis.can reject the null hypothesis.
Even for a results section of journal article, thisEven for a results section of journal article, thislanguage is a bit too formal and general. It islanguage is a bit too formal and general. It ismore important to state the research result,more important to state the research result,namely:namely:
Participants on the Beer diet (Participants on the Beer diet (MM= 4.00)= 4.00)gained significantly more weight thangained significantly more weight thanthose on the Pizza diet (those on the Pizza diet (MM= 2.00), t(8) == 2.00), t(8) =4.47, p < .05 (two4.47, p < .05 (two--tailed).tailed).
-
8/6/2019 04a Independent Sample T-Test
20/37
2020
Example 3.1Example 3.1 (concluding comment)(concluding comment)
Repeat from previous slide:Repeat from previous slide:
Participants on the Beer diet (Participants on the Beer diet (MM= 4.00)= 4.00)gained significantly more weight thangained significantly more weight thanthose on the Pizza diet (those on the Pizza diet (MM= 2.00), t(8) == 2.00), t(8) =4.47, p < .05 (two4.47, p < .05 (two--tailed).tailed).
Making this conclusion requiresMaking this conclusion requiresinspection of the mean scores forinspection of the mean scores foreach condition (Pizza and Beer).each condition (Pizza and Beer).
-
8/6/2019 04a Independent Sample T-Test
21/37
2121
Example 3.1 UsingSPSSExample 3.1 UsingSPSS
First,First, the variables must be setup in the SPSSthe variables must be setup in the SPSSdata editor.data editor.
We need to include both the independent andWe need to include both the independent and
dependent variables.dependent variables. Although it is not strictly necessary, it is goodAlthough it is not strictly necessary, it is good
practice to give each person a unique codepractice to give each person a unique code(e.g., personid):(e.g., personid):
-
8/6/2019 04a Independent Sample T-Test
22/37
2222
Example 3.1 UsingSPSSExample 3.1 UsingSPSS(cont.)(cont.)
In the previous example:In the previous example:
Dependent VariableDependent Variable
== wtgainwtgain (or weight gain)(or weight gain)
Independent VariableIndependent Variable == dietdiet
Why?Why? The independent variable (diet)The independent variable (diet) causescauses
changeschanges in the dependent variablein the dependent variable
(weight gain).(weight gain).
-
8/6/2019 04a Independent Sample T-Test
23/37
2323
Example 3.1 UsingSPSSExample 3.1 UsingSPSS(cont.)(cont.)
Next,Next, we need to provide codes thatwe need to provide codes thatdistinguish between the 2 types of diets.distinguish between the 2 types of diets.
By clicking in the grey box of the L
abelBy clicking in the grey box of the L
abelfield in the row containing the dietfield in the row containing the dietvariable, we get a popvariable, we get a pop--up dialog thatup dialog thatallows us toallows us to codecode the diet variable.the diet variable.
Arbitrarily, the pizza diet is coded as dietArbitrarily, the pizza diet is coded as diet1 and the beer diet is diet 2.1 and the beer diet is diet 2.
Any other 2 codes would work, but theseAny other 2 codes would work, but thesesufficesuffice
See next slide.
See next slide.
-
8/6/2019 04a Independent Sample T-Test
24/37
2424
Example 3.1 UsingSPSSExample 3.1 UsingSPSS(coding)(coding)
-
8/6/2019 04a Independent Sample T-Test
25/37
2525
Example 3.1 UsingSPSSExample 3.1 UsingSPSS(data view)(data view)
Moving to the dataMoving to the dataview tab of the SPSSview tab of the SPSSeditor, the data iseditor, the data is
entered.entered. Each participant isEach participant is
entered on a separateentered on a separateline; a code is enteredline; a code is entered
for the diet they werefor the diet they wereon (1 = Pizza, 2 =on (1 = Pizza, 2 =Beer); and the weightBeer); and the weightgain of each isgain of each is
entered, as followsentered, as follows
-
8/6/2019 04a Independent Sample T-Test
26/37
2626
Example 3.1 UsingSPSSExample 3.1 UsingSPSS(data view)(data view)
Moving to the dataMoving to the dataview tab of the SPSSview tab of the SPSSeditor, the data iseditor, the data is
entered.entered. Each participant isEach participant is
entered on a separateentered on a separateline; a code is enteredline; a code is entered
for the diet they werefor the diet they wereon (1 = Pizza, 2 =on (1 = Pizza, 2 =Beer); and the weightBeer); and the weightgain of each isgain of each is
entered, as followsentered, as follows
-
8/6/2019 04a Independent Sample T-Test
27/37
2727
Example 3.1 UsingSPSSExample 3.1 UsingSPSS(data view)(data view)
Moving to the dataMoving to the dataview tab of the SPSSview tab of the SPSSeditor, the data iseditor, the data is
entered.entered. Each participant isEach participant is
entered on a separateentered on a separateline; a code is enteredline; a code is entered
for the diet they werefor the diet they wereon (1 = Pizza, 2 =on (1 = Pizza, 2 =Beer); and the weightBeer); and the weightgain of each isgain of each isentered, as followsentered, as follows
-
8/6/2019 04a Independent Sample T-Test
28/37
2828
Example 3.1 UsingSPSSExample 3.1 UsingSPSS
(command syntax)(command syntax)
Next,Next, thethe command syntaxcommand syntax for an independentfor an independent
tt--test must be entered into the command editor.test must be entered into the command editor.
The format for the command is as follows:The format for the command is as follows:tt--test groupstest groups IndependentVariableIndependentVariable((Level1Level1,,Level2Level2))
variables=variables=DependentVariableDependentVariable..
You must substitute the names of theYou must substitute the names of the
independent and dependent variables, as wellindependent and dependent variables, as well
as the codes for the 2 levels of the independentas the codes for the 2 levels of the independent
variable. In our example, thevariable. In our example, the syntaxsyntax should beshould be
as per the next slideas per the next slide
-
8/6/2019 04a Independent Sample T-Test
29/37
2929
Example 3.1 UsingSPSSExample 3.1 UsingSPSS
(command syntax) (cont.)(command syntax) (cont.)
After running this syntax, the following
output appears in the SPSS output viewer
See next slide.
-
8/6/2019 04a Independent Sample T-Test
30/37
3030
Example 3.1: SPSSOutput viewerExample 3.1: SPSSOutput viewer
Independent Samples Test
-
8/6/2019 04a Independent Sample T-Test
31/37
3131
Example 3.1 UsingSPSSExample 3.1 UsingSPSS(cont.)(cont.)
SPSS gives theSPSS gives the meansmeans for each of thefor each of theconditions (Pizza Mean = 2 and Beerconditions (Pizza Mean = 2 and BeerMean = 4).Mean = 4).
In addition, SPSS provides aIn addition, SPSS provides a tt--valuevalue ofof --4.47 with 8 degrees of freedom.4.47 with 8 degrees of freedom.
These are the same figures that wereThese are the same figures that werecomputed by hand previously.computed by hand previously.
However, SPSSHowever, SPSS does notdoes not provide aprovide acritical value.critical value.
Instead, anInstead, an exact probabilityexact probability is providedis provided(p = .002).(p = .002).
-
8/6/2019 04a Independent Sample T-Test
32/37
3232
Example 3.1 UsingSPSSExample 3.1 UsingSPSS(cont.)(cont.)
As long as this pAs long as this p--value falls below thevalue falls below the
standard of .05, we can declare astandard of .05, we can declare a
significant difference between our meansignificant difference between our meanvalues.values.
Since .002 is below .05 we can conclude:Since .002 is below .05 we can conclude:
Participants on the Beer diet (Participants on the Beer diet (MM= 4.00)= 4.00)gained significantly more weight thangained significantly more weight than
those on the Pizza diet (those on the Pizza diet (MM= 2.00),= 2.00),
t(8) = 4.47,t(8) = 4.47, p < .01p < .01 (two(two--tailed).tailed).
-
8/6/2019 04a Independent Sample T-Test
33/37
-
8/6/2019 04a Independent Sample T-Test
34/37
3434
Example 3.1 UsingSPSSExample 3.1 UsingSPSS(cont.)(cont.)
The SPSS output also displaysThe SPSS output also displays Levenes TestLevenes TestforforEquality of VariancesEquality of Variances (see the first 2(see the first 2columns in second table on slide 30).columns in second table on slide 30).
Why?Why? Strictly speaking, the tStrictly speaking, the t--test is only valid if wetest is only valid if we
havehave approximately equal variancesapproximately equal variances within eachwithin each
of our two groups.of our two groups. In our example, this was not a problem becauseIn our example, this was not a problem because
the 2 variances were exactly equal (Variancethe 2 variances were exactly equal (VariancePizza = 0.04 and Variance Beer = 0.04).Pizza = 0.04 and Variance Beer = 0.04).
-
8/6/2019 04a Independent Sample T-Test
35/37
3535
Example 3.1 UsingSPSSExample 3.1 UsingSPSS(cont.)(cont.)
However, if this test is significant,However, if this test is significant,
meaning that the pmeaning that the p--value given is lessvalue given is less
than .05, then we should choose thethan .05, then we should choose thebottom line when interpreting ourbottom line when interpreting our
results.results.
This bottom line makes slightThis bottom line makes slight
adjustments to the tadjustments to the t--test to accounttest to accountfor problems when there are notfor problems when there are not
equal variances in both conditions.equal variances in both conditions.
-
8/6/2019 04a Independent Sample T-Test
36/37
3636
Example 3.1 UsingSPSSExample 3.1 UsingSPSS(cont.)(cont.)
The practical importance of thisThe practical importance of this
distinction is small.distinction is small.
Even if variances are not equal betweenEven if variances are not equal betweenconditions, the hand calculations weconditions, the hand calculations we
have shown will most often lead to thehave shown will most often lead to the
correct conclusion anyway, and use ofcorrect conclusion anyway, and use of
the top line is almost alwaysthe top line is almost alwaysappropriate.appropriate.
-
8/6/2019 04a Independent Sample T-Test
37/37
3737
Independent Samples tIndependent Samples t--TestTest
(or 2(or 2--Sample tSample t--Test)Test)
Advanced Research Methods in PsychologyAdvanced Research Methods in Psychology
-- Week 2 lectureWeek 2 lecture --
Matthew RockloffMatthew Rockloff