# Scale vs Scale paired

## 2a: Test (paired samples t-test)

From the example on the previous pages we got the impression that a commercial had an effect on the opinion of a brand, since overall the difference was positive between the before and after score.

A **paired samples t-test** (a.k.a. *correlated paires t-test*, *dependent samples t-test*, or *paired t-test*) can be used to check if the difference in the population will also be different from zero (i.e. the two means are not the same). Note that unlike a two samples t-test we do not need to check if the variances are equal, since the data is paired (McDonald, 2014, p. 182). For the interested reader, there is a nice discussion on this on researchgate.

In the example we find a t-value of 2.399 with a significance of 0.025. This means that there is a 0.025 (2.5%) chance of a t-value of less than -2.399 or a t-value of more than 2.399, if this t-value would be 0 in the population (i.e. no difference = equal means). With a usual 0.05 significance level we consider this chance to be so low, that most likely there is actually a difference in the population as well (and not only in the sample).

We could report the results as:

A paired samples t-test showed that there was a significant difference in scores on opinion about the brand before and after seeing the commercial, *t*(23) = 2.40, *p* = .025.

**Click here to see how you can perform a paired samples t-test, with SPSS, R (studio), Excel, Python, or Manually.**

**with Excel**

Three different methods. The first avoids having to determine the difference for each pair, but this makes some other calculations a bit trickier, the second simply does use the difference for each pair in the calculation, and the third method uses the data analysis add-in. I personally prefer method 2.

*method 1: avoiding differences per pair*

*method 2: with differences per pair*

*method 3: using add-in*

**with Python**

**Manually (formulas and example)**

**Formula**s

**Symbols used**:

*x _{i}* and

*y*are the i-th scores from all the pairs (note that if one of the two is missing the case is removed and not used).

_{i}*n* is the total number of pairs.

*μ _{h0}* is the difference that is expected in the population. Often this is set to zero, i.e. that there is no difference between the two variables in means.

**Example**

Note different example than in the others.

We are given the following pairs:

Since the second pair is missing a score, it will not be used and removed, so:

There are five pairs remaining, so *n* = 5.

Lets calculate the differences:

Then we determine the average (mean) of these differences:

Then the sample standard deviation of the differences:

The Standard Error can now be determined:

Assuming that we want to test that the difference would be 0 in the population, we can then determine the t-value:

The degrees of freedom is:

The last part would be to determine how big the difference can be classified as, which will be done on the next page.

Google adds