# Analysing a binary vs. scale variable

## Test: independent samples t-test

From the descriptive statistics in the impression and visualisation section, we noticed a difference in means between male and female students. However, this was just a sample, and would this mean that there is also a difference in the population. To find out, we’d need to perform a statistical test.

The most commonly used test is probably the Student t-test (Student, 1908). However, this test does not perform well if the variances in each group are different. The Welch test (Welch, 1938, 1947) is designed to use if the variances are not equal, and does not differ much from the Student t-test if the variances are the same. Ruxton (2006) compared the Welch t-test and the Student’s t-test and concluded that: “the unequal variance t-test should always be used in preference to the Student's t-test” (p. 690).

In the example the independent samples Welch t-test results in a significance of .499. This means that if there would not be any difference in means in the population, the chance of a difference as we had in the sample, or an even bigger difference, is .499. Usually this is considered a ‘high’ chance (usually anything above .05 is considered ‘high’). Since the chance of a result as in our sample (or even larger) is high, the assumption that the means in the population are equal could be true. We therefor can conclude that there is no significant difference (or slightly better: not enough evidence to claim a difference).

We could report the results as shown below:

A independent-samples Welch t-test indicated that there is insufficient evidence to claim a significant difference in the mean grades given to the course by the Male students (*M* = 60, *SD* = 19) and the Female students (*M* = 54, *SD* = 26), *t*(14.16) = .694, *p* = .499.

**Click here to see how to perform an independent samples Welch t-test with SPSS, R studio, Excel, Python, or Manually**

**With SPSS**

**With R studio**

**With Excel**

The add-on Data Analysis can be used with Excel to perform this test, but it can also be done without.

*without Data Analysis*

*with Data Analysis*

**With Python**

**Manually**

The video below explains how to perform an independent samples Welch t-test manually. Below the video the formula's are also written out, and an example, in case you prefer to read.

**The formula's**

The formula for the t-value with a Welch t-test is given by:

In this formula is the mean (average) of categori i. In formula notation:

*n _{i}* the number of cases in category i, and

*x*the

_{i,j}*j*-th score of category

*i*.

SE is the standard error. The standard error has the following formula:

Where is the sample variance of category i. In formula notation:

The degrees of freedom is given by:

**An example.**

*Note*: a different example than the one used in the rest of this section, to keep calculations a bit shorter.

Given are the scores of males (category 1) and females (category 2):

By simply counting the number of cases, we can determine that there were 5 male scores, and 6 female scores. So we have:

Now, let's fill out the formula for the mean, for the males and females:

With the means for each category, we can now determine the variance for each category:

And for the females

Now we have all the information to fill out the other formulas. First the Standard Error:

The t-value is therefor:

And we can also determine the degrees of freedom:

With the t-value and the degrees of freedom, the significance can be determined by using a t-distribution table.

When there is a significant difference, we might also want to check the ‘size’ of the difference. For example if we would have had a difference of 0.0003 in grades, then with extreme large sample sizes this could still be significant, but not really relevant. To measure the size of the difference we would need a so-called effect size, which is the topic for the next section.

Google adds