Two independent samples t-test

By Priya Chetty on February 8, 2015

The independent two-sample t-test is used to test whether population means are significantly different from each other. Independent samples are randomly drawn using the means.

When to use two independent samples t-test?

If you have 2 independent groups of subjects. For example CEOs and non-CEOs, men and women, or people who received treatment and people who didn’t, and you want to test whether they come from populations with the same mean for the variable of interest. In such cases, you have a 2-independent samples design.  Furthermore, in an independent-samples design, there is no relationship between people or objects in the 2 groups. The t-test you use is called an independent-samples t-test.


  • You want to test the null hypothesis that, in the U.S. population, the average hours spent watching TV per day is the same for males and females.
  • You want to compare 2 teaching methods.  One group of students is taught by one method, while the other group is taught by the other method.  At the end of the course, you want to test the null hypothesis that the population values for the average scores are equal.
  • You want to test the null hypothesis that people who report their incomes in a survey have the same average years of education as people who refuse.

SPSS with example

If you have 2 independent groups of subjects, e.g., boys and girls, and want to compare their scores, your data file must contain two variables for each child: one that identifies whether a case is a boy or a girl, and one with the score.  The same variable name is used for the scores for all cases.  To run the 2 independent samples T-test, you have to tell SPSS which variable defines the groups.  That’s the variable Gender, which is moved into the Grouping Variable box.  Notice the 2 question marks after a variable name.  They will disappear after you use the Define Groups dialogue box to tell SPSS which values of the variable should be used to form the 2 groups.

PLEASE NOTE: In the define groups dialogue box, you must enter the actual values that you entered into the data editor, not the value labels.  If you used the codes of 1 for male and 2 for female and assigned them value labels of m and f, then you enter the values 1 and 2, not the labels m and f, into the define groups dialogue box.

An analyst at a department store wants to evaluate the success of a recent credit card promotion campaign which consisted of 2 strategies: reduced prices promotion; and seasonal ads. Success was measured in terms of response received as compared to money spent on that strategy. To this end, 500 cardholders were randomly selected. Half received an ad promoting a reduced interest rate on purchases made over the next three months, and half received a standard seasonal ad.

  • Step 1: Select Analyze, then compare means, then independent samples T test
Choosing independent samples t test from SPSS
Figure 1: Sample T test
  • Step 2: Select “Money spent during the promotional period” as the test variable.  Select type of mail insert received (Reduced price promotion OR seasonal ad) as the grouping variable.  Then click “Define groups”.
T-test example, Figure 2
Figure 2: Sample T test

Type “0” as the group 1 variable and “1” as the group 2 variable under “Define groups”.  For the default, the program should have “use specified values” selected. Then click continue and ok.

T-test example, Figure 3
Figure 3: Sample T test

The Descriptives table displays the sample size, mean, standard deviation, and standard error for both groups. On average, the company collected $71 more with reduced interest rates group than the seasonal ad group (New Promotion mean minus Standard promotion mean in the table 1 below).

T-test result, Figure 3
Table 1

The procedure produces two tests of the difference between the two groups. The first test is “Levene’s Test”. This test checks the variation in opinions within the two sample groups (promotional reduced interest rate versus seasonal Ad). Secondly, it also shows results for the “t-test for equality of means” (See table 3). This test checks the mean difference between the response to the two ads.

The first test (Levene test) assumes that the variances of the two groups are equal. The Levene statistic tests this assumption.

Table 2
Table 2

The confidence interval, in this case, is set at 95%. In this example, the significance value of the statistic is 0.276. This value is greater than 0.10. Therefore, you can assume that the groups have equal variances and ignore the second test (t-test for equality of means). In addition, this means that 95% of people within the sample groups (seasonal ads and promotional reduced interest rates) have not started spending more after receiving the promotional offer.

Suppose if the result in the Levene test was “Significant” (sig value <0.05), then we would have proceeded to check the “sig” value of the “T-test for equality of means”. It is 0.024. Therefore it is significant. The result would mean that there is a significant difference in the spending pattern of people in different groups (seasonal ad and promotional reduced interest rate) after initiating the new promotional ad.

Table 3
Table 3

Legends (Table 3)

  • The df column displays degrees of freedom. For the independent samples t test, this equals the total number of cases in both samples minus 2.
  • The column labelled Sig. (2-tailed) displays a probability from the t distribution with 498 degrees of freedom. The value listed is the probability of obtaining an absolute value greater than or equal to the observed t statistic if the difference between the sample means is purely random.
  • The Mean Difference is obtained by subtracting the sample mean for group 2 (the New Promotion group) from the sample mean for group 1.
  • The 95% Confidence Interval of the Difference provides an estimate of the boundaries between which the true mean difference lies in 95% of all possible random samples of 500 cardholders.


The significance value of the test is less than 0.05. On the basis of this, you can safely conclude that the average of 71.11 dollars more spent by cardholders receiving the reduced interest rate is not due to chance alone. Therefore the store will now consider extending the offer to all credit customers.



1 thought on “Two independent samples t-test”