The independent samples -test is used to assess whether the means of two populations are equal to each other. This blog post shows how to perform the classical independent samples -test, i.e., the two-sample -test, in JASP. For this demonstration we consider the following example.
Example on the Effect of Extra Reading Activities on Drp Scores
Moore et al. (2009, p. 451) describe an educator who believes that an eight-week period with specific extra reading activities in the classroom (on top of the normal curriculum) improves third-graders’ degree of reading power (henceforth, drp) scores.1
To investigate this claim, the null hypothesis that extra reading activities do not affect drp scores was put to the test.
More specifically, the hypothesis is concerned with two (imaginary) populations: A control population in which every third grader in the United States only follows the normal curriculum, and a treatment population in which every third grader in the United States receives the specific eight-week extra reading activities on top of the normal curriculum. Jointly the pupils of the control population are assumed to have a mean drp score of , while the population mean drp score of the pupils in the treatment condition is denoted by . The null hypothesis of no effect is operationalized as , which implies that the population mean drp score is the same regardless of whether the population of third graders receive the treatment or not.
To test the null hypothesis, the educator collected samples from each population: One classroom of 23 pupils in the control condition, and 21 pupils in the treatment condition. For each of these groups of pupils, a sample mean drp score can be calculated that are denoted by for the control group and for the treatment group. Even if the null hypothesis is true, we cannot expect these sample means to be exactly equal to each, because we only collected small samples from two larger populations. The independent samples -test takes into account the uncertainty due to having only limited number of participants by supposing normally distributed error. Furthermore, to account for the imbalance due to differing sample sizes, it is assumed that the two populations share a common variance (see the section below for a more elaborate discussion regarding the assumptions and how they can be checked).
Note: to follow along with the explanation, you can either download the dataset and follow the steps on your own or download the annotated JASP file to see exactly what was done in JASP.
Performing the Independent Samples t-Test in JASP
To perform the two-sample -test in JASP, load the data file and go to the Common analysis tab, select T-Tests and then select the Independent Samples T-Test. The dependent variable is the (continuous) variable we want to test, in this case the drp scores. In the Grouping Variables field we put the variable “groups”. This grouping variable indicates whether a drp score was measured from the control or the treatment condition. The standard test is student’s -test. The other two tests (Welch and Mann-Whitney) are discussed in the section concerned with the assumptions below.
As the treatment is expected to yield higher drp scores, we test the null hypothesis of no effect with only one tail, which can be done by ticking “Group 1 < Group 2”. To figure out which group corresponds to which group number, click on Descriptives under Additional Statistics. In this case, the control condition is assigned to 1, while treatment is assigned the number 2. (You can edit the labels by clicking the header of the data set in data view, see this GIF for more details.)
Additionally, we have the option to include the Location parameter, the Effect size, Descriptives, a Descriptives plot and the (mysterious) Vovk-Sellke maximum p-ratio.
Let’s take a look at the output.
The descriptives table provides information about the number of pupils per group, and , the sample means, and , the observed standard deviations and , and the standard error. The standard error is the observed standard deviations divided by the square root of the sample size. For instance, the standard error of the control group is given by .
The test table provides the test statistics. Here you can find the -value, the degrees of freedom, the -value, the mean difference, standard error of the difference, and Cohen’s , which provides an estimate of the population effect size. The footnote verifies that we specified the one-tailed test correctly: we expect that the mean drp score of the control population to be less than that of the treatment population.
From the -test table we see that the -statistic is -2.267. The formula below shows that the -statistic can be interpreted as the difference between the observed means weighted by its precision (inverse of the pooled standard error):
where denotes the effective sample size, the pooled standard deviation, and the pooled variance defined as
The denominator of is also known as the degrees of freedom. In this example we have , which corresponds to the output in the test table. With the formulas and the information provided by the descriptives table, we can also (up to rounding error) compute the observed -statistic and Cohen’s by hand. In this case, the observed mean difference is (note the rounding error compared to the number reported in the test table). For the denominator of the -statistic, we note that the observed pooled variance is given by
and therefore . The effective sample size is , thus, and the denominator of the -statistic is, therefore, . Combining these results yields a rounded -value of
In this example, the experiment led to a one-tailed -value of . This means, that if (1) the implicit normality assumption holds, and (2) it were true that extra reading activities does not affect the mean drp scores of third-graders, then the chance of randomly drawing a sample with a -value of or lower is 1.4%.
Note that this statement is reasoned from the population to the sample — it presupposes that the null hypothesis holds and the population means are equal to each other. From this statement about the population, we derive implications to our observations, but also for more extreme –but not observed– data sets. For instance, data sets that lead to a -value of, say, or even .
Within psychology -values lower than 0.05 are often considered to be “statistically significant”, which is typically used to decide that there is an effect. Based on this convention, the null hypothesis of no effect is rejected, and it is decided that extra reading activities does lead to higher drp scores in the population of third-graders. Note that it is always a good idea to broaden one’s inferential perspective and consider information other than the -value alone by complementing the analysis with, for instance, confidence intervals, effect size estimates, or a Bayesian reanalysis, see a previous blog post for further details.
If extra reading activities do indeed lead to higher drp scores, one might wonder how strong the effect is. The effect in the population is denoted by
where is the unknown common standard deviation of both the control and treatment population. None of these quantities are observed, since we do not have full access to the whole populations. Instead, we replace the population quantities by their observed versions, resulting in a Cohen’s that is used as an estimate of the unknown , that is,
Reusing the calculations for the -value shows that , which aligns with what is reported in the test table. There is no strict rule for interpreting Cohen’s , but a rough guideline accompanied with some explanation can be found here. In our example, the effect size is indicative of medium to large effect.
Checking the Assumptions
The one-tailed student’s -value and the observed -statistic of depend on two assumptions: (1) the two data sets are normally distributed, and (2) the two populations share a common variance . To check these assumptions, click the boxes Normality and Equality of variances under Assumption Checks. Normality is tested with the Shapiro-Wilk’s test and equality of the variance is tested with Levene’s test.
For our example, both tests yield non-significant -values. The -values of the Shapiro-Wilk’s tests are computed under the assumption that the drp scores (in general the dependent variables) grouped according to their condition are normally distributed. As both -values are larger than 0.05, the hypothesis of normality cannot be rejected. Similarly, the -value of Levene’s test assumes that the two population variances are the same and since , the hypothesis of equal variance cannot be rejected. Note that the non-significant -values do not provide evidence that the populations are actually normally distributed with equal variance; they only indicate that the assumptions cannot be rejected.
If the Levene’s test yields statistical significance, while Shapiro-Wilk’s does not, or if it is known, in advance, that the data sets are normally distributed with unequal variances, one can then test the null hypothesis of equal means, that is, using the Welch test.
On the other hand, if the Shapiro-Wilk’s test yields statistical significance, or if it known, in advance, that the drp scores (in general the dependent variable) grouped according to their conditions are not normally distributed, one can then conduct a Mann-Whitney U test, instead. The null hypothesis of the Mann-Whitney U test states that the location parameter of the two populations are the same regardless of the underlying distribution. These tests can be selected in the input window and it can be prudent to execute these tests regardless, as a way to check the robustness of the results. In addition to these tests, it is always recommended to visualize the data, as can be done using the options available in the Descriptives menu on the JASP ribbon:
Like this post?Subscribe to our newsletter to receive regular updates about JASP including our latest blog posts, JASP articles, example analyses, new features, interviews with team members, and more! You can unsubscribe at any time.
1 Adapted from from Maribeth C. Schmitt, “The effects of an elaborated directed reading activity on the metacomprehension skills of third graders,” PhD thesis, Purdue University, 1987 according Moore et al. (2009, p. N-10).
Moore, D. S., McCabe, G. P. McCabe, & Craig, B. A. Introduction to the practice of statistics. Freeman, New York, 7. international ed., 2012