# Calculating Paired Sample t-test

In this section, we will learn about calculating the Paired Sample T-test. To calculate it, we will take the Employee data set. In this data set, we have the id of employees, their gender, education, job category, current salary, and beginning salary. Suppose the employees or managements want to know whether there has been any significant improvement in the employee's salary since they joined this company. There have been significant improvements in their current salary compared to their baseline salary or the salary they took at the time of joining. So, in this case, we have repeated measure kind of situation where we have an id, and we have two observations for that id. One is for the current salary, and another is for the beginning salary. So for all ids, we have two observations. To conduct a Paired sample t-test, we will go to the Analyze menu and Compare Means and look at the Paired Sample T-test. The symbol of Paired sample T-test reads as t A1-A2. It means the groups A1 and A2 are part of the same group. They are the same individuals just they have been measured in two different situations. If we look at the symbol of the Independent sample t-test, we find t A-B. It means they are different individuals, as people from Delhi and Mumbai. Now we will select the Paired sample t-test option, and the following dialog box will open: Now we have to define our pairs. So our first pairs are the Current salary of the employees and the Beginning salary of the employees. We will shift the Current salary in Variable 1 and Beginning salary in Variable 2 like this: We are finding the differences between the Current salary and the Beginning salary. So that's our Pair 1. If we have more pairs, we can make multiple pair comparison by defining our pairs in Pair 2. In Pair 2, we are defining joining month in variable 1 and previous experience in variable 2 only for the learning purpose. These are not meaningful Pairs. Once we select pair 2, we can see that pair 3 is automatically activated. Pair 2 is not meaningful, so we are going to remove it. So we are taking just one pair to compare. Rests of the Options are the same as the Independent sample t-test. If we want to know more about them, we can look at the Independent sample t-test file. In the above image, an arrow can be used to change the position of our variables. For example, the current salary is our first variable, and beginning salary is our second variable. But if we want to change their position, we can select the pair and click on this arrow tab like this: When we click on the arrow tab, we can see the beginning salary as our first variable, and the current salary has become our second variable like this: The only difference is going to make in the sign of our data. It's going to give us either a positive value or negative value depending upon the situation. For example, we know that current employees must be drawing more salary than their beginning salary. So if we take the beginning salary as our first variable, we will get a negative test. Remember, the formula of t is the difference between Group Means divided by Standard Error. So the difference between Group Means is going to a negative value because the beginning salary was lesser than the current salary. We want to avoid the negativity value, so in that case, we can take our current salary as the first variable. It is not going to have any implication for our result or actual conclusion that we draw. It is only going to change the sign of our t-test value. Now we will click on the Ok button:    