Library homepage

  • school Campus Bookshelves
  • menu_book Bookshelves
  • perm_media Learning Objects
  • login Login
  • how_to_reg Request Instructor Account
  • hub Instructor Commons

Margin Size

  • Download Page (PDF)
  • Download Full Book (PDF)
  • Periodic Table
  • Physics Constants
  • Scientific Calculator
  • Reference & Cite
  • Tools expand_more
  • Readability

selected template will load here

This action is not available.

Statistics LibreTexts

11.3: The Independent Samples t-test (Student Test)

  • Last updated
  • Save as PDF
  • Page ID 36153

  • Danielle Navarro
  • University of New South Wales

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

\( \newcommand{\Span}{\mathrm{span}}\)

\( \newcommand{\id}{\mathrm{id}}\)

\( \newcommand{\kernel}{\mathrm{null}\,}\)

\( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\)

\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\)

\( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

\( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vectorC}[1]{\textbf{#1}} \)

\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

Although the one sample t-test has its uses, it’s not the most typical example of a t-test 189 . A much more common situation arises when you’ve got two different groups of observations. In psychology, this tends to correspond to two different groups of participants, where each group corresponds to a different condition in your study. For each person in the study, you measure some outcome variable of interest, and the research question that you’re asking is whether or not the two groups have the same population mean. This is the situation that the independent samples t-test is designed for.

Suppose we have 33 students taking Dr Harpo’s statistics lectures, and Dr Harpo doesn’t grade to a curve. Actually, Dr Harpo’s grading is a bit of a mystery, so we don’t really know anything about what the average grade is for the class as a whole. There are two tutors for the class, Anastasia and Bernadette. There are N 1 =15 students in Anastasia’s tutorials, and N 2 =18 in Bernadette’s tutorials. The research question I’m interested in is whether Anastasia or Bernadette is a better tutor, or if it doesn’t make much of a difference. Dr Harpo emails me the course grades, in the harpo.Rdata file. As usual, I’ll load the file and have a look at what variables it contains:

As we can see, there’s a single data frame with two variables, grade and tutor . The grade variable is a numeric vector, containing the grades for all N=33 students taking Dr Harpo’s class; the tutor variable is a factor that indicates who each student’s tutor was. The first six observations in this data set are shown below:

We can calculate means and standard deviations, using the mean() and sd() functions. Rather than show the R output, here’s a nice little summary table:

To give you a more detailed sense of what’s going on here, I’ve plotted histograms showing the distribution of grades for both tutors (Figure 13.6 and 13.7). Inspection of these histograms suggests that the students in Anastasia’s class may be getting slightly better grades on average, though they also seem a little more variable.

harpohistanastasia-1.png

Here is a simpler plot showing the means and corresponding confidence intervals for both groups of students (Figure 13.8).

ttestci.png

Introducing the test

The independent samples t-test comes in two different forms, Student’s and Welch’s. The original Student t-test – which is the one I’ll describe in this section – is the simpler of the two, but relies on much more restrictive assumptions than the Welch t-test. Assuming for the moment that you want to run a two-sided test, the goal is to determine whether two “independent samples” of data are drawn from populations with the same mean (the null hypothesis) or different means (the alternative hypothesis). When we say “independent” samples, what we really mean here is that there’s no special relationship between observations in the two samples. This probably doesn’t make a lot of sense right now, but it will be clearer when we come to talk about the paired samples t-test later on. For now, let’s just point out that if we have an experimental design where participants are randomly allocated to one of two groups, and we want to compare the two groups’ mean performance on some outcome measure, then an independent samples t-test (rather than a paired samples t-test) is what we’re after.

Okay, so let’s let μ 1 denote the true population mean for group 1 (e.g., Anastasia’s students), and μ 2 will be the true population mean for group 2 (e.g., Bernadette’s students), 190 and as usual we’ll let \(\bar{X}_{1}\) and \(\bar{X}_{2}\) denote the observed sample means for both of these groups. Our null hypothesis states that the two population means are identical (μ 1 =μ 2 ) and the alternative to this is that they are not (μ 1 ≠μ 2 ). Written in mathematical-ese, this is…

H 0 :μ 1 =μ 2

H 1 :μ 1 ≠μ 2

ttesthyp-1.png

To construct a hypothesis test that handles this scenario, we start by noting that if the null hypothesis is true, then the difference between the population means is exactly zero, μ 1 −μ 2 =0 As a consequence, a diagnostic test statistic will be based on the difference between the two sample means. Because if the null hypothesis is true, then we’d expect

\(\bar{X}_{1}\) - \(\bar{X}_{2}\)

to be pretty close to zero. However, just like we saw with our one-sample tests (i.e., the one-sample z-test and the one-sample t-test) we have to be precise about exactly how close to zero this difference

\(\ t ={\bar{X}_1 - \bar{X}_2 \over SE}\)

We just need to figure out what this standard error estimate actually is. This is a bit trickier than was the case for either of the two tests we’ve looked at so far, so we need to go through it a lot more carefully to understand how it works.

“pooled estimate” of the standard deviation

In the original “Student t-test”, we make the assumption that the two groups have the same population standard deviation: that is, regardless of whether the population means are the same, we assume that the population standard deviations are identical, σ 1 =σ 2 . Since we’re assuming that the two standard deviations are the same, we drop the subscripts and refer to both of them as σ. How should we estimate this? How should we construct a single estimate of a standard deviation when we have two samples? The answer is, basically, we average them. Well, sort of. Actually, what we do is take a weighed average of the variance estimates, which we use as our pooled estimate of the variance . The weight assigned to each sample is equal to the number of observations in that sample, minus 1. Mathematically, we can write this as

\(\ \omega_{1}\)=N 1 −1

\(\ \omega_{2}\)=N 2 −1

Now that we’ve assigned weights to each sample, we calculate the pooled estimate of the variance by taking the weighted average of the two variance estimates, \(\ \hat{\sigma_1}^2\) and \(\ \hat{\sigma_2}^2\)

\(\ \hat{\sigma_p}^2 ={ \omega_{1}\hat{\sigma_1}^2+\omega_{2}\hat{\sigma_2}^2 \over \omega_{1}+\omega_{2}}\)

Finally, we convert the pooled variance estimate to a pooled standard deviation estimate, by taking the square root. This gives us the following formula for \(\ \hat{\sigma_p}\),

\(\ \hat{\sigma_p} =\sqrt{\omega_1\hat{\sigma_1}^2+\omega_2\hat{\sigma_2}^2\over \omega_1+\omega_2} \)

And if you mentally substitute \(\ \omega_1\)=N1−1 and \(\ \omega_2\)=N2−1 into this equation you get a very ugly looking formula; a very ugly formula that actually seems to be the “standard” way of describing the pooled standard deviation estimate. It’s not my favourite way of thinking about pooled standard deviations, however. 191

same pooled estimate, described differently

I prefer to think about it like this. Our data set actually corresponds to a set of N observations, which are sorted into two groups. So let’s use the notation X ik to refer to the grade received by the i-th student in the k-th tutorial group: that is, X 11 is the grade received by the first student in Anastasia’s class, X 21 is her second student, and so on. And we have two separate group means \(\ \bar{X_1}\) and \(\ \bar{X_2}\), which we could “generically” refer to using the notation \(\ \bar{X_k}\), i.e., the mean grade for the k-th tutorial group. So far, so good. Now, since every single student falls into one of the two tutorials, and so we can describe their deviation from the group mean as the difference

\(\ X_{ik} - \bar{X_k}\)

So why not just use these deviations (i.e., the extent to which each student’s grade differs from the mean grade in their tutorial?) Remember, a variance is just the average of a bunch of squared deviations, so let’s do that. Mathematically, we could write it like this:

\(\ ∑_{ik} (X_{ik}-\bar{X}_k)^2 \over N \)

where the notation “∑ ik ” is a lazy way of saying “calculate a sum by looking at all students in all tutorials”, since each “ik” corresponds to one student. 192 But, as we saw in Chapter 10, calculating the variance by dividing by N produces a biased estimate of the population variance. And previously, we needed to divide by N−1 to fix this. However, as I mentioned at the time, the reason why this bias exists is because the variance estimate relies on the sample mean; and to the extent that the sample mean isn’t equal to the population mean, it can systematically bias our estimate of the variance. But this time we’re relying on two sample means! Does this mean that we’ve got more bias? Yes, yes it does. And does this mean we now need to divide by N−2 instead of N−1, in order to calculate our pooled variance estimate? Why, yes…

\(\hat{\sigma}_{p}\ ^{2}=\dfrac{\sum_{i k}\left(X_{i k}-X_{k}\right)^{2}}{N-2}\)

Oh, and if you take the square root of this then you get \(\ \hat{\sigma_{P}}\), the pooled standard deviation estimate. In other words, the pooled standard deviation calculation is nothing special: it’s not terribly different to the regular standard deviation calculation.

Completing the test

Regardless of which way you want to think about it, we now have our pooled estimate of the standard deviation. From now on, I’ll drop the silly p subscript, and just refer to this estimate as \(\ \hat{\sigma}\). Great. Let’s now go back to thinking about the bloody hypothesis test, shall we? Our whole reason for calculating this pooled estimate was that we knew it would be helpful when calculating our standard error estimate. But, standard error of what ? In the one-sample t-test, it was the standard error of the sample mean, SE (\(\ \bar{X}\)), and since SE (\(\ \bar{X}=\sigma/ \sqrt{N}\) that’s what the denominator of our t-statistic looked like. This time around, however, we have two sample means. And what we’re interested in, specifically, is the the difference between the two \(\ \bar{X_1}\) - \(\ \bar{X_2}\). As a consequence, the standard error that we need to divide by is in fact the standard error of the difference between means. As long as the two variables really do have the same standard deviation, then our estimate for the standard error is

\(\operatorname{SE}\left(\bar{X}_{1}-\bar{X}_{2}\right)=\hat{\sigma} \sqrt{\dfrac{1}{N_{1}}+\dfrac{1}{N_{2}}}\)

and our t-statistic is therefore

\(t=\dfrac{\bar{X}_{1}-\bar{X}_{2}}{\operatorname{SE}\left(\bar{X}_{1}-\bar{X}_{2}\right)}\)

(shocking, isn’t it?) as long as the null hypothesis is true, and all of the assumptions of the test are met. The degrees of freedom, however, is slightly different. As usual, we can think of the degrees of freedom to be equal to the number of data points minus the number of constraints. In this case, we have N observations (N1 in sample 1, and N2 in sample 2), and 2 constraints (the sample means). So the total degrees of freedom for this test are N−2.

Doing the test in R

Not surprisingly, you can run an independent samples t-test using the t.test() function (Section 13.7), but once again I’m going to start with a somewhat simpler function in the lsr package. That function is unimaginatively called independentSamplesTTest() . First, recall that our data look like this:

The outcome variable for our test is the student grade , and the groups are defined in terms of the tutor for each class. So you probably won’t be too surprised to see that we’re going to describe the test that we want in terms of an R formula that reads like this grade ~ tutor . The specific command that we need is:

The first two arguments should be familiar to you. The first one is the formula that tells R what variables to use and the second one tells R the name of the data frame that stores those variables. The third argument is not so obvious. By saying var.equal = TRUE , what we’re really doing is telling R to use the Student independent samples t-test. More on this later. For now, lets ignore that bit and look at the output:

The output has a very familiar form. First, it tells you what test was run, and it tells you the names of the variables that you used. The second part of the output reports the sample means and standard deviations for both groups (i.e., both tutorial groups). The third section of the output states the null hypothesis and the alternative hypothesis in a fairly explicit form. It then reports the test results: just like last time, the test results consist of a t-statistic, the degrees of freedom, and the p-value. The final section reports two things: it gives you a confidence interval, and an effect size. I’ll talk about effect sizes later. The confidence interval, however, I should talk about now.

It’s pretty important to be clear on what this confidence interval actually refers to: it is a confidence interval for the difference between the group means. In our example, Anastasia’s students had an average grade of 74.5, and Bernadette’s students had an average grade of 69.1, so the difference between the two sample means is 5.4. But of course the difference between population means might be bigger or smaller than this. The confidence interval reported by the independentSamplesTTest() function tells you that there’s a 95% chance that the true difference between means lies between 0.2 and 10.8.

In any case, the difference between the two groups is significant (just barely), so we might write up the result using text like this:

The mean grade in Anastasia’s class was 74.5% (std dev = 9.0), whereas the mean in Bernadette’s class was 69.1% (std dev = 5.8). A Student’s independent samples t-test showed that this 5.4% difference was significant (t(31)=2.1, p<.05, CI 95 =[0.2,10.8], d=.74), suggesting that a genuine difference in learning outcomes has occurred.

Notice that I’ve included the confidence interval and the effect size in the stat block. People don’t always do this. At a bare minimum, you’d expect to see the t-statistic, the degrees of freedom and the p value. So you should include something like this at a minimum: t(31)=2.1, p<.05. If statisticians had their way, everyone would also report the confidence interval and probably the effect size measure too, because they are useful things to know. But real life doesn’t always work the way statisticians want it to: you should make a judgment based on whether you think it will help your readers, and (if you’re writing a scientific paper) the editorial standard for the journal in question. Some journals expect you to report effect sizes, others don’t. Within some scientific communities it is standard practice to report confidence intervals, in other it is not. You’ll need to figure out what your audience expects. But, just for the sake of clarity, if you’re taking my class: my default position is that it’s usually worth includng the effect size, but don’t worry about the confidence interval unless the assignment asks you to or implies that you should.

Positive and negative t values

Before moving on to talk about the assumptions of the t-test, there’s one additional point I want to make about the use of t-tests in practice. The first one relates to the sign of the t-statistic (that is, whether it is a positive number or a negative one). One very common worry that students have when they start running their first t-test is that they often end up with negative values for the t-statistic, and don’t know how to interpret it. In fact, it’s not at all uncommon for two people working independently to end up with R outputs that are almost identical, except that one person has a negative t values and the other one has a positive t value. Assuming that you’re running a two-sided test, then the p-values will be identical. On closer inspection, the students will notice that the confidence intervals also have the opposite signs. This is perfectly okay: whenever this happens, what you’ll find is that the two versions of the R output arise from slightly different ways of running the t-test. What’s happening here is very simple. The t-statistic that R is calculating here is always of the form

\(t=\dfrac{(\text { mean } 1)-(\text { mean } 2)}{(\mathrm{SE})}\)

If “mean 1” is larger than “mean 2” the t statistic will be positive, whereas if “mean 2” is larger then the t statistic will be negative. Similarly, the confidence interval that R reports is the confidence interval for the difference “(mean 1) minus (mean 2)”, which will be the reverse of what you’d get if you were calculating the confidence interval for the difference “(mean 2) minus (mean 1)”.

Okay, that’s pretty straightforward when you think about it, but now consider our t-test comparing Anastasia’s class to Bernadette’s class. Which one should we call “mean 1” and which one should we call “mean 2”. It’s arbitrary. However, you really do need to designate one of them as “mean 1” and the other one as “mean 2”. Not surprisingly, the way that R handles this is also pretty arbitrary. In earlier versions of the book I used to try to explain it, but after a while I gave up, because it’s not really all that important, and to be honest I can never remember myself. Whenever I get a significant t-test result, and I want to figure out which mean is the larger one, I don’t try to figure it out by looking at the t-statistic. Why would I bother doing that? It’s foolish. It’s easier just look at the actual group means, since the R output actually shows them!

Here’s the important thing. Because it really doesn’t matter what R printed out, I usually try to report the t-statistic in such a way that the numbers match up with the text. Here’s what I mean… suppose that what I want to write in my report is “Anastasia’s class had higher grades than Bernadette’s class”. The phrasing here implies that Anastasia’s group comes first, so it makes sense to report the t-statistic as if Anastasia’s class corresponded to group 1. If so, I would write

Anastasia’s class had higher grades than Bernadette’s class (t(31)=2.1,p=.04).

(I wouldn’t actually emphasise the word “higher” in real life, I’m just doing it to emphasise the point that “higher” corresponds to positive t values). On the other hand, suppose the phrasing I wanted to use has Bernadette’s class listed first. If so, it makes more sense to treat her class as group 1, and if so, the write up looks like this:

Bernadette’s class had lower grades than Anastasia’s class (t(31)=−2.1,p=.04).

Because I’m talking about one group having “lower” scores this time around, it is more sensible to use the negative form of the t-statistic. It just makes it read more cleanly.

One last thing: please note that you can’t do this for other types of test statistics. It works for t-tests, but it wouldn’t be meaningful for chi-square testsm F-tests or indeed for most of the tests I talk about in this book. So don’t overgeneralise this advice! I’m really just talking about t-tests here and nothing else!

Assumptions of the test

As always, our hypothesis test relies on some assumptions. So what are they? For the Student t-test there are three assumptions, some of which we saw previously in the context of the one sample t-test (see Section 13.2.3):

  • Normality . Like the one-sample t-test, it is assumed that the data are normally distributed. Specifically, we assume that both groups are normally distributed. In Section 13.9 we’ll discuss how to test for normality, and in Section 13.10 we’ll discuss possible solutions.
  • Independence . Once again, it is assumed that the observations are independently sampled. In the context of the Student test this has two aspects to it. Firstly, we assume that the observations within each sample are independent of one another (exactly the same as for the one-sample test). However, we also assume that there are no cross-sample dependencies. If, for instance, it turns out that you included some participants in both experimental conditions of your study (e.g., by accidentally allowing the same person to sign up to different conditions), then there are some cross sample dependencies that you’d need to take into account.
  • Homogeneity of variance (also called “homoscedasticity”). The third assumption is that the population standard deviation is the same in both groups. You can test this assumption using the Levene test, which I’ll talk about later on in the book (Section 14.7). However, there’s a very simple remedy for this assumption, which I’ll talk about in the next section.

SPSS tutorials website header logo

Independent Samples T-Test – Quick Introduction

Independent samples t-test - what is it, null hypothesis, test statistic, assumptions, statistical significance, effect size.

Independent Samples T-Test What Is It

An independent samples t-test evaluates if 2 populations have equal means on some variable. If the population means are really equal, then the sample means will probably differ a little bit but not too much. Very different sample means are highly unlikely if the population means are equal. This sample outcome thus suggest that the population means weren't equal after all. The samples are independent because they don't overlap; none of the observations belongs to both samples simultaneously. A textbook example is male versus female respondents.

Some island has 1,000 male and 1,000 female inhabitants. An investigator wants to know if males spend more or fewer minutes on the phone each month. Ideally, he'd ask all 2,000 inhabitants but this takes too much time. So he samples 10 males and 10 females and asks them. Part of the data are shown below.

Independent Samples T-Test Sample Data View

Next, he computes the means and standard deviations of monthly phone minutes for male and female respondents separately. The results are shown below.

Independent Samples T-Test Sample Means Variances Table

These sample means differ by some (99 - 106 =) -7 minutes: on average, females spend some 7 minutes less on the phone than males. But that's just our tiny samples. What can we say about the entire populations? We'll find out by starting off with the null hypothesis.

The null hypothesis for an independent samples t-test is (usually) that the 2 population means are equal. If this is really true, then we may easily find slightly different means in our samples. So precisely what difference can we expect? An intuitive way for finding out is a simple simulation.

I created a fake dataset containing the entire populations of 1,000 males and 1,000 females. On average, both groups spend 103 minutes on the phone with a standard-deviation of 14.5. Note that the null hypothesis of equal means is clearly true for these populations. I then sampled 10 males and 10 females and computed the mean difference. And then I repeated that process 999 times, resulting in the 1,000 sample mean differences shown below.

Independent Samples T-Test Simulation Histogram

First off, the mean differences are roughly normally distributed . Most of the differences are close to zero -not surprising because the population difference is zero. But what's really interesting is that mean differences between, say, -12.5 and 12.5 are pretty common and make up 95% of my 1,000 outcomes. This suggests that an absolute difference of 12.5 minutes is needed for statistical significance at α = 0.05. Last, the standard deviation of our 1,000 mean differences -the standard error- is 6.4. Note that some 95% of all outcomes lie between -2 and +2 standard errors of our (zero) mean. This is one of the best known rules of thumb regarding the normal distribution. Now, an easier -though less visual- way to draw these conclusions is using a couple of simple formulas.

Again: what is a “normal” sample mean difference if the population difference is zero? First off, this depends on the population standard deviation of our outcome variable. We don't usually know it but we can estimate it with $$Sw = \sqrt{\frac{(n_1 - 1)\;S^2_1 + (n_2 - 1)\;S^2_2}{n_1 + n_2 - 2}}$$ in which \(Sw\) denotes our estimated population standard deviation. For our data, this boils down to $$Sw = \sqrt{\frac{(10 - 1)\;224 + (10 - 1)\;191}{10 + 10 - 2}} ≈ 14.4$$ Second, our mean difference should fluctuate less -that is, have a smaller standard error- insofar as our sample sizes are larger. The standard error is calculated as $$Se = Sw\sqrt{\frac{1}{n_1} + \frac{1}{n_2}}$$ and this gives us $$Se = 14.4\; \sqrt{\frac{1}{10} + \frac{1}{10}} ≈ 6.4$$ If the population mean difference is zero, then -on average- the sample mean difference will be zero as well. However, it will have a standard deviation of 6.4. We can now just compute a z-score for the sample mean difference but -for some reason- it's called T instead of Z: $$T = \frac{\overline{X}_1 - \overline{X}_2}{Se}$$ which, for our data, results in $$T = \frac{99.4 - 106.6}{6.4} ≈ -1.11$$ Right, now this is our test statistic: a number that summarizes our sample outcome with regard to the null hypothesis. T is basically the standardized sample mean difference; T = -1.11 means that our difference of -7 minutes is roughly 1 standard deviation below the average of zero.

Our t-value follows a t distribution but only if the following assumptions are met:

  • Independent observations or, precisely, independent and identically distributed variables.
  • Normality : the outcome variable follows a normal distribution in the population. This assumption is not needed for reasonable sample sizes (say, N > 25).
  • Homogeneity : the outcome variable has equal standard deviations in our 2 (sub)populations. This is not needed if the sample sizes are roughly equal. Levene's test is sometimes used for testing this assumption.

If our data meet these assumptions, then T follows a t-distribution with (n1 + n2 -2) degrees of freedom (df). In our example, df = (10 + 10 - 2) = 18. The figure below shows the exact distribution. Note that we need an absolute t-value of 2.1 for 2-tailed significance at α = 0.05.

T Distribution Df 18

Minor note: as df becomes larger, the t-distribution approximates a standard normal distribution . The difference is hardly noticeable if df > 15 or so.

Last but not least, our mean difference of -7 minutes is not statistically significant : t(18) = -1.11, p ≈ 0.28 . This means we've a 28% chance of finding our sample mean difference -or a more extreme one- if our population means are really equal; it's a normal outcome that doesn't contradict our null hypothesis. Our final figure shows these results as obtained from SPSS .

Independent Samples T-Test SPSS Output

Finally, the effect size measure that's usually preferred is Cohen’s D , defined as $$D = \frac{\overline{X}_1 - \overline{X}_2}{Sw}$$ in which \(Sw\) is the estimated population standard deviation we encountered earlier. That is, Cohen’s D is the number of standard deviations between the 2 sample means. So what is a small or large effect? The following rules of thumb have been proposed:

  • D = 0.20 indicates a small effect;
  • D = 0.50 indicates a medium effect;
  • D = 0.80 indicates a large effect.

Cohen’s D is painfully absent from SPSS except for SPSS 27 . However, you can easily obtain it from Cohens-d.xlsx . Just fill in 2 sample sizes, means and standard deviations and its formulas will compute everything you need to know.

Independent Samples T-Test in Excel Screenshot

Thanks for reading!

Tell us what you think!

This tutorial has 29 comments:.

how to write null hypothesis for independent t test

By Mishal on September 7th, 2020

How we Develop the hypothesis of given information prove and disprove by statistical analysis with the help of SPSS

how to write null hypothesis for independent t test

By William Peck on July 28th, 2021

my earlier question on using ANOVA for just 2 groups seems to point me to the t-test, right? Like I did the same survey 5 years apart to the student body, but the student body completely turned over.

But can you really do analysis if the scale is simply 1-5? There's not much room for variance, like in your examples of IQ (on the ANOVA page) and the phone minutes (this page).

how to write null hypothesis for independent t test

By Ruben Geert van den Berg on July 29th, 2021

Hi William!

Yes, ANOVA on 2 groups yields the exact same p-values as (the more usual) t-test.

A reason for preferring t-tests, though, is that they yield confidence intervals for the population mean differences you're after.

Strictly, computing means is not allowed for Likert scale and all other ordinal variables but most analysts (including us) and standard textbooks do so anyway.

The scales (1-5 or 1-10 or 0-1000) don't really matter: you could multiply 1-5 by 100 and dramatically increase your variances . But this won't affect your p-values (try it if you don't believe me). What matters is the ratio of variance between/within groups.

Hope that helps!

SPSS tutorials

By William Peck on July 29th, 2021

Great! Thank you ...

Privacy Overview

Logo for University of Southern Queensland

Want to create or adapt books like this? Learn more about how Pressbooks supports open publishing practices.

Section 3.3: Independent T-test Assumptions, Interpretation, and Write Up

Learning Objectives

At the end of this chapter you should be able to answer the following questions:

  • Is the Independent T-test a Between Groups or Within Groups test?
  • How many assumptions underpin the Independent Samples T-test?
  • What is the first test to examine within the Independent Groups T-test output?
  • What is the second test to examine within the Independent Groups T-test output?
  • What elements or individual statistics should be reported when writing up an Independent T-test?

An Independent T-test or Independent Samples T-test is an important test for Between Groups differences.

Here we will discuss the underlying assumptions of the Independent t-test and explain how to interpret the results of the t-test. There are a number of assumptions that need to be met before performing an Independent t-test:

  • The dependent variable (the variable of interest) needs a continuous scale (i.e., the data needs to be at either an interval or ratio measurement). An example of a continuous dependent variable might be the weight of an athlete. Their weight could be anywhere between 50 and 70 kilograms.
  • The independent variable needs to have two independent groups with two levels. An example of this independent variable could be regional vs metropolitan Australians.
  • The data should have independence of observations. More specifically,  there shouldn’t be the same participants in both groups.
  • The dependent variable should be normally or near-to-normally distributed for each group. It is worth noting that the t-test is robust for minor violations in normality, however, if your data is very non-normal, it might be worth using a non-parametric test or bootstrapping (see later chapters for more information).
  • There should be no spurious outliers.
  • The data must have homogeneity of variances. This assumption can be tested using Levene’s test for homogeneity of variances in the statistics package which is shown in the output included in the next chapter.

Independent T-test Interpretation

The order of interpreting test statistics can be important and there are multiple test statistics to interpret within the Independent Groups T-test output.

Keep in mind that we are examining two groups of individuals – In this example, we are looking at metropolitan versus regional Australians.   The dependent or outcome variable is mental distress.

And here we have the output from the T-test.

PowerPoint: Independent T-test Output

You will need to click on the below link to access the output:

  • Chapter Three Independent T-test Output

Table of statistics on mental distress

Green: Levene’s test

Red: Test statistics

Blue: Means and standard deviations

Green: The first thing you should examine is Levene’s test. If this test is nonsignificant, that means you have homogeneity of variance between the two groups on the dependent or outcome variable. If Levene’s test is significant, this means that the two groups did not show homogeneity of variance on the dependent or outcome variable.  In our example, Levene’s test is nonsignificant so we can move on to the statistics for the tests under the condition of equal variances assumed.

You should notice that there are two lines or rows of statistics given in the output.  The first row, which we are using, provides statistics for the tests under the condition of equal variances assumed.  The second row, which we are not using, provides statistics for the tests under the condition of equal variances not assumed.

Red: The next thing you should look at is the t value, the degrees of freedom, and the p value statistics in the first or top row of the output. The p-value of .024 shows that there is a significant difference in levels of mental distress reported by metropolitan and regional Australians. If we look at the mean scores, we can tell that regional Australians reported higher levels of mental distress (38.867) than the Australians who live in major cities (35.904).

You will also notice that there is a 95% CI presented, which is a 95% Confidence Interval of the difference.  This CI has a lower limit at -5.525 and an upper limit at -.401.  Because the CI does not include 0 we can infer that the difference between the two groups does exist in the population.

Blue: Next, make sure you have a look at the mean, standard deviation, and sample size (N) for both groups.  You can get the effect size (Cohen’s D) by using an effect size calculator.

You may find an effect size calculator here: https://www.socscistatistics.com/effectsize/default3.aspx

If you enter the mean, standard deviation, and sample size for both groups, you should get a Cohen’s D of .239.

Independent T-test Write-Up

You will need to report the Means and SD for each group, along with the t test statistic ( t ), its p value, and its effect size d .

It is common in many formats to round your decimal places to two.  Therefore, a Write-Up for an Independent T-test should  look like this:

An independent samples t-test showed that the metropolitan sample (M = 35.90, SD = 12.10) reported lower levels of mental distress ( t =-2.27,  p =.024,  d =.24) than the regional sample (M = 38.87, SD = 12.69).

Statistics for Research Students Copyright © 2022 by University of Southern Queensland is licensed under a Creative Commons Attribution 4.0 International License , except where otherwise noted.

Share This Book

Independent t-test using SPSS Statistics

Introduction.

The independent-samples t-test (or independent t-test, for short) compares the means between two unrelated groups on the same continuous, dependent variable. For example, you could use an independent t-test to understand whether first year graduate salaries differed based on gender (i.e., your dependent variable would be "first year graduate salaries" and your independent variable would be "gender", which has two groups: "male" and "female"). Alternately, you could use an independent t-test to understand whether there is a difference in test anxiety based on educational level (i.e., your dependent variable would be "test anxiety" and your independent variable would be "educational level", which has two groups: "undergraduates" and "postgraduates").

This "quick start" guide shows you how to carry out an independent t-test using SPSS Statistics, as well as interpret and report the results from this test. However, before we introduce you to this procedure, you need to understand the different assumptions that your data must meet in order for an independent t-test to give you a valid result. We discuss these assumptions next.

SPSS Statistics

Assumptions.

When you choose to analyse your data using an independent t-test, part of the process involves checking to make sure that the data you want to analyse can actually be analysed using an independent t-test. You need to do this because it is only appropriate to use an independent t-test if your data "passes" six assumptions that are required for an independent t-test to give you a valid result. In practice, checking for these six assumptions just adds a little bit more time to your analysis, requiring you to click a few more buttons in SPSS Statistics when performing your analysis, as well as think a little bit more about your data, but it is not a difficult task.

Before we introduce you to these six assumptions, do not be surprised if, when analysing your own data using SPSS Statistics, one or more of these assumptions is violated (i.e., is not met). This is not uncommon when working with real-world data rather than textbook examples, which often only show you how to carry out an independent t-test when everything goes well! However, don't worry. Even when your data fails certain assumptions, there is often a solution to overcome this. First, let's take a look at these six assumptions:

  • Assumption #1: Your dependent variable should be measured on a continuous scale (i.e., it is measured at the interval or ratio level). Examples of variables that meet this criterion include revision time (measured in hours), intelligence (measured using IQ score), exam performance (measured from 0 to 100), weight (measured in kg), and so forth. You can learn more about continuous variables in our article: Types of Variable .
  • Assumption #2: Your independent variable should consist of two categorical , independent groups . Example independent variables that meet this criterion include gender (2 groups: male or female), employment status (2 groups: employed or unemployed), smoker (2 groups: yes or no), and so forth.
  • Assumption #3: You should have independence of observations , which means that there is no relationship between the observations in each group or between the groups themselves. For example, there must be different participants in each group with no participant being in more than one group. This is more of a study design issue than something you can test for, but it is an important assumption of the independent t-test. If your study fails this assumption, you will need to use another statistical test instead of the independent t-test (e.g., a paired-samples t-test). If you are unsure whether your study meets this assumption, you can use our Statistical Test Selector , which is part of our enhanced content.
  • Assumption #4: There should be no significant outliers . Outliers are simply single data points within your data that do not follow the usual pattern (e.g., in a study of 100 students' IQ scores, where the mean score was 108 with only a small variation between students, one student had a score of 156, which is very unusual, and may even put her in the top 1% of IQ scores globally). The problem with outliers is that they can have a negative effect on the independent t-test, reducing the validity of your results. Fortunately, when using SPSS Statistics to run an independent t-test on your data, you can easily detect possible outliers. In our enhanced independent t-test guide, we: (a) show you how to detect outliers using SPSS Statistics; and (b) discuss some of the options you have in order to deal with outliers. You can learn more about our enhanced independent t-test guide here .
  • Assumption #5: Your dependent variable should be approximately normally distributed for each group of the independent variable . We talk about the independent t-test only requiring approximately normal data because it is quite "robust" to violations of normality, meaning that this assumption can be a little violated and still provide valid results. You can test for normality using the Shapiro-Wilk test of normality, which is easily tested for using SPSS Statistics. In addition to showing you how to do this in our enhanced independent t-test guide, we also explain what you can do if your data fails this assumption (i.e., if it fails it more than a little bit). Again, you can learn more here .
  • Assumption #6: There needs to be homogeneity of variances . You can test this assumption in SPSS Statistics using Levene’s test for homogeneity of variances. In our enhanced independent t-test guide, we (a) show you how to perform Levene’s test for homogeneity of variances in SPSS Statistics, (b) explain some of the things you will need to consider when interpreting your data, and (c) present possible ways to continue with your analysis if your data fails to meet this assumption (learn more here ).

You can check assumptions #4, #5 and #6 using SPSS Statistics. Before doing this, you should make sure that your data meets assumptions #1, #2 and #3, although you don't need SPSS Statistics to do this. When moving on to assumptions #4, #5 and #6, we suggest testing them in this order because it represents an order where, if a violation to the assumption is not correctable, you will no longer be able to use an independent t-test (although you may be able to run another statistical test on your data instead). Just remember that if you do not run the statistical tests on these assumptions correctly, the results you get when running an independent t-test might not be valid. This is why we dedicate a number of sections of our enhanced independent t-test guide to help you get this right. You can find out about our enhanced independent t-test guide here , or more generally, our enhanced content as a whole here .

In the section, Test Procedure in SPSS Statistics , we illustrate the SPSS Statistics procedure required to perform an independent t-test assuming that no assumptions have been violated. First, we set out the example we use to explain the independent t-test procedure in SPSS Statistics.

The concentration of cholesterol (a type of fat) in the blood is associated with the risk of developing heart disease, such that higher concentrations of cholesterol indicate a higher level of risk, and lower concentrations indicate a lower level of risk. If you lower the concentration of cholesterol in the blood, your risk of developing heart disease can be reduced. Being overweight and/or physically inactive increases the concentration of cholesterol in your blood. Both exercise and weight loss can reduce cholesterol concentration. However, it is not known whether exercise or weight loss is best for lowering cholesterol concentration. Therefore, a researcher decided to investigate whether an exercise or weight loss intervention is more effective in lowering cholesterol levels. To this end, the researcher recruited a random sample of inactive males that were classified as overweight. This sample was then randomly split into two groups: Group 1 underwent a calorie-controlled diet and Group 2 undertook the exercise-training programme. In order to determine which treatment programme was more effective, the mean cholesterol concentrations were compared between the two groups at the end of the treatment programmes.

Setup in SPSS Statistics

In SPSS Statistics, we separated the groups for analysis by creating a grouping variable called Treatment (i.e., the independent variable), and gave the "diet group" a value of "1" and the "exercise group" a value of "2" (i.e., the two groups of the independent variable). Cholesterol concentrations were entered under the variable name Cholesterol (i.e., the dependent variable). In our enhanced independent t-test guide, we show you how to correctly enter data in SPSS Statistics to run an independent t-test (see here ). You can learn about our enhanced data setup content in general here . Alternately, we have a generic, "quick start" guide to show you how to enter data into SPSS Statistics, available here .

Test Procedure in SPSS Statistics

The eight steps below show you how to analyse your data using an independent t-test in SPSS Statistics when the six assumptions in the previous section, Assumptions , have not been violated. At the end of these eight steps, we show you how to interpret the results from this test. If you are looking for help to make sure your data meets assumptions #4, #5 and #6, which are required when using an independent t-test, and can be tested using SPSS Statistics, you can learn more here .

The Independent T Test

Published with written permission from SPSS Statistics, IBM Corporation.

The Independent T Test Dialogue Box

Note: If you have more than 2 treatment groups in your study (e.g., 3 groups: diet , exercise and drug treatment groups), but only wanted to compared two (e.g., the diet and drug treatment groups), you could type in 1 to Group 1 : box and 3 to Group 2 : box (i.e., if you wished to compare the diet with drug treatment).

Continue Button

Access all 96 SPSS Statistics guides in Laerd Statistics

Subscription Plans

Output of the independent t-test in SPSS Statistics

SPSS Statistics generates two main tables of output for the independent t-test. If your data passed assumption #4 (i.e., there were no significant outliers), assumption #5 (i.e., your dependent variable was approximately normally distributed for each group of the independent variable) and assumption #6 (i.e., there was homogeneity of variances), which we explained earlier in the Assumptions section, you will only need to interpret these two main tables. However, since you should have tested your data for these assumptions, you will also need to interpret the SPSS Statistics output that was produced when you tested for them (i.e., you will have to interpret: (a) the boxplots you used to check if there were any significant outliers; (b) the output SPSS Statistics produces for your Shapiro-Wilk test of normality to determine normality; and (c) the output SPSS Statistics produces for Levene's test for homogeneity of variances). If you do not know how to do this, we show you in our enhanced independent t-test guide here . Remember that if your data failed any of these assumptions, the output that you get from the independent t-test procedure (i.e., the tables we discuss below) might not be valid and you might need to interpret these tables differently.

However, in this "quick start" guide, we take you through each of the two main tables in turn, assuming that your data met all the relevant assumptions.

Group Statistics Table

This table provides useful descriptive statistics for the two groups that you compared, including the mean and standard deviation.

Unless you have other reasons to do so, it would be considered normal to present information on the mean and standard deviation for this data. You might also state the number of participants that you had in each of the two groups. This can be useful when you have missing values and the number of recruited participants is larger than the number of participants that could be analysed.

A diagram can also be used to visually present your results. For example, you could use a bar chart with error bars (e.g., where the error bars could use the standard deviation, standard error or 95% confidence intervals). This can make it easier for others to understand your results. Again, we show you how to do this in our enhanced independent t-test guide.

Independent Samples Test Table

This table provides the actual results from the independent t-test.

Published with written permission from SPSS Statistics, an IBM Corporation.

You can see that the group means are statistically significantly different because the value in the " Sig. (2-tailed) " row is less than 0.05. Looking at the Group Statistics table, we can see that those people who undertook the exercise trial had lower cholesterol levels at the end of the programme than those who underwent a calorie-controlled diet.

Reporting the output of the independent t-test

Based on the results above, you could report the results of the study as follows (N.B., this does not include the results from your assumptions tests or effect size calculations):

This study found that overweight, physically inactive male participants had statistically significantly lower cholesterol concentrations (5.80 ± 0.38 mmol/L) at the end of an exercise-training programme compared to after a calorie-controlled diet (6.15 ± 0.52 mmol/L), t (38)=2.428, p =0.020.

In our enhanced independent t-test guide, we show you how to write up the results from your assumptions tests and independent t-test procedure if you need to report this in a dissertation, thesis, assignment or research report. We do this using the Harvard and APA styles (see here ). It is also worth noting that in addition to reporting the results from your assumptions and independent t-test, you are increasingly expected to report effect sizes . Whilst there are many different ways you can do this, we show you how to calculate effect sizes from your SPSS Statistics results in our enhanced independent t-test guide. Effect sizes are important because whilst the independent t-test tells you whether differences between group means are "real" (i.e., different in the population), it does not tell you the "size" of the difference. Providing an effect size in your results helps to overcome this limitation. You can learn more about our enhanced independent t-test guide here , or our enhanced content in general here . If you use Stata rather than SPSS Statistics, we have a "quick start" guide on how to run an independent t-test here .

  • Flashes Safe Seven
  • FlashLine Login
  • Faculty & Staff Phone Directory
  • Emeriti or Retiree
  • All Departments
  • Maps & Directions

Kent State University Home

  • Building Guide
  • Departments
  • Directions & Parking
  • Faculty & Staff
  • Give to University Libraries
  • Library Instructional Spaces
  • Mission & Vision
  • Newsletters
  • Circulation
  • Course Reserves / Core Textbooks
  • Equipment for Checkout
  • Interlibrary Loan
  • Library Instruction
  • Library Tutorials
  • My Library Account
  • Open Access Kent State
  • Research Support Services
  • Statistical Consulting
  • Student Multimedia Studio
  • Citation Tools
  • Databases A-to-Z
  • Databases By Subject
  • Digital Collections
  • Discovery@Kent State
  • Government Information
  • Journal Finder
  • Library Guides
  • Connect from Off-Campus
  • Library Workshops
  • Subject Librarians Directory
  • Suggestions/Feedback
  • Writing Commons
  • Academic Integrity
  • Jobs for Students
  • International Students
  • Meet with a Librarian
  • Study Spaces
  • University Libraries Student Scholarship
  • Affordable Course Materials
  • Copyright Services
  • Selection Manager
  • Suggest a Purchase

Library Locations at the Kent Campus

  • Architecture Library
  • Fashion Library
  • Map Library
  • Performing Arts Library
  • Special Collections and Archives

Regional Campus Libraries

  • East Liverpool
  • College of Podiatric Medicine

how to write null hypothesis for independent t test

  • Kent State University
  • SAS Tutorials

Independent Samples t Test

Sas tutorials: independent samples t test.

  • The SAS 9.4 User Interface
  • SAS Syntax Rules
  • SAS Libraries
  • The Data Step
  • Informats and Formats
  • User-Defined Formats (Value Labels)
  • Defining Variables
  • Missing Values
  • Importing Excel Files into SAS
  • Computing New Variables
  • Date-Time Functions and Variables in SAS
  • Sorting Data
  • Subsetting and Splitting Datasets
  • Merging Datasets
  • Transposing Data using PROC TRANSPOSE
  • Summarizing dataset contents with PROC CONTENTS
  • Viewing Data
  • Frequency Tables using PROC FREQ
  • Crosstabs using PROC FREQ
  • Pearson Correlation with PROC CORR
  • Chi-Square Test of Independence
  • t tests are used to test if the means of two independent groups are significantly different. In SAS, PROC TTEST with a CLASS statement and a VAR statement can be used to conduct an independent samples t test." href="https://libguides.library.kent.edu/SAS/IndependentTTest" style="" >Independent Samples t Test
  • t tests are used to test if the means of two paired measurements, such as pretest/posttest scores, are significantly different. In SAS, PROC TTEST with a PAIRED statement can be used to conduct a paired samples t test." href="https://libguides.library.kent.edu/SAS/PairedSamplestTest" style="" >Paired Samples t Test
  • Exporting Results to Word or PDF
  • Importing Data into SAS OnDemand for Academics
  • Connecting to WRDS from SAS
  • SAS Resources Online
  • How to Cite the Tutorials

Sample Data Files

Our tutorials reference a dataset called "sample" in many examples. If you'd like to download the sample dataset to work through the examples, choose one of the files below:

  • Data definitions (*.pdf)
  • Data - Comma delimited (*.csv)
  • Data - Tab delimited (*.txt)
  • Data - Excel format (*.xlsx)
  • Data - SAS format (*.sas7bdat)
  • Data - SPSS format (*.sav)
  • SPSS Syntax (*.sps) Syntax to add variable labels, value labels, set variable types, and compute several recoded variables used in later tutorials.
  • SAS Syntax (*.sas) Syntax to read the CSV-format sample data and set variable labels and formats/value labels.

The Independent Samples t Test compares the means of two independent groups in order to determine whether there is statistical evidence that the associated population means are significantly different. The Independent Samples t Test is a parametric test.

This test is also known as:

  • Independent t Test
  • Independent Measures t Test
  • Independent Two-sample t Test
  • Student t Test
  • Two-Sample t Test
  • Uncorrelated Scores t Test
  • Unpaired t Test
  • Unrelated t Test

The variables used in this test are known as:

  • Dependent variable, or test variable
  • Independent variable, or grouping variable

Common Uses

The Independent Samples t Test is commonly used to test the following:

  • Statistical differences between the means of two groups
  • Statistical differences between the means of two interventions
  • Statistical differences between the means of two change scores

Note:  The Independent Samples  t  Test can only compare the means for two (and only two) groups. It cannot make comparisons among more than two groups. If you wish to compare the means across more than two groups, you will likely want to run an ANOVA.

Data Requirements

Your data must meet the following requirements:

  • Dependent variable that is continuous (i.e., interval or ratio level)
  • Independent variable that is categorical and has exactly two categories
  • Cases that have values on both the dependent and independent variables
  • Subjects in the first group cannot also be in the second group
  • No subject in either group can influence subjects in the other group
  • No group can influence the other group
  • Violation of this assumption will yield an inaccurate p value
  • Random sample of data from the population
  • Non-normal population distributions, especially those that are thick-tailed or heavily skewed, considerably reduce the power of the test
  • Among moderate or large samples, a violation of normality may still yield accurate p values
  • When this assumption is violated and the sample sizes for each group differ, the p value is not trustworthy. However, the Independent Samples t Test output also includes an approximate t statistic that is not based on assuming equal population variances. This alternative statistic, called the Welch t Test statistic 1 , may be used when equal variances among populations cannot be assumed. The Welch t Test is also known an Unequal Variance t Test or Separate Variances t Test.
  • No outliers

Note: When one or more of the assumptions for the Independent Samples t Test are not met, you may want to run the nonparametric Mann-Whitney U Test instead.

Researchers often follow several rules of thumb:

  • Each group should have at least 6 subjects, ideally more. Inferences for the population will be more tenuous with too few subjects.
  • A balanced design (i.e., same number of subjects in each group) is ideal. Extremely unbalanced designs increase the possibility that violating any of the requirements/assumptions will threaten the validity of the Independent Samples t Test.

1  Welch, B. L. (1947). The generalization of "Student's" problem when several different population variances are involved. Biometrika , 34 (1–2), 28–35.

The null hypothesis ( H 0 ) and alternative hypothesis ( H 1 ) of the Independent Samples t Test can be expressed in two different but equivalent ways:

H 0 : µ 1  = µ 2 ("the two population means are equal") H 1 : µ 1  ≠ µ 2 ("the two population means are not equal")

H 0 : µ 1  - µ 2  = 0 ("the difference between the two population means is equal to 0") H 1 :  µ 1  - µ 2  ≠ 0 ("the difference between the two population means is not 0")

where µ 1 and µ 2 are the population means for group 1 and group 2, respectively. Notice that the second set of hypotheses can be derived from the first set by simply subtracting µ 2 from both sides of the equation.

Test Statistic

The test statistic for an Independent Samples t Test is denoted t . However, there are different formulas for the test statistic and degrees of freedom, based on whether or not we assume that the two groups have equal variances.

SAS produces both forms of the test, so both forms of the test are described here. Note that the null and alternative hypotheses are identical for both forms of the test statistic.

There are two differences between the Pooled and Satterthwaite t tests: how the test statistic is calculated, and the degrees of freedom used to determine the significance of the test statistic. The test statistic for the Pooled t test uses pooled variances, and the degrees of freedom are n 1 +n 2 -2. The test statistic for the Satterthwaite t test utilizes un-pooled variances, and the degrees of freedom use a special correction formula called the Satterthwaite equation. Why does it matter? When the groups have unequal variances, that introduces uncertainty into the results; the way we take this into account is by using a more conservative estimate for the degrees of freedom and test statistic.

Equal variances assumed (Pooled)

When the two independent samples are assumed to be drawn from populations with identical population variances (i.e., σ 1 2 = σ 2 2 ) , the test statistic t is computed as:

$$ t = \frac{\overline{x}_{1} - \overline{x}_{2}}{s_{p}\sqrt{\frac{1}{n_{1}} + \frac{1}{n_{2}}}} $$

$$ s_{p} = \sqrt{\frac{(n_{1} - 1)s_{1}^{2} + (n_{2} - 1)s_{2}^{2}}{n_{1} + n_{2} - 2}} $$

\(\bar{x}_{1}\) = Mean of first sample \(\bar{x}_{2}\) = Mean of second sample \(n_{1}\) = Sample size (i.e., number of observations) of first sample \(n_{2}\) = Sample size (i.e., number of observations) of second sample \(s_{1}\) = Standard deviation of first sample \(s_{2}\) = Standard deviation of second sample \(s_{p}\) = Pooled standard deviation

The calculated t value is then compared to the critical t value from the t distribution table with degrees of freedom df = n 1 + n 2 - 2 and chosen confidence level. If the calculated t value is greater than the critical t value, then we reject the null hypothesis.

Note that this form of the independent samples T test statistic assumes equal variances.

Because we assume equal population variances, it is OK to "pool" the sample variances ( s p ). However, if this assumption is violated, the pooled variance estimate may not be accurate, which would affect the accuracy of our test statistic (and hence, the p-value).

Equal variances not assumed (Satterthwaite)

When the two independent samples are assumed to be drawn from populations with unequal variances (i.e., σ 1 2  ≠ σ 2 2 ), the test statistic t is computed as:

$$ t = \frac{\overline{x}_{1} - \overline{x}_{2}}{\sqrt{\frac{s_{1}^{2}}{n_{1}} + \frac{s_{2}^{2}}{n_{2}}}} $$

\(\bar{x}_{1}\) = Mean of first sample \(\bar{x}_{2}\) = Mean of second sample \(n_{1}\) = Sample size (i.e., number of observations) of first sample \(n_{2}\) = Sample size (i.e., number of observations) of second sample \(s_{1}\) = Standard deviation of first sample \(s_{2}\) = Standard deviation of second sample

The calculated t value is then compared to the critical t value from the t distribution table with degrees of freedom

$$ df = \frac{ \left ( \frac{s_{1}^2}{n_{1}} + \frac{s_{2}^2}{n_{2}} \right ) ^{2} }{ \frac{1}{n_{1}-1} \left ( \frac{s_{1}^2}{n_{1}} \right ) ^{2} + \frac{1}{n_{2}-1} \left ( \frac{s_{2}^2}{n_{2}} \right ) ^{2}} $$

and chosen confidence level. If the calculated t value > critical t value, then we reject the null hypothesis.

Note that this form of the independent samples T test statistic does not assume equal variances. This is why both the denominator of the test statistic and the degrees of freedom of the critical value of  t are different than the equal variances form of the test statistic.

Folded F Test for Equality of Variances

Recall that the Independent Samples t Test requires the assumption of homogeneity of variance -- i.e., both groups have the same variance. SAS includes a test for the homogeneity of variance, called the Folded F Test , whenever you run an independent samples T test.

The hypotheses for the folded F test are: 

H 0 : σ 1 2 = σ 2 2   ("the population variances of group 1 and 2 are equal") H 1 : σ 1 2  ≠ σ 2 2   ("the population variances of group 1 and 2 are not equal")

This implies that if we reject the null hypothesis of the Folded F Test, it suggests that the variances of the two groups are not equal; i.e., that the homogeneity of variances assumption is violated. (Source: SAS 9.2 User's Guide, Second Edition )

You will use the results of the Folded F test to determine which output from the Independent Samples t test to rely on: Pooled or Satterthwaite. If the test indicates that the variances are equal across the two groups (i.e., p -value large), you will rely on the Pooled output when you look at the results for the Independent Samples t Test. If the test indicates that the variances are not equal across the two groups (i.e., p -value small), you will need to rely on the Satterthwaite output when you look at the results of the Independent Samples t Test.

Data Set-Up

Your data should include two variables (represented in columns) that will be used in the analysis. The independent variable should be categorical, and should have exactly two groups. The independent variable's type can be numeric or string, as long as there are only two categories. (Missing values do not count as a category.) The dependent variable should be continuous (i.e., interval or ratio), and must therefore be numeric. Each row of the dataset should represent a unique subject or case.

The following screenshot shows a selection of variables (not exhaustive) from the sample dataset that could be used in an Independent Samples t Test:

how to write null hypothesis for independent t test

In this example, the variables Gender, Athlete, and State would be acceptable for use as independent variables in the Independent Samples t Test. Gender and Athlete are numeric, with data values 0 and 1. State is a string variable, with data values "In state" and "Out of state".

The variables Height, MileMinDur, and English would be acceptable for use as dependent variables in the Independent Samples t Test. Variables Height and English are both numeric. Variable MileMinDur is a duration variable, which is a special type of numeric variable in SAS. (However, if MileMinDur was read into SAS as a character variable, it will need to be converted to a duration variable before using it in the t test.)

SAS can only make use of cases that have nonmissing values for the independent and the dependent variables, so if a case has a missing value for either variable, it can not be included in the test. Additionally, if you try to use a variable with more than two categories as the independent variable, SAS will return an error.

Using PROC TTEST for the Independent Samples t Test

When conducting an Independent Samples t Test, the general form of PROC TTEST is:

In the PROC TTEST statement, the DATA option specifies the name of your dataset. The optional ALPHA option specifies the desired significance level. By default, PROC TTEST uses ALPHA=.05 (i.e., 5% significance), but you can set it to ALPHA=.01 for 1% significance, or ALPHA=.10 for 10% significance, etc.

The VAR statement is where you specify the dependent variable(s) -- that is, the continuous numeric variable -- to use in the test. If you are specifying more than one dependent variable, simply separate the names of the variables using spaces.

The CLASS statement is where you specify the independent variable -- that is, the categorical variable -- to use in the test. You may only specify one CLASS variable at a time; if you try to specify more than one CLASS variable, the procedure will not run.

If you specify more than one VAR variable, you will get back more than one t test result. Specifically, SAS will produce t tests comparing the means of each VAR variable between the groups of the CLASS variable.

When using PROC TTEST for an independent samples t-test, your independent variable must be specified using the CLASS statement, not the BY statement. Using the BY statement will partition your data into subsets based on the BY variable and run One Sample t Tests on those subsets. Using the CLASS statement will compare the means of the CLASS variable group using an Independent Samples t Test.

Example: Independent samples T test when variances are equal

Problem statement.

In our sample dataset, students reported their writing placement test scores, and whether or not they were male or female. Suppose we want to know if the average writing score is different for males versus females. This involves testing whether the sample means for writing scores among males and females in your sample are statistically different (and by extension, inferring whether the means for writing scores in the population are significantly different between these two groups). You can use an Independent Samples  t  Test to compare the mean writing scores for males and females.

Before the Test

State the null and alternative hypotheses.

The hypotheses for this example can be expressed as:

H 0 : µ males  = µ females ("the mean writing scores in the population of males is identical to the mean writing score in the population of females") H 1 : µ males  ≠ µ females ("the two population means are not equal")

where µ males  and µ females are the population means for males and females, respectively.

Before we perform our hypothesis tests, we should decide on a  significance level  (denoted α ). The significance level is the threshold we will use to decide whether a test result is significant. For this example, let's use  α  = 0.05, or 5%.

In the sample data, we will use two variables:  Gender  and  Writing . The variable  Gender  has values of either “1” or “0” which correspond to females and males, respectively. It will function as the independent variable in this  t  test. The variable  Writing  is a numeric variable, and it will function as the dependent variable. In SAS, the first few rows of data look like this (if variable and value labels have been applied):

Screenshot of Viewtable window with one column for ID number, one column for Gender, one column for Writing score

Exploratory Data Analysis + Check the Assumptions

Recall that the Independent Samples t Test has several assumptions that we must take into account:

  • The dependent variable should be normally distributed in both groups
  • The variance of the dependent variable should be the same in both groups; if it isn't, use the alternate version of the test statistic

So before we jump into the Independent Samples  t  Test, it is a good idea to look at descriptive statistics and graphs to get an idea of what to expect, and to see if the assumptions of the test have been reasonably met. To do this, we'll want to look at the means and standard deviations of Writing for males and females, as well as graphs that compare the distribution of Writing for males versus females. PROC TTEST automatically runs descriptive statistics and graphs for us, but we can also use PROC MEANS to produce descriptive statistics by group:

Screen shot of PROC MEANS output illustrating that Females have a greater mean of writing placement test scores than males

PROC MEANS tells us several important things. First, there were 204 males and 222 females in the dataset, but only 191 males and 204 females reported a writing score. (This is important to know, because PROC TTEST can only use cases with nonmissing values for both gender and writing score. So our effective sample size for this test is 191+204 = 395, which is less than the total number of rows in the sample dataset (435).) Second, the mean writing score for males is 77.14 points, while the mean writing score for females is 81.73 points. This is a difference of more than four points. Third, the standard deviations for males’ and females’ writing scores are very similar: 4.88 for males, and 5.09 for females.

For graphs, we can use the two graphs that PROC TTEST produces for an independent samples t test:

screen shot of SAS PROC TTEST of the distribution graph comparing males and females on the writing placement test scores

The first graph contains histograms (top 2 panels) and boxplots (bottom panel) comparing the distributions of males' writing scores and females' writing scores. From the histograms, we can see that the distribution of writing scores for both the males and the females are roughly symmetric, but the distribution of females' writing scores is "shifted" slightly to the right of the males. From the boxplots, we can see that the total length of the boxplots and the inter-quartile range (distance between the 1st and 3rd quartiles, i.e. the edges of the boxes) is similar for males and females. This is what we would expect to see if the two groups had the same variance. By contrast, when we look at the center lines in the boxplot (which represent the median score), we see that they do not line up: the center line for the females' box plot is to the right of the center line for the males' boxplot. Additionally, the diamond shape in each box plot represents the mean score; we see that the mean score for the females is to the right of the mean score for the males. If the two groups had the same mean, we would expect these center lines and/or diamonds to "line up" vertically.

screenshot of SAS PROC TTEST showing the Q-Q plots of males and females

The second graph contains Q-Q plots of the writing scores for males (left panel) versus females (right panel). The Q-Q plots produced by PROC TTEST can be used to check if a variable's observed values are consistent with what we would expect them to be if the variable was truly normally distributed. To read a Q-Q plot, we look to see if the dots (the observed values) match up with the expected values for a normal distribution (the diagonal line). If the points fall along the line, then the values are consistent with what we would expect them to be if the data were truly normally distributed. In this case, we see that the values in the middle of the range are consistent with a normal distribution, for both males and females. Both groups have slight deviations from normality in the tails. Therefore, the normality assumption required for the independent samples t test appears to be satisfied.

Running the Test

Sas program.

Four tables appear in the PROC TTEST output; let's go through each one in the order they appear.

Screenshot of first table in the PROC TTEST output, containing the sample size, mean, standard deviation, standard error, minimum and maximum. It also shows the mean difference between males and females is about 4 and a half points.

The first table contains descriptive statistics for both groups, including the valid sample size (n), mean, standard deviation, standard error (s/sqrt(n)), minimum, and maximum. Much of this we already saw in the PROC MEANS output, but this table also contains the computed difference between the two means. In this case, the first mean (male) was 4.5961 points lower than the second mean (females). In plain English, this means that, on average, females scored over 4 points higher on their writing placement test than males. Keep in mind that the independent samples t test is testing whether or not this difference is statistically different from zero.

screen shot of SAS output. This is the second table from PROC TTEST. This includes confidence limits for the group means.

The second table contains confidence limits for the group means, confidence limits for the group standard deviations, and confidence limits for the difference in the means (which is what we're interested in). Notice that there are two different confidence interval formulas for the difference. The first, Pooled, assumes that both groups have the same variance in writing scores. The second, Satterthwaite, does not make this assumption (i.e., it takes into account that one group has a different variance in writing scores than the other). We know from our exploratory data analysis that males and females have similar standard deviations, so we should look at the Pooled confidence interval. The 95% confidence interval for the difference in the writing scores is (-5.5846, -3.6076).

The third table contains the actual t-test results, and the fourth table contains the "Equality of Variances" test results:

Screen shot of the test statistic from SAS PROC TTEST output. We can see in the Equality of Variances box that we fail to reject the Folded F test which means we use the Pooled test statistic.

Previously, we had used informal methods (descriptive statistics and graphs) to check if the two groups had the same variance in writing scores. However, we can do a "formal" hypothesis test to check if the two variances are approximately equal, using the Folded F test in the “Equality of Variances” table. This can help us decide whether we should use the Pooled or Satterthwaite result. The null hypothesis of the Folded F test is that the variances are equal; the alternative is that the variances are not equal. Because the p-value is greater than alpha (.05), we fail to reject the null hypothesis, and conclude that the variance of writing scores is equal for these two groups. Therefore, we will use the Pooled version of the independent samples t test.

Going back to the third table, we see that there are two versions of the  t  test: Pooled (which assumes equal variances) and Satterthwaite (which does not assume equal variances). The columns of the table, from left to right, are:

  • Method  and  Variances  show which formula and variance assumptions are used for that test
  • df  is the degrees of freedom
  • t Value  is the test statistic, determined using the appropriate formula
  • Pr > |t|  is the p-value corresponding to the given test statistic and degrees of freedom

Based on the Folded F test, we decided to use the Pooled version of the test statistic. To determine if the result is significant or not, we compare the Pooled p-value ( p < .001) against our chosen significance level alpha (.05). Since the p-value is smaller than alpha, we reject the null hypothesis.

Decision and Conclusions

Since  p  < .0001 is less than our chosen significance level  α  = 0.05, we can reject the null hypothesis, and conclude that males and females had a statistically significant difference in their average writing scores.

Based on the results, we can state the following:

  • There was a significant difference in mean writing scores between males and females ( t 393  = -9.14,  p  < .05).
  • The average writing score for females was over 4 points greater than the average writing score for males (95% confidence interval -5.5846, -3.6076).

Example: Independent samples T test when variances are not equal

In our sample dataset, students reported their typical time to run a mile, and whether or not they were an athlete. Suppose we want to know if the average time to run a mile is different for athletes versus non-athletes. This involves testing whether the sample means for mile time among athletes and non-athletes in your sample are statistically different (and by extension, inferring whether the means for mile times in the population are significantly different between these two groups). You can use an Independent Samples t Test to compare the mean mile time for athletes and non-athletes.

H 0 : µ athlete  = µ non-athlete ("the mean mile time in the population of athletes is identical to the mean mile time in the population of non-athletes") H 1 : µ athlete  ≠ µ non-athlete ("the two population means are not equal")

where µ athlete and µ non-athlete are the population means for athletes and non-athletes, respectively.

Additionally, we should decide on a significance level (typically denoted using the Greek letter alpha, α ) before we perform our hypothesis tests. The significance level is the threshold we use to decide whether a test result is significant. For this example, let's use α = 0.05.

In the sample data, we will use two variables: Athlete and MileMinDur . The variable Athlete has values of either “1” or “0” which correspond to athletes and non-athletes, respectively. It will function as the independent variable in this t test. The variable MileMinDur is a numeric duration variable (h:mm:ss), and it will function as the dependent variable. In SAS, the first few rows of data look like this (if variable and value labels have been applied):

Screenshot of Viewtable window with one column for ID number, one column for Athlete, one column for mile run time

As before, we will look at descriptive statistics and graphs to get an idea of the differences in the groups' distributions, means, and variances. This time, we will compare the means and standard deviations of MileMinDur for the athletes and non-athletes, as well as graphs that compare the distribution of MileMinDur for athletes versus non-athletes.

how to write null hypothesis for independent t test

From this table, we can see that:

  • Although there were 251 non-athletes and 184 athletes in the dataset, not all of them had observations for their mile run times. We can only use cases with nonmissing values for both Athlete and MileMinDur in the test, so for the purposes of the test, there are 226 non-athletes and 166 athletes.
  • The mean mile time for non-athletes is 546.1 seconds (9 minutes, 6.1 seconds), while the mean mile time for athletes is 411.3 seconds (6 minutes, 51.3 seconds). This is a difference of more than two minutes.
  • The standard deviation for the non-athletes' mile times is just over two minutes (121.7 seconds), while the standard deviation of the athletes' mile times is under one minute (49.44 seconds).

Looking at the graphs from the PROC TTEST output:

how to write null hypothesis for independent t test

The top two panels in the histogram show the distribution of the mile run times for athletes and non-athletes, respectively. We can see that the distribution of mile times for both the athletes and the non-athletes are roughly symmetric, but the data range for the non-athletes is much larger. In the bottom panel, we see comparative boxplots of the same data. From the boxplots, we can see that the total length of the boxplots and the inter-quartile range (distance between the 1st and 3rd quartiles, i.e. the edges of the boxes) is much larger for non-athletes than athletes. If the variances of these two groups were indeed equal, we would expect the total length of the boxplots to be about the same for both groups. However, from this boxplot, it is clear that the spread of observations for non-athletes is much greater than the spread of observations for athletes. Already, we can estimate that the variances for these two groups are quite different. (We can confirm this later using the Folded F test in the PROC TTEST output.)

how to write null hypothesis for independent t test

The second graph contains Q-Q plots of the mile run times for non-athletes and athletes. As before, we check to see if the data values (the dots) match up to the values expected from a normal distribution (the line). In this case, we see that the values in the middle of the range are consistent with a normal distribution, for both athletes and non-athletes. Both groups have slight deviations from normality in the tails.

Four tables appear in the PROC TTEST output.

how to write null hypothesis for independent t test

The first table contains descriptive statistics for both groups, including the valid sample size (n), mean, standard deviation, standard error (s/sqrt(n)), minimum, and maximum. Much of this we already saw in the PROC MEANS output, but this table also contains the computed difference between the two means. In this case, the first mean (non-athletes) was 134.8 seconds larger than the second mean (athletes). In plain English, this means that, on average, it took the non-athletes about 2 minutes and 14.8 seconds longer than the athletes to complete their mile run. Keep in mind that the independent samples t test is testing whether or not this difference is statistically different from zero.

how to write null hypothesis for independent t test

The second table contains confidence limits for the group means, confidence limits for the group standard deviations, and confidence limits for the difference in the means. We specifically want to focus on the confidence intervals for the difference in the means. Notice that there are two different confidence interval formulas for the difference. The first, Pooled, assumes that both groups have the same variance in mile run time. The second, Satterthwaite, does not make this assumption (i.e., it takes into account that one group has a different variance in mile run time than the other). We know from our exploratory data analysis that the athletes and non-athletes have different variances, so we should look at the Satterthwaite confidence interval. The 95% confidence interval for the difference in the mile run times is (117.2, 152.4).

how to write null hypothesis for independent t test

Tables 3 and 4 contain the independent samples t test and Folded F test, respectively. This time, we had ample graphical evidence of unequal variances between the groups, so we can use the Folded F test to see if the difference in the variances is significant. Recall that the null hypothesis of this test is that the variances are equal; the alternative is that the variances are not equal. Because the p-value is less than alpha (.05), we reject the null hypothesis, and conclude that the variance of the mile run times is different for these two groups. Because of this, we will use the Satterthwaite version of the test.

Going back to table 3, we now compare the Satterthwaite t-test's p-value (p < .001) against our chosen significance level alpha (.05). Since the p-value is smaller than alpha, we reject the null hypothesis.

Since p < .0001 is less than our chosen significance level α = 0.05, we can reject the null hypothesis, and conclude that the that the mean mile time for athletes and non-athletes is significantly different.

  • There was a significant difference in mean mile time between non-athletes and athletes ( t 315.846 = 15.047, p < .001).
  • The average mile time for athletes was 2 minutes and 14 seconds faster than the average mile time for non-athletes (95% confidence interval 117.2, 152.4).

Tutorial Feedback

  • << Previous: Chi-Square Test of Independence
  • Next: Paired Samples t Test >>
  • Last Updated: Dec 18, 2023 12:59 PM
  • URL: https://libguides.library.kent.edu/SAS

Street Address

Mailing address, quick links.

  • How Are We Doing?
  • Student Jobs

Information

  • Accessibility
  • Emergency Information
  • For Our Alumni
  • For the Media
  • Jobs & Employment
  • Life at KSU
  • Privacy Statement
  • Technology Support
  • Website Feedback
  • PRO Courses Guides New Tech Help Pro Expert Videos About wikiHow Pro Upgrade Sign In
  • EDIT Edit this Article
  • EXPLORE Tech Help Pro About Us Random Article Quizzes Request a New Article Community Dashboard This Or That Game Popular Categories Arts and Entertainment Artwork Books Movies Computers and Electronics Computers Phone Skills Technology Hacks Health Men's Health Mental Health Women's Health Relationships Dating Love Relationship Issues Hobbies and Crafts Crafts Drawing Games Education & Communication Communication Skills Personal Development Studying Personal Care and Style Fashion Hair Care Personal Hygiene Youth Personal Care School Stuff Dating All Categories Arts and Entertainment Finance and Business Home and Garden Relationship Quizzes Cars & Other Vehicles Food and Entertaining Personal Care and Style Sports and Fitness Computers and Electronics Health Pets and Animals Travel Education & Communication Hobbies and Crafts Philosophy and Religion Work World Family Life Holidays and Traditions Relationships Youth
  • Browse Articles
  • Learn Something New
  • Quizzes Hot
  • This Or That Game
  • Train Your Brain
  • Explore More
  • Support wikiHow
  • About wikiHow
  • Log in / Sign up
  • Education and Communications
  • College University and Postgraduate
  • Academic Writing

Writing Null Hypotheses in Research and Statistics

Last Updated: January 17, 2024 Fact Checked

This article was co-authored by Joseph Quinones and by wikiHow staff writer, Jennifer Mueller, JD . Joseph Quinones is a High School Physics Teacher working at South Bronx Community Charter High School. Joseph specializes in astronomy and astrophysics and is interested in science education and science outreach, currently practicing ways to make physics accessible to more students with the goal of bringing more students of color into the STEM fields. He has experience working on Astrophysics research projects at the Museum of Natural History (AMNH). Joseph recieved his Bachelor's degree in Physics from Lehman College and his Masters in Physics Education from City College of New York (CCNY). He is also a member of a network called New York City Men Teach. There are 7 references cited in this article, which can be found at the bottom of the page. This article has been fact-checked, ensuring the accuracy of any cited facts and confirming the authority of its sources. This article has been viewed 25,635 times.

Are you working on a research project and struggling with how to write a null hypothesis? Well, you've come to the right place! Start by recognizing that the basic definition of "null" is "none" or "zero"—that's your biggest clue as to what a null hypothesis should say. Keep reading to learn everything you need to know about the null hypothesis, including how it relates to your research question and your alternative hypothesis as well as how to use it in different types of studies.

Things You Should Know

  • Write a research null hypothesis as a statement that the studied variables have no relationship to each other, or that there's no difference between 2 groups.

{\displaystyle \mu _{1}=\mu _{2}}

  • Adjust the format of your null hypothesis to match the statistical method you used to test it, such as using "mean" if you're comparing the mean between 2 groups.

What is a null hypothesis?

A null hypothesis states that there's no relationship between 2 variables.

  • Research hypothesis: States in plain language that there's no relationship between the 2 variables or there's no difference between the 2 groups being studied.
  • Statistical hypothesis: States the predicted outcome of statistical analysis through a mathematical equation related to the statistical method you're using.

Examples of Null Hypotheses

Step 1 Research question:

Null Hypothesis vs. Alternative Hypothesis

Step 1 Null hypotheses and alternative hypotheses are mutually exclusive.

  • For example, your alternative hypothesis could state a positive correlation between 2 variables while your null hypothesis states there's no relationship. If there's a negative correlation, then both hypotheses are false.

Step 2 Proving the null hypothesis false is a precursor to proving the alternative.

  • You need additional data or evidence to show that your alternative hypothesis is correct—proving the null hypothesis false is just the first step.
  • In smaller studies, sometimes it's enough to show that there's some relationship and your hypothesis could be correct—you can leave the additional proof as an open question for other researchers to tackle.

How do I test a null hypothesis?

Use statistical methods on collected data to test the null hypothesis.

  • Group means: Compare the mean of the variable in your sample with the mean of the variable in the general population. [6] X Research source
  • Group proportions: Compare the proportion of the variable in your sample with the proportion of the variable in the general population. [7] X Research source
  • Correlation: Correlation analysis looks at the relationship between 2 variables—specifically, whether they tend to happen together. [8] X Research source
  • Regression: Regression analysis reveals the correlation between 2 variables while also controlling for the effect of other, interrelated variables. [9] X Research source

Templates for Null Hypotheses

Step 1 Group means

  • Research null hypothesis: There is no difference in the mean [dependent variable] between [group 1] and [group 2].

{\displaystyle \mu _{1}+\mu _{2}=0}

  • Research null hypothesis: The proportion of [dependent variable] in [group 1] and [group 2] is the same.

{\displaystyle p_{1}=p_{2}}

  • Research null hypothesis: There is no correlation between [independent variable] and [dependent variable] in the population.

\rho =0

  • Research null hypothesis: There is no relationship between [independent variable] and [dependent variable] in the population.

{\displaystyle \beta =0}

Expert Q&A

Joseph Quinones

You Might Also Like

Write an Essay

Expert Interview

how to write null hypothesis for independent t test

Thanks for reading our article! If you’d like to learn more about physics, check out our in-depth interview with Joseph Quinones .

  • ↑ https://online.stat.psu.edu/stat100/lesson/10/10.1
  • ↑ https://online.stat.psu.edu/stat501/lesson/2/2.12
  • ↑ https://support.minitab.com/en-us/minitab/21/help-and-how-to/statistics/basic-statistics/supporting-topics/basics/null-and-alternative-hypotheses/
  • ↑ https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5635437/
  • ↑ https://online.stat.psu.edu/statprogram/reviews/statistical-concepts/hypothesis-testing
  • ↑ https://education.arcus.chop.edu/null-hypothesis-testing/
  • ↑ https://sphweb.bumc.bu.edu/otlt/mph-modules/bs/bs704_hypothesistest-means-proportions/bs704_hypothesistest-means-proportions_print.html

About This Article

Joseph Quinones

  • Send fan mail to authors

Reader Success Stories

Mogens Get

Dec 3, 2022

Did this article help you?

Mogens Get

Featured Articles

Flirty or Just Nice? 15+ Ways to Tell if a Guy Is Interested in You or Just Being Friendly

Trending Articles

How to Make Money on Cash App: A Beginner's Guide

Watch Articles

Make Homemade Liquid Dish Soap

  • Terms of Use
  • Privacy Policy
  • Do Not Sell or Share My Info
  • Not Selling Info

wikiHow Tech Help Pro:

Level up your tech skills and stay ahead of the curve

ListenData

Hypothesis Testing : Independent T-Test

Hypothesis testing : meaning.

If we selected many samples from the same population, would we still find the same relationship between these two variables in every sample? Or is our finding due only to random chance?

Independent T-Test

  • Each score is sampled independently and randomly. 
  • The scores are normally distributed within each of the two groups.
  • The variance in each of the groups is equal. 

What is p-value in simple terms?

how to write null hypothesis for independent t test

The columns labeled " Levene's Test for Equality of Variances " tell us whether an assumption of the t-test has been met. The t-test assumes that the variance in each of the groups is approximately equal.
If the significance (p value) of Levene's test is less than or equal to 5% level of significance (.05), then you should use the bottom row of the output (the row labeled "Equal variances not assumed" ) 
If the significance (p value) of Levene's test is greater than 5% level of significance (.05), then you should use the middle row of the output (the row labeled "Equal variances assumed" ) 

Deepanshu Bhalla

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has over 10 years of experience in data science. During his tenure, he worked with global clients in various domains like Banking, Insurance, Private Equity, Telecom and HR.

how to write null hypothesis for independent t test

Hi Deepanshu, I like your blog & i follow it regularly. Your explanation is crystal clear. I learned many things from your blog. Please try to post below requests; 1) statistical modeling using SAS & R 2) how to fit model using SAS & R 3) fitting the model with SAS & R 4) Normal Distribution 5) Correlation 6) Linear Regression 7) Multiple Regression 8) ANOVA 9) Categorical Data Analysis Many thanks & Kind Regards, Naveen

how to write null hypothesis for independent t test

Sure. I will write about these topics!

Deep, Thanks a lot.

hi this is kartik, how do we know which teacher is better..??

Look at the mean difference of ratings of the charismatic-teacher-reputation condition and the punitive-teacher-reputation. Since difference is positive, it means charismatic-teacher is better.

Hi Bhalla, pls I want to know how to interpret Cluster Analysis and PCA. I have some data i want interpret. I love the clarity of your explanations. If you don't mind you can send it to my email:[email protected] Thanks

I'm a reearch student. Thanks

Deepanshu, Your blog is awesome bro! Thanks for sharing.. Keep up the good work

when we talk of two groups on t-test is it between two regression models or two columns, can we say f-Test is a method to compare models

sir, 1.if our variance of two groups are not equal then what will we do? 2. If our null hypothesis is reject that is our p value is less than 0.05 then how can we find which one is grater in charismatic-teacher-reputation condition and the punitive-teacher-reputation condition.

how to write null hypothesis for independent t test

sir i will suggest you . you creat a youtube channel and upload a video.sir u are great teacher.

well explained article

Statology

Statistics Made Easy

Paired Samples t-test: Definition, Formula, and Example

A paired samples t-test is used to compare the means of two samples when each observation in one sample can be paired with an observation in the other sample.

This tutorial explains the following:

  • The motivation for performing a paired samples t-test.
  • The formula to perform a paired samples t-test.
  • The assumptions that should be met to perform a paired samples t-test.
  • An example of how to perform a paired samples t-test.

Paired Samples t-test: Motivation

A paired samples t-test is commonly used in two scenarios:

1. A measurement is taken on a subject before and after some treatment – e.g. the max vertical jump of college basketball players is measured before and after participating in a training program.

2. A measurement is taken under two different conditions  – e.g. the response time of a patient is measured on two different drugs.

In both cases we are interested in comparing the mean measurement between two groups in which each observation in one sample can be paired with an observation in the other sample.

Paired Samples t-test: Formula

A paired samples t-test always uses the following null hypothesis:

  • H 0 : μ 1  = μ 2 (the two population means are equal)

The alternative hypothesis can be either two-tailed, left-tailed, or right-tailed:

  • H 1 (two-tailed): μ 1  ≠ μ 2 (the two population means are not equal)
  • H 1 (left-tailed): μ 1  < μ 2  (population 1 mean is less than population 2 mean)
  • H 1 (right-tailed):  μ 1 > μ 2  (population 1 mean is greater than population 2 mean)

We use the following formula to calculate the test statistic t:

t = x diff  / (s diff /√n)

  • x diff :  sample mean of the differences
  • s:  sample standard deviation of the differences
  • n:  sample size (i.e. number of pairs)

If the p-value that corresponds to the test statistic t with (n-1) degrees of freedom is less than your chosen significance level (common choices are 0.10, 0.05, and 0.01) then you can reject the null hypothesis.

Paired Samples t-test: Assumptions

For the results of a paired samples t-test to be valid, the following assumptions should be met:

  • The participants should be selected randomly from the population.
  • The differences between the pairs should be approximately normally distributed.
  • There should be no extreme outliers in the differences.

Paired Samples t-test : Example

Suppose we want to know whether or not a certain training program is able to increase the max vertical jump (in inches) of college basketball players.

To test this, we may recruit a simple random sample of 20 college basketball players and measure each of their max vertical jumps. Then, we may have each player use the training program for one month and then measure their max vertical jump again at the end of the month.

Paired t-test example dataset

To determine whether or not the training program actually had an effect on max vertical jump, we will perform a paired samples t-test at significance level α = 0.05 using the following steps:

Step 1: Calculate the summary data for the differences.

Paired samples t-test dataset

  • x diff :  sample mean of the differences =  -0.95
  • s:  sample standard deviation of the differences =  1.317
  • n:  sample size (i.e. number of pairs) =  20

Step 2: Define the hypotheses.

We will perform the paired samples t-test with the following hypotheses:

  • H 0 :  μ 1  = μ 2 (the two population means are equal)
  • H 1 :  μ 1  ≠ μ 2 (the two population means are not equal)

Step 3: Calculate the test statistic  t .

t = x diff  / (s diff /√n)  = -0.95 / (1.317/ √ 20) =  -3.226

Step 4: Calculate the p-value of the test statistic  t .

According to the T Score to P Value Calculator , the p-value associated with t = -3.226 and degrees of freedom = n-1 = 20-1 = 19 is  0.00445 .

Step 5: Draw a conclusion.

Since this p-value is less than our significance level α = 0.05, we reject the null hypothesis. We have sufficient evidence to say that the mean max vertical jump of players is different before and after participating in the training program.

Note:  You can also perform this entire paired samples t-test by simply using the Paired Samples t-test Calculator .

Additional Resources

The following tutorials explain how to perform a paired samples t-test using different statistical programs:

How to Perform a Paired Samples t-Test in Excel How to Perform a Paired Samples t-test in SPSS How to Perform a Paired Samples t-test in Stata How to Perform a Paired Samples t-test on a TI-84 Calculator How to Perform a Paired Samples t-test in R How to Perform a Paired Samples t-Test in Python How to Perform a Paired Samples t-Test by Hand

Featured Posts

5 Regularization Techniques You Should Know

Hey there. My name is Zach Bobbitt. I have a Masters of Science degree in Applied Statistics and I’ve worked on machine learning algorithms for professional businesses in both healthcare and retail. I’m passionate about statistics, machine learning, and data visualization and I created Statology to be a resource for both students and teachers alike.  My goal with this site is to help you learn statistics through using simple terms, plenty of real-world examples, and helpful illustrations.

5 Replies to “Paired Samples t-test: Definition, Formula, and Example”

What will happen if the p-value is more than the significance level of 0.05? Does it mean it is not significant or effective?

Thank you for this. It helped me a lot.

Excellent it really helps me

Hey Zach , thanks for statology! I love this site. It helps me a lot to remember and learn new things. I have a question. What if rather then test if the difference between tests is zero or greater/lower than zero, I’d like to test if the difference is at least x? Eg: I’d like to check if the time to change tire was reduced by at least 5 seconds after a training. Not only if the time is different or less than before. Could you include this example, please? Which changes in calculation we should do? Thanks a lot. Marcelo

in paired t test are we supposed to deduct the before from the after ?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Join the Statology Community

Sign up to receive Statology's exclusive study resource: 100 practice problems with step-by-step solutions. Plus, get our latest insights, tutorials, and data analysis tips straight to your inbox!

By subscribing you accept Statology's Privacy Policy.

IMAGES

  1. Writing null hypothesis for t test

    how to write null hypothesis for independent t test

  2. Solved Null hypotheses for an independent-measures t test

    how to write null hypothesis for independent t test

  3. Two Sample t Test (Independent Samples)

    how to write null hypothesis for independent t test

  4. Hypothesis Testing Example Two Sample t-Test

    how to write null hypothesis for independent t test

  5. The t Test for Two Independent Samples

    how to write null hypothesis for independent t test

  6. Independent Samples t-Test

    how to write null hypothesis for independent t test

VIDEO

  1. #t test Independent sample

  2. Independent-samples T-tests 1: Introduction

  3. Hypothesis

  4. Hypothesis Testing Independent T test with Assumption on Unequal Variances

  5. How to write null and alternative hypotheses #statistics

  6. Statistics 101: Single Sample Hypothesis t-test Examples

COMMENTS

  1. Independent Samples T Test: Definition, Using & Interpreting

    Independent Samples T Tests Hypotheses. Independent samples t tests have the following hypotheses: Null hypothesis: The means for the two populations are equal. Alternative hypothesis: The means for the two populations are not equal.; If the p-value is less than your significance level (e.g., 0.05), you can reject the null hypothesis. The difference between the two means is statistically ...

  2. Independent t-test for two samples

    The null hypothesis for the independent t-test is that the population means from the two unrelated groups are equal: H 0: u 1 = u 2. In most cases, we are looking to see if we can show that we can reject the null hypothesis and accept the alternative hypothesis, which is that the population means are not equal: ...

  3. SPSS Tutorials: Independent Samples t Test

    The null hypothesis (H 0) and alternative hypothesis (H 1) of the Independent Samples t Test can be expressed in two different but equivalent ways:H 0: µ 1 = µ 2 ("the two population means are equal") H 1: µ 1 ≠ µ 2 ("the two population means are not equal"). OR. H 0: µ 1 - µ 2 = 0 ("the difference between the two population means is equal to 0") H 1: µ 1 - µ 2 ≠ 0 ("the difference ...

  4. T Test Overview: How to Use & Examples

    Two-Sample T Test Hypotheses. Null hypothesis (H 0): Two population means are equal (µ 1 = µ 2). Alternative hypothesis (H A): Two population means are not equal (µ 1 ≠ µ 2). Again, when the p-value is less than or equal to your significance level, reject the null hypothesis. The difference between the two means is statistically significant.

  5. 11.3: The Independent Samples t-test (Student Test)

    To construct a hypothesis test that handles this scenario, we start by noting that if the null hypothesis is true, then the difference between the population means is exactly zero, μ 1 −μ 2 =0 As a consequence, a diagnostic test statistic will be based on the difference between the two sample means. Because if the null hypothesis is true ...

  6. An Introduction to t Tests

    When to use a t test. A t test can only be used when comparing the means of two groups (a.k.a. pairwise comparison). If you want to compare more than two groups, or if you want to do multiple pairwise comparisons, use an ANOVA test or a post-hoc test.. The t test is a parametric test of difference, meaning that it makes the same assumptions about your data as other parametric tests.

  7. Independent Samples T Test: Definition, Excel & SPSS Steps

    Determine if your test is one-tailed or two-tailed. Specify an alpha level. Step 1: Open the worksheet with the data you want to perform the t test in SPSS. Step 2: Define the SPSS variables you want to perform a t-test on. For example, you might want to compare GPAs between male and female high school students.

  8. Independent Samples T-Test

    An independent samples t-test evaluates if 2 populations have equal means on some variable. If the population means are really equal, then the sample means will probably differ a little bit but not too much. Very different sample means are highly unlikely if the population means are equal. This sample outcome thus suggest that the population ...

  9. Section 3.3: Independent T-test Assumptions, Interpretation, and Write

    Independent T-test Write-Up. You will need to report the Means and SD for each group, along with the t test statistic (t), its p value, and its effect size d. It is common in many formats to round your decimal places to two. Therefore, a Write-Up for an Independent T-test should look like this:

  10. Independent-samples t-test using SPSS Statistics

    Under NHST, the independent-samples t-test is used to test the null hypothesis that there is no mean difference between your two groups in the population, based on the data from your two samples. For example, it tests the null hypothesis that there is no mean difference in weekly screen time between male and female students in the population.

  11. T-test and Hypothesis Testing (Explained Simply)

    Student's t-tests are commonly used in inferential statistics for testing a hypothesis on the basis of a difference between sample means. However, people often misinterpret the results of t-tests, which leads to false research findings and a lack of reproducibility of studies. This problem exists not only among students.

  12. T Test (Student's T-Test): Definition and Examples

    The null hypothesis for the independent samples t-test is μ 1 = μ 2. So it assumes the means are equal. With the paired t test, the null hypothesis is that the pairwise difference between the two tests is equal (H 0: µ d = 0). Paired Samples T Test By hand. Example question: Calculate a paired t test by hand for the following data:

  13. Independent t-test using SPSS Statistics

    Note: If you have more than 2 treatment groups in your study (e.g., 3 groups: diet, exercise and drug treatment groups), but only wanted to compared two (e.g., the diet and drug treatment groups), you could type in 1 to Group 1: box and 3 to Group 2: box (i.e., if you wished to compare the diet with drug treatment). Click the button.; If you need to change the confidence level limits or change ...

  14. How to Write a Null Hypothesis (5 Examples)

    Whenever we perform a hypothesis test, we always write a null hypothesis and an alternative hypothesis, which take the following forms: H0 (Null Hypothesis): Population parameter =, ≤, ≥ some value. HA (Alternative Hypothesis): Population parameter <, >, ≠ some value. Note that the null hypothesis always contains the equal sign.

  15. Null & Alternative Hypotheses

    The null and alternative hypotheses offer competing answers to your research question. When the research question asks "Does the independent variable affect the dependent variable?": The null hypothesis ( H0) answers "No, there's no effect in the population.". The alternative hypothesis ( Ha) answers "Yes, there is an effect in the ...

  16. Independent Sample T-Test

    Null Hypothesis: It is assumed when the means of the two groups are not significantly different. b. ... Independent sample t-test statistics table: In this table, the first test will be Levene's test, which is used to test the assumptions of equal variance between all the groups in the independent sample t-test. Significance value of F is ...

  17. Two Sample t-test: Definition, Formula, and Example

    A two-sample t-test always uses the following null hypothesis: H 0: ... and 0.01) then you can reject the null hypothesis. Two Sample t-test: Assumptions. For the results of a two sample t-test to be valid, the following assumptions should be met: The observations in one sample should be independent of the observations in the other sample.

  18. Hypothesis Testing

    Present the findings in your results and discussion section. Though the specific details might vary, the procedure you will use when testing a hypothesis will always follow some version of these steps. Table of contents. Step 1: State your null and alternate hypothesis. Step 2: Collect data. Step 3: Perform a statistical test.

  19. SAS Tutorials: Independent Samples t Test

    The null hypothesis (H 0) and alternative hypothesis (H 1) of the Independent Samples t Test can be expressed in two different but equivalent ways:H 0: µ 1 = µ 2 ("the two population means are equal") H 1: µ 1 ≠ µ 2 ("the two population means are not equal"). OR. H 0: µ 1 - µ 2 = 0 ("the difference between the two population means is equal to 0") H 1: µ 1 - µ 2 ≠ 0 ("the difference ...

  20. How to Report T-Test Results (With Examples)

    Note: The "M" in the results stands for sample mean, the "SD" stands for sample standard deviation, and "df" stands for degrees of freedom associated with the t-test statistic. The following examples show how to report the results of each type of t-test in practice. Example: Reporting Results of a One Sample T-Test. A botanist wants ...

  21. How to Write a Null Hypothesis (with Examples and Templates)

    Write a statistical null hypothesis as a mathematical equation, such as. μ 1 = μ 2 {\displaystyle \mu _ {1}=\mu _ {2}} if you're comparing group means. Adjust the format of your null hypothesis to match the statistical method you used to test it, such as using "mean" if you're comparing the mean between 2 groups.

  22. Hypothesis Testing : Independent T-Test

    Hypothesis Testing : Meaning. You have sample data and you are asked to assess the credibility of a statement about population using sample data. In other words, we use a random sample of data taken from a population to describe and make inferences about the population. For example, Indian Government wants to know about response of its citizens ...

  23. Hypothesis Testing with Examples & Python Code

    In this scenario, we employ a 2 tailed independent sample t-test. However, in our case, we want to prove that we scored higher than the average. Hence, we need to be above the mean. This calls for a 1 tailed independent sample t-test. 😲 This is a lot of information to grasp if you are a beginner.

  24. Solved A researcher wants to determine if there is a

    Use an independent samples t-test with the null hypothesis that the mean of Group A is equal to the mean of Group B and the alternative hypothesis that the mean of Group A is not equal to the mean of Group B.

  25. Paired Samples t-test: Definition, Formula, and Example

    If the p-value that corresponds to the test statistic t with (n-1) degrees of freedom is less than your chosen significance level (common choices are 0.10, 0.05, and 0.01) then you can reject the null hypothesis. Paired Samples t-test: Assumptions. For the results of a paired samples t-test to be valid, the following assumptions should be met: