T-Distribution > Independent Samples T Test

**Contents:**

- What is an Independent Samples T Test?
- Assumptions for the Independent Samples T Test
- How to Run an Independent Samples T Test (Excel/SPSS)
- How to Calculate an Independent Samples T Test by Hand

## 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:

- You do not know the population mean or standard deviation.
- You have two independent, separate samples.

## Assumptions for the Independent Samples T Test

**Assumption of Independence:**you need two independent, categorical groups that represent your independent variable. In the above example of test scores “males” or “females” would be your independent variable.**Assumption of normality**: the dependent variable should be approximately normally distributed. The dependent variable should also be measured on a continuous scale. In the above example on average test scores, the “test score” would be the dependent variable.**Assumption of Homogeneity of Variance:**The variances of the dependent variable should be equal.

## 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:

- Write a hypothesis statement. For the above research question, the null hypothesis would be that there is no significant difference
- Determine if your test is one-tailed or two-tailed
- 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.”**

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.

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.

## 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:

35^{2} = 1225

49^{2} = 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: 1^{1} + 2^{2} + 2^{2} + 3^{3} + 3^{3} + 4^{4} + 4^{4} + 5^{5} + 5^{5} + 6^{6} = 145

B: 1^{2} + 2^{2} + 4^{4} + 5^{5} + 5^{5} + 5^{5} + 6^{6} + 6^{6} + 7^{7} + 9^{9} = 298

Set these numbers aside for a moment.

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

(Σ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)

ΣA^{2}: Sum of the squares of data set A (Step 4)

ΣB^{2}: Sum of the squares of data set B (Step 4)

n^{A}: Number of items in data set A

n^{B}: Number of items in data set B

Step 6: Find the Degrees of freedom (n_{A}-1 + n_{B}-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.

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*.

*Facebook page*and I'll do my best to help!

I like it, very useful.

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.

T tests use interval and normal.

Chi square uses categorical (nominal).

You can’t run either test with ordinal.

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?

D.

Hi, Daniel,

Thanks for your correction — it’s now fixed.

Regards,

Stephanie

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,

Marta.

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

Very good