Statistics How To

Independent Samples T Test: Definition, Running

T-Distribution > Independent Samples T Test

independent samples t test

The rejection regions in a two-tailed t-distribution. Image:


What is an Independent Samples T Test?

The independent samples t test is the most common form of the T test. It helps you to compare the means of two sets of data. For example, you could run a t test to see if the average test scores of males and females are different; the test answers the question, “Could these differences have occurred by random chance?” The two other types of t test are:

  • One sample t test: used to compare a result to an expected value. For example, do males score higher than the average of 70 on a test if their exam time is switched to 8 a.m.?
  • Paired t test (dependent samples): used to compare related observations. For example, do test scores differ significantly if the test is taken at 8 a.m. or noon?

This test is extremely useful because for the z test you need to know facts about the population, like the population standard deviation. With the independent samples t test, you don’t need to know this information. You should use this test when:

Assumptions for the Independent Samples T Test

How to Run an Independent Samples T Test

Technology is usually used to run this test. For Excel instructions, see: How to run a T Test in Excel. For instructions by hand, scroll down.
Back to top

How to Run an Independent Samples T Test in SPSS

Before you perform a t test in SPSS for independent samples, you should:

  1. Write a hypothesis statement. For the above research question, the null hypothesis would be that there is no significant difference
  2. Determine if your test is one-tailed or two-tailed
  3. Specify an alpha level.

Watch the video or read the steps below:

Step 1: Open the worksheet with the data you want to perform the t test in SPSS.

Step 2: Define the SPSS variables you want to perform a t-test on. For example, you might want to compare GPAs between male and female high school students. Therefore, you’ll want to define the variables “sex” (i.e. other male or female). If you aren’t sure how to define variables in SPSS, click here to find out how.

Step 3: Click “Analyze,” then click “Compare Means,” then click “Independent Sample T Test.”
t test in spss 1

Step 4: Select the dependent variable from the left window pane and then click the top arrow button to move the variables over to the Test Variable(s): window. For this example, we are comparing GPAs, so the test variable we want to select is GPA.
SPSS t test 2

Step 5: Select the independent variable in the left window and then click the arrow to the left of the “Grouping Variable” box. The grouping variable is the variable you divided into groups when you defined variables. For this example, the groups are “male” and “female” so the grouping variable you want to select is “Sex.”

Step 6: Click “Define Groups.” For this example, type “1” into the Group 1 box (for female) and then type “2” into the Group 2 box (for male).

Step 7: Click “Continue” and then click “OK.” The test is calculated and the results will appear in a new window.
SPSS t test 3

T Test in SPSS: Output

Your output will include:

  • The Levine’s test for equal variance (the first section of the Independent Samples Test box). If the significance level is larger than .05, you should use the first line in the output table, Equal variances assumed. If the value is .05 or lower, use the second row of results.
  • Sig (2 Tailed): use the value indicated in Levine’s test. If this p-value is above .05, then there is not a significant difference in test scores.

Tip: Click “Options” on the t-test window to change the confidence interval.

Check out out YouTube Channel for more SPSS videos!
Back to top

Calculating an Independent Samples T Test By hand

Sample question: Calculate an independent samples t test for the following data sets:
Data set A: 1,2,2,3,3,4,4,5,5,6
Data set B: 1,2,4,5,5,5,6,6,7,9

Step 1: Sum the two groups:
A: 1 + 2 + 2 + 3 + 3 + 4 + 4 + 5 + 5 + 6 = 35
B: 1 + 2 + 4 + 5 + 5 + 5 + 6 + 6 + 7 + 9 = 50

Step 2: Square the sums from Step 1:
352 = 1225
492 = 2500
Set these numbers aside for a moment.

Step 3: Calculate the means for the two groups:
A: (1 + 2 + 2 + 3 + 3 + 4 + 4 + 5 + 5 + 6)/10 = 35/10 = 3.5
B: (1 + 2 + 4 + 5 + 5 + 5 + 6 + 6 + 7 + 9) = 50/10 = 5
Set these numbers aside for a moment.

Step 4: Square the individual scores and then add them up:
A: 11 + 22 + 22 + 33 + 33 + 44 + 44 + 55 + 55 + 66 = 145
B: 12 + 22 + 44 + 55 + 55 + 55 + 66 + 66 + 77 + 99 = 298
Set these numbers aside for a moment.

Step 5: Insert your numbers into the following formula and solve:
t test formula a

(ΣA)2: Sum of data set A, squared (Step 2).
(ΣB)2: Sum of data set B, squared (Step 2).
μA: Mean of data set A (Step 3)
μB: Mean of data set B (Step 3)
ΣA2: Sum of the squares of data set A (Step 4)
ΣB2: Sum of the squares of data set B (Step 4)
nA: Number of items in data set A
nB: Number of items in data set B

Step 6: Find the Degrees of freedom (nA-1 + nB-1) = 18

Step 7: Look up your degrees of freedom (Step 6) in the t-table. If you don’t know what your alpha level is, use 5% (0.05).
18 degrees of freedom at an alpha level of 0.05 = 2.10.

Step 8: Compare your calculated value (Step 5) to your table value (Step 7). The calculated value of -1.79 is less than the cutoff of 2.10 from the table. Therefore p > .05. As the p-value is greater than the alpha level, we cannot conclude that there is a difference between means.

Back to top

If you prefer an online interactive environment to learn R and statistics, this free R Tutorial by Datacamp is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try this Statistics with R track.

Comments are now closed for this post. Need help or want to post a correction? Please post a comment on our Facebook page and I'll do my best to help!
Independent Samples T Test: Definition, Running was last modified: October 12th, 2017 by Andale

8 thoughts on “Independent Samples T Test: Definition, Running

  1. A.A.

    Can I use the same data for a t test as I can for the chi square test? I am unsure if I can use ordinal, interval, and nominal for both.

  2. Andale Post author

    T tests use interval and normal.
    Chi square uses categorical (nominal).
    You can’t run either test with ordinal.

  3. Daniel Dusza

    I think the denominator in eqn. step-5 should be (n1+n2-2)=18 This means the denominator should be Sqrt(0.783), not Sqrt(.705) as written above.
    This means the answer should be -1.69 not -1.79.
    Regardless, the outcome of the hypothesis is the same.
    Please let me know how I’m going?

  4. Marta

    I think what Daniel means is that in the formula, the denominator is (n1+n2-2) but then, in the example it’s only (n1+n2). The -2 is not there anymore.
    Shouldn’t we be working with a denominator (n1+n2-2) = (10+10-2) = 18
    instead of (n1+n2) = 20

    I literally have no idea if it was a mistake or if I’m missing something but as I was following the example I got stuck there.

    Thank you,


  5. Andale Post author

    Got it. Thanks for the clarification Marta. I’m not sure why I dropped the -2, but it’s back in now.