This post covers how to perform t tests in SPSS.
1. Preparation
The program version here is SPSS 23 and I used the 'Employee data.sav' file which is an inbuilt sample data set of SPSS.
In my case, the location of the file was [C:\Program Files (x86)\IBM\SPSS\Statistics\23\Samples\English].
It may vary, so look into 'Program Files' folder as well.
GET FILE='C:\Program Files (x86)\IBM\SPSS\Statistics\23\Samples\English\Employee data.sav'. DATASET NAME DataSet3 WINDOW=FRONT.
2. One-sample t test
We are going to compare the mean value of current salary of the sample and the population, supposing the parameter is $40,000.
Click 'Analyze' - 'Compare Means' - 'One-sample T Test'.
As a new window pops up, move the variable 'Current salary [salary]' to the list of 'Test variable(s)'.
Set the 'Test Value' as 40,000 and click 'OK'.
You can see the result in the Output window.
The first box displays some descriptive statistics and the second box shows us the t test results.
Seeing that the Confidence Interval does not include zero, it can be said that the mean difference of the sample and the population is statistically significant (at .05).
More specifically, as the t value is negative, the mean of the sample is significantly smaller than that of the population.
You can also use the syntax below for the test.
DATASET ACTIVATE DataSet1. T-TEST /TESTVAL=40000 /MISSING=ANALYSIS /VARIABLES=salary /CRITERIA=CI(.95).
3. Two-independent samples t test
Now, we want to know if there is a significant difference between the minority group and non-minority group in terms of the current salary.
Technically we should start by checking the normality, but if there are more than 30 cases, we can assume the normality based on the central limit theorem.
If there is less than 10 cases, non-parametric tests such as Mann-Whitney test are needed.
In case where there are 10 to 30 cases, the normality should be tested with Shapiro-Wilk test or Kolmogorov-Sminorov test.
Here, we have more than 30 cases, so we do not test the normality but go straight to the t test.
Click 'Analyze' - 'Compare Means' - 'Independent-Samples T Test'.
As a new window pops up, move the variable 'Current salary [salary]' to the list of 'Test variable(s)'.
Next, move the variable 'minority classification [minority]' to the 'Grouping Variable' and click 'Define Groups'.
A new window will apper, and type '0' for 'Group 1' and '1' for 'Group 2'.
0 means non-minotiy group and 1 means minority group in this data set.
Click 'Continue' and 'OK'
You can see the result in the Output window.
The first box displays some descriptive statistics and the second box shows us the t test results.
For the second box, the first thing we need to check is the Levene's test result.
As the p-value ('Sig.') is .000, it is better to assume that the variances of the two group are not the same.
In this case, we read the second row of the test result.
The confidence Interval does not include zero, so it can be said that the mean difference of the two groups is statistically significant (at .05).
More specifically, as the t value is positive, the mean of the non-minority group is significantly larger than that of the minority group.
You can also use the syntax below for the test.
T-TEST GROUPS=minority(0 1) /MISSING=ANALYSIS /VARIABLES=salary /CRITERIA=CI(.95).
4. Paired-samples t test
This time, we are going to test if there is a significant difference between the beginning salary and the current salary.
Click 'Analyze' - 'Compare Means' - 'Paired-Samples T Test'.
As a new window pops up, move the variable 'Beggining salary [salbegin]' to 'Variable 1' and 'Current salary [salary]' to 'Variable 2', and click 'OK'.
You can see the result in the Output window.
The first box displays some descriptive statistics.
The second box gives us information about the correlation and in this case it is highly correlated given the coefficient and the p-value.
More importantly, the last box shows the t test result.
Since the confidence Interval does not include zero, it can be said that the mean difference of the two variables is statistically significant (at .05).
More specifically, as the t value is negative, the mean of the beginning salary is significantly smaller than that of the current salary.
You can also use the syntax below for the test.
T-TEST PAIRS=salbegin WITH salary (PAIRED) /CRITERIA=CI(.9500) /MISSING=ANALYSIS.












![[R] Data Import](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5c_zi7m6ac3-R1bYIJyT3W6OQT7hc_EM4VLG7AGHx4KTh34WM1TNnGdU5Ft1mTclDmN1_U91hHixDjM1FFnGa8bZYnpykFWAMGv_EBKXyrWWjrPcxOc25YzY50igIPuznUsEyWRlvjKJpbO6EOCAn3GPlHE3wg2QSOLiqbkLfUazVALtPSH93WE3CTw/w72-h72-p-k-no-nu/mika-baumeister-Wpnoqo2plFA-unsplash.jpg) 
0 Comments