


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Centre for Multilevel Modelling The development of this E-Book has been supported by the British Academy.
In this practical we are going to investigate how to perform an independent samples t-test. This test is used when we have an interval or ratio level variable measured for two separate, or independent, groups of cases and we want to test if the mean of this dependent variable is different in the two groups. The test assumes that the dependent variable is normally distributed in both groups. To run a single test in SPSS requires that your dataset has one column containing the dependent variable to be tested and another column of the same length containing an indicator for which group the case belongs to.
The example provided here explores the question of whether there are gender differences in the PISA measure of achievement in science. The variable SCISCORE is the dependent variable (individuals' test scores) and the group indicator is provided by the GENDER variable (with categories Male and Female).
In this case the groups are identified by specific group codes although it is possible to also use a second continuous variable for groups and specify ranges of this variable that correspond to groups.
Here we are considering the variable, SCISCORE.
As a first step we should generally test for the normality of the variable SCISCORE in each of the two groups that are indicated by GENDER. We first test for normality in each group.
Select Descriptive Statistics from the Analyze menu. Select Explore from the Descriptive Statistics sub-menu. Click on the Reset button. Copy the Science test score[SCISCORE] variables into the Dependent List: box. Copy the Student gender[GENDER] variable into the Factor List: box. Click on the Plots... button. On the screen that appears select the Histogram tick box. Unselect the Stem and leaf button. Select the Normality plots with tests button. Click on the Continue button. Click on the OK button.
We will first look at a histogram of the SCISCORE variable, for the group defined by GENDER = Male. This can be found in amongst the set of output objects and looks as follows:
Ideally for a normal distribution this histogram should look symmetric around the mean of the distribution, in this case 527.5540. This distribution appears to be reasonably symmetric.
Next we will look at a histogram of the SCISCORE variable, for the group defined by GENDER = Female. This can be found in amongst the set of output objects and looks as follows:
Ideally for a normal distribution this histogram should look symmetric around the mean of the distribution, in this case 519.2443. This distribution appears to be negatively skewed.
We will next look at a statistical test to see if this backs up our visual impressions from the histogram.
The Kolmogorov-Smirnov test is used to test the null hypothesis that a set of data comes from a Normal distribution. The Kolmogorov Smirnov test produces test statistics that are used (along with a degrees of freedom parameter) to test for normality.
Tests of Normality
Student gender
Kolmogorov-Smirnov Shapiro-Wilk Statistic df Sig. Statistic df Sig. Science test score Female .029 2475 .000 .996 2475. Male .029 2719 .000 .995 2719. a. Lilliefors Significance Correction
For the group GENDER = Male : This has degrees of freedom which equals the number of data points, namely 2719.
The p-value provided by SPSS (quoted under Sig. for Kolmogorov-Smirnov) is .000 (reported as p < .001). We therefore have significant evidence to reject the null hypothesis that the variable follows a normal distribution.
For the group GENDER = Female : This has degrees of freedom which equals the number of data points, namely 2475.
The p-value provided by SPSS (quoted under Sig. for Kolmogorov-Smirnov) is .000 (reported as p < .001). We therefore have significant evidence to reject the null hypothesis that the variable follows a normal distribution.
Although these statistics tell the researcher whether the distribution followed by a variable is statistically significantly different from a normal distribution one should take care in not overinterpreting such findings. Significance will be strongly affected by the number of observations and so only a small discrepancy from normality will be deemed significant for very large sample sizes whilst very large discrepancies will be required to reject the null hypothesis for small sample sizes.
SPSS also supplies QQ plots to assist in looking at normality but for brevity we do not show them here.
a
If both groups can be assumed to follow normal distributions then a first descriptive step before performing the t test is to look at an error bar plot to see if the intervals of the two groups overlap.
To do this do the following in SPSS:
Select Error Bar from the Legacy Dialogs submenu of the Graphs menu. Select Simple and Summaries for groups of cases as for the boxplot and click on the Define button. Transfer the Science test score[SCISCORE] variable to the Variable box. Transfer the Student gender[GENDER] variable to the Category Axis box. Click on the OK button.
The output will look as follow:
According to the PISA test, boys in England were significantly better at science than girls at the age of 15.
Independent Samples Test Levene's Test for Equality of Variances t-test for Equality of Means
F Sig. t df
Sig. (2- tailed)
Mean Difference
Std. Error Difference
95% Confidence Interval of the Difference Lower Upper Science test score
Equal variances assumed
8.483 .004 2.918 5192 .004 8.30970 2.84773 2.72695 13.
Equal variances not assumed
2.924 5178.827 .003 8.30970 2.84190 2.73837 13.
The above table in fact captures two tests.
The first test is known as Levene's test and tests the assumption that the variability in the two groups is equal and if this is not the case then a slightly different t-test is performed. The two rows of numbers in the right of the table correspond to the two different versions of the test. We decide which one to report depending on the p-value (labelled Sig in SPSS) of Levene's test. The null hypothesis of Levene's test is that the variances (and SDs) in the two groups are equal in the population. When this is true, the Levene's test statistic follows a standard statistical distribution called an F distribution. Higher values of the F-statistic are associated with a lower likelihood that the sample did indeed come from a population in which the null hypothesis is true. In this case the F statistic has value 8.483 and SPSS calculates the corresponding p value for this statistic which is .004. This p value being less than 0.05 gives us enough evidence to reject the null hypothesis and to assume that the two groups have different variances. This leads us to using the bottom row of numbers to the right in the table.
So if we now look at the bottom row of numbers we will start with the column headed Mean Difference. Here we see the value 8.30970. If you look back at the summary statistics table this value is calculated by subtracting one mean from the other. Here it is positive because earlier we defined Group 1 as corresponding to the group with GENDER =Male (with a higher mean) and Group 2 as corresponding to the group with GENDER =Female (with a lower mean). The SPSS t-test calculates the mean differences as [Mean of Group 1] - [Mean of Group 2]. If we reversed the definition of the groups in the initial dialog box, in this case the mean difference would have been negative -8.3097. Next to the mean difference is the standard error of the difference. This here has the value 2.84190 and is calculated via a formula from the standard errors of the means of each group and their respective sample sizes. You will notice that this value is slightly different from the value in the row above for results with Equal variances assumed, which results from the adjustment made for unequal variances. Working back to the start of the row, the column entitled t is the statistic used in the t test and t like F is a standard statistical distribution. The t statistic is calculated simply by dividing the mean difference by its standard error so 8.30970 / 2.84190 = 2.924. Next to t is a column labelled df which stands for degrees of freedom and is a parameter used to choose the correct t distribution for the sampling distribution of the statistic. When we can assume equal variances then the degrees of freedom equal two less than the number of observations (N - 2, here 5192) as we have used 2 degrees of freedom in estimating 2 means. If we cannot assume equal variances then the value is lower as seen here (5178.827).
The column labelled "Sig (2-tailed)" contains a test of the null hypothesis that the means of the SCISCORE variable in the two groups are the same. By default, the two-tailed test reported uses a non-directional alternative hypothesis. It gives the probability that the data in the sample came from a population in which the group means are truly equal, when either a positive or a negative difference between sample group means is evidence against that null hypothesis. To conduct a one-tailed test, in which the alternative hypothesis specifies a particular direction to the difference, we would simply halve the p-value provided by SPSS.
We can reject the null if there is sufficient evidence that the mean of Group 1 is either higher or lower than the mean of Group 2. SPSS looks up the t statistic in the appropriate table gives the associated p value associated with the calculated t-statistic and degrees of freedom. In this case SPSS reports it as p = .003. Here we see that the p value is less than 0.05 and therefore we can reject the null hypothesis that the two groups have the same means. Finally we can see the 95% confidence interval for the difference which runs from 2.73837 to 13.88104. Another way to decide whether we can reject the null hypothesis is to check whether this interval contains the value 0. Here we see it does not, a finding that would lead us to reject the null hypothesis. In conclusion, we could report this to a reader as follows: Mean test scores were higher among GENDER = Male (N=2719, M=527.5540, SD=104.60755) than GENDER = Female (N=2475, M=519.2443, SD=100.14185). Levene's test rejected the null hypothesis of equal variances between the two groups (F=8.483, p < .001) so an adjusted version of the independent samples t-test that relaxes this assumption was chosen. The difference in means (difference = 8.30970) was statistically significant, t(5178.827) = 2.924, p=.003.