Statistics From Scratch by Rob Brotherton

12  Independent-samples \(t\) test

  • Introduction
  • 1  Variables & Measurement
  • 2  Frequency
  • 3  Central Tendency
  • 4  Variability
  • 5  \(z\)-Scores
  • 6  Probability
  • 7  Sampling
  • 8  Hypothesis Testing
  • 9  Statistical Power
  • 10  Confidence Intervals
  • 11  The \(t\) test
  • 12  Independent-samples \(t\) test
  • 13  Related-samples \(t\) test
  • 14  ANOVA
  • 15  Related-samples ANOVA
  • 16  Factorial ANOVA
  • 17  Correlation
  • 18  Regression
  • References

Table of contents

  • Compared with what?
  • From one sample to two
  • The independent-samples \(t\) statistic
    • The denominator: uncertainty from both groups
    • Degrees of freedom
    • Putting it all together
  • An independent-samples \(t\) test, step by step
    • Step 1: State the hypotheses
    • Step 2: Set the decision criteria
    • Step 3: Collect and analyze the data
    • Step 4: Make a decision
    • Step 5: Estimate the effect, interval, and power
  • Reporting and interpreting the results
    • Reporting results
    • Interpreting the results
    • Assumptions of the independent-samples \(t\) test
  • Summary

12  Independent-samples \(t\) test

Two differently colored block distributions building up from their baselines.

In the last chapter we introduced the single-sample \(t\) statistic. Here, we’ll move on to another variant: the independent-samples \(t\). We’ll compare the two to see what’s new and what’s the same. Then we’ll use it to analyze some data, seeing how the hypothesis test works and what it tells us.

Compared with what?

To refresh your memory of the single-sample \(t\) statistic, suppose we’re interested in whether money can buy happiness. We run a study in which we take a sample of people and give them all $10. After they’ve had a chance to spend it, we ask how happy they feel compared with usual, using a seven-point scale.

Here’s $10! 💵

A seven-point Likert response scale.

How can we determine if the small cash gift affected our participants’ self-reported happiness? To do the kind of hypothesis test we did in the previous chapter we need a reference value for the null hypothesis. One potential candidate would be the midpoint of the scale, 4, labeled “About average.” It’s not a known population mean, just a guess based on the scale’s wording; if the money had no effect at all, perhaps people would report average happiness levels, on average.1 We don’t know how variable scores in that hypothetical population might be, so the single-sample \(t\) test would be the right tool.

But there are a lot of different things you can do with your money. Spending a little windfall one way might make you happier than spending it another way. So now imagine we create two different samples of people. Everyone in one sample is given $10 and told to spend it on something for themselves—an iced coffee or a sandwich or a magazine or whatever they like. Everyone in the other sample is also given $10, but they are told to spend it on someone else. Later we ask everyone in both groups how happy they feel compared with usual. (This isn’t a purely hypothetical example, by the way: researchers really have run studies like this to see whether prosocial spending makes people feel happier, e.g., Dunn et al. (2014). We’ll return to what their results show later in the chapter.)

Spend this on yourself 💵

Seven-point Likert response scale for the spend-on-yourself group.

Spend this on someone else 💵

Seven-point Likert response scale for the spend-on-someone-else group.

What changes with two groups?

0 of 3
1

When we gave everyone the same ten dollars, we needed a reference value for the null hypothesis, like the scale’s midpoint of 4, and we couldn’t be sure it was right. What does the two-group study let us do instead? You don’t need any formulas yet; just think about the design.

Response options

Compare the two groups with each other, so we don’t need to guess either population mean.

Find out whether getting ten dollars makes people happier than average.

Pin down the exact average happiness of people who are given ten dollars.

Answer

Compare the two groups with each other, so we don’t need to guess either population mean.

Explanation

Each group serves as the other’s point of comparison, so we no longer have to guess what untreated people would score. The design also asks a sharper question: not whether getting money matters, but whether how you spend it does.

2

Suppose how people spend the money makes no difference to their happiness. What would we expect?

Response options

Both population means would equal 4.

The two population means would equal each other, whatever that value happens to be.

The two sample means would come out exactly equal.

Hint

Think about the populations, not the samples. And remember what sampling error does to sample means.

Answer

The two population means would equal each other, whatever that value happens to be.

Explanation

A null hypothesis for this design doesn’t need a number for either population mean; it only says the two are the same. Each sample still supplies its own mean, though, and sampling error means those two sample means would differ a little even if the null were true. So what we’ll want to look at is the difference between the two sample means, and how far it is from zero.

3

In the single-sample \(t\) test, one sample’s standard deviation gave us our estimate of sampling error. Now each group gives us its own standard deviation. How might you combine them into a single estimate of how much scores vary? Would you treat them equally if one group had 50 people and the other had 5? Jot down your thoughts; you don’t need a formula.

Explanation

Averaging the two is a reasonable place to start. But a larger sample gives a more trustworthy estimate of variability, so perhaps it should count for more. That’s the idea behind pooling variability, which we’ll formalize shortly. And notice that the difference between two sample means wobbles with both groups’ sampling error, so we should expect more uncertainty than we’d have with a single mean.

Quiz 12.1

With this design, we don’t have a reference value for either population mean. Luckily, we don’t need them. We compare the two sample means with each other. We have two samples representing two hypothetical populations; the null hypothesis doesn’t name a value for either population mean, it just says that there’s no difference between them.

From one sample to two

The kind of research I’m describing is an experiment. The researchers deliberately change something, called a manipulation, to see whether it has an effect. Here, the manipulation is the spending instruction; everything else, like the amount of money and the wording of the happiness question, is the same for everyone. Which group each person ends up in might be decided by a random process, like a coin flip. That’s called random assignment. (But randomization is a design choice rather than a requirement of this \(t\) statistic; the same analysis can be used to compare groups that aren’t or can’t be randomly assigned. We’ll talk about the implications for how we interpret the results later in the chapter.)

Each participant belongs to one sample or the other, not both. A study set up this way is called a between-participants design, because the comparison is made between different groups of people. Nothing links a particular score in one group to a particular score in the other, so we call these independent samples.

The independent-samples \(t\) test allows us to compare two sample means and determine whether their difference is statistically significant. Chance can make the group means differ a bit, even if the manipulation doesn’t do anything. That’s what the test statistic has to account for.

Figure 12.1 shows this logic, using the same kind of diagram as Figure 11.3. The two samples are drawn from some original population. (The diagram shows it twice to avoid a more awkward layout, but theoretically everyone in both samples comes from the same single population to begin with.) The treatment splits participants into two independent samples. Each treated sample represents a hypothetical treated population—what happiness would look like if the whole population spent their money that way. In the single-sample test, we compared one treated population with a reference population. Now neither population mean is specified in advance; we compare the two treated populations with each other. The null hypothesis says they’re the same, \(\mu_1 - \mu_2 = 0\), and our evidence is the difference between the sample means, \(M_1 - M_2\).

Figure 12.1: A diagram representing the logic of the independent-samples \(t\) test. Two samples from the original population receive different treatments. Each treated sample stands for an unknown treated population, and the null hypothesis says those populations have the same mean.
Two samples from the original population receive different treatments; inference from each treated sample to its unknown treated population; do the treated populations have the same mean (μ₁ − μ₂ = 0)? The samples are compared by M₁ − M₂.

The independent-samples \(t\) statistic

Every \(t\) statistic has the same basic conceptual structure:

\[ t = \frac{\text{sample statistic} - \text{population parameter}}{\text{estimated standard error}} \tag{12.1}\]

The numerator compares what we observed (the sample statistic) with what the null hypothesis predicted (the population parameter). The denominator says how big a difference we’d expect from sampling error alone. So \(t\) tells us how many standard errors separate our data from our hypothesis. We used the single-sample \(t\) test in the previous chapter, and we’ll meet a third in the next, but they all stick to this basic template.

For the single-sample \(t\) test, the statistic was the sample mean, the parameter was the population mean specified by the null hypothesis, and the standard error was estimated from the sample’s standard deviation and size (Equation 11.2):

\[ t = \frac{M - \mu_0}{s_M} \]

For the independent-samples \(t\) statistic, filling in the template gives us this new equation:

\[ t = \frac{(M_1 - M_2) - (\mu_1 - \mu_2)}{s_{M_1 - M_2}} \tag{12.2}\]

If you ignore the subscripts and repeated symbols, it’s the same structure as the single-sample \(t\): \(M\) minus \(\mu\) over \(s\). But there is a bit more going on, so let’s break it down:

  • The statistic. Each sample provides a mean, and our question is about the difference between them, so the statistic becomes the difference between the two sample means, \((M_1 - M_2)\).
  • The parameter. The null hypothesis doesn’t tell us the value of either population mean, only that there’s no difference between them. So the parameter we subtract is \((\mu_1 - \mu_2)\). This takes the place of the null \(\mu_0\) reference value in the single-sample test. The subscripts here just number the two groups, not the null or alternative means. When the null hypothesis is about a difference, it generally specifies a value of zero, so rather than give it a symbol of its own, we write the null hypothesis statement in the form of the subtraction, \(H_0: \mu_1 - \mu_2 = 0\).
  • The standard error. A standard error describes the variability of a statistic—the distribution of that statistic we’d see if we repeated the process many times. Here the statistic isn’t a single mean, or the two separate means, but the difference between them. So we call this the estimated standard error of the mean difference, and the symbol gets that in its subscript: \(s_{M_1 - M_2}\).

Before we look at how to calculate each piece, let’s see what they look like in action.

Activity 12.1: What goes into the \(t\) statistic
Happiness ratings for the two spending groups. Spend on self: 1, 3, 4, 5, 7, mean 4, SD 2.24. Spend on other: 3, 4, 5, 6, 7, mean 5, SD 1.58. The difference between the means is 1 point. Pooled SD 1.94; standard error of the difference 1.22.

Let’s say we’ve had ten people participate in our spending study; five spent some money on themselves and five spent some money on someone else. Their subsequent happiness ratings on the 7-point scale are shown on the number lines: 10 different colored dots for the 10 different participants. (These scores aren’t real; I just made them up for illustration.)

Now let’s compute the sample means. Rather than comparing ten individual scores, we summarize each group by its mean: 4 for the spend-on-self group and 5 for the spend-on-other group.

This difference gives the numerator of our \(t\) statistic, \(M_1 - M_2\). Here that’s spend on other minus spend on self: \(5 - 4 = 1\). Remember, there’s no specified value for either population mean; rather, we compare that statistic with a null hypothesis that says \(\mu_1 - \mu_2 = 0\). While subtracting that zero is important conceptually, mathematically it doesn’t affect the value of the numerator.

Each sample also has its own standard deviation: in this case, 2.24 and 1.58 points. Both samples’ variability contributes to the uncertainty in the difference between their means, so we need a way of combining them.

We assume the two populations have the same variance; their estimates of variability only differ due to sampling error. So we “pool” their variances to get a better estimate of the common population variance. This is shown here as the pooled standard deviation, which is 1.94 points. (It’s not exactly halfway between the two individual SDs because we average the variances rather than the SDs, which pulls the answer toward the larger one.)

The actual denominator of our \(t\) statistic is the standard error of the mean difference, which, like other kinds of standard error, depends not only on the population variability estimate, but also on sample size. Taking the sample sizes into account shrinks the pooled SD to \(s_{M_1-M_2} \approx 1.22\) points. That value estimates how much the difference between means would vary across repeated pairs of independent samples.

So we have our ratio. We can divide the numerator by the denominator to change the ruler to standard errors. This places the observed difference at \(t = 1/1.22 \approx 0.82\), less than one estimated standard error above zero.

The denominator: uncertainty from both groups

The denominator, \(s_{M_1 - M_2}\), is the estimated standard error of the mean difference: how much of a difference we’d expect to see between two sample means by chance alone. Here’s the equation:

\[ s_{M_1 - M_2} = \sqrt{\frac{s_p^2}{n_1} + \frac{s_p^2}{n_2}} \tag{12.3}\]

Think back to the standard error for a single sample. We calculated it as \(s / \sqrt{n}\), which is the same thing as the square root of the variance divided by \(n\), \(\sqrt{s^2 / n}\). This looks similar, except that there are two terms under the square root, one for each sample. That’s because each sample mean has its own sampling error. \(M_1\) will vary around its population mean from sample to sample, and so will \(M_2\). The difference between the means inherits both variances; adding a term for each sample accounts for both sources of sampling error. (It’s the variances that add up, not the standard deviations, which is why the addition happens inside the square root.)

Each term divides a variance by a sample size, just like before. But instead of each sample’s own variance, both terms use the same unfamiliar symbol, \(s_p^2\).

Pooled variance

So what is that? Well, you know that \(s^2\) usually refers to a variance, and this is no different. The subscript \(p\) stands for pooled. This is the pooled variance: the variances of our two samples combined into a single estimate of the population variance.

Why one estimate rather than two? The version of the \(t\) test we’re learning here assumes that the two populations have the same variance. Our hypothesis is about the treatment potentially shifting the population means apart, but we assume that it doesn’t change their variability. (We’ll look at that assumption more closely, and what to do if it seems doubtful, at the end of the chapter.)

If there’s a single population variance, each sample gives us an estimate of it, and we pool those estimates together to come up with the best possible guess. The pooled variance is just a weighted average of the two samples’ variances.

Recall that a single sample’s variance is calculated as the sum of squared deviations divided by the degrees of freedom: \(SS / df\). We calculate pooled variance by adding up both samples’ sums of squares and dividing by the total of their degrees of freedom.

\[ s_p^2 = \frac{SS_1 + SS_2}{df_1 + df_2} \tag{12.4}\]

Another form of the equation uses the samples’ variances rather than their sums of squares:

\[ s_p^2 = \frac{df_1 s_1^2 + df_2 s_2^2}{df_1 + df_2} \]

That is algebraically equivalent to the sums of squares version, because \(SS\) is equal to variance multiplied by degrees of freedom. This version makes the weighting explicit: each sample’s variance counts in proportion to its degrees of freedom. Bigger samples provide more accurate estimates, so they count for more.

Degrees of freedom

As we saw in Chapter 11, the particular \(t\) distribution a \(t\) statistic belongs to depends on degrees of freedom. Here each of the two samples has its own degrees of freedom, so the resulting \(t\) combines those as well.

Recall that degrees of freedom count the deviations that are free to vary when we estimate variability. For a single sample, \(df = n - 1\): once the sample mean is fixed, the deviations from it must sum to zero, so if we know \(n - 1\) of them, the last is determined.

Here, we estimate variability from two samples. The deviations in sample 1 are measured from \(M_1\), so they must sum to zero, and that costs one degree of freedom. The deviations in sample 2 are measured from \(M_2\), so they must sum to zero too, and that costs another. So we lose one degree of freedom for each sample:

\[ df = df_1 + df_2 = (n_1 - 1) + (n_2 - 1) = n_1 + n_2 - 2 \tag{12.5}\]

These are the same degrees of freedom in the denominator of the pooled variance, Equation 12.4. They determine which \(t\) distribution we use, and so our critical values, which we can find in the same \(t\) table we used for the single-sample \(t\) test.

Putting it all together

Table 12.1 lines up the pieces of the two \(t\) statistics we’ve seen so far.

Table 12.1: The pieces of the single-sample and independent-samples \(t\) statistics. Both follow the structure of Equation 12.1.
Single-sample \(t\) Independent-samples \(t\)
Sample statistic \(M\) \(M_1 - M_2\)
Parameter under \(H_0\) \(\mu_0\) \(\mu_1 - \mu_2 = 0\)
Variability estimate \(s^2\) \(s_p^2\) (pooled)
Estimated standard error \(s_M\) \(s_{M_1 - M_2}\)
Degrees of freedom \(n - 1\) \((n_1 - 1) + (n_2 - 1)\)

Putting these pieces together per Equation 12.2 gives us the usual ratio: how many standard errors separate the difference we observed from the difference the null hypothesis predicts. If the null hypothesis were true and we repeated the study many times, the \(t\) statistics would be centered on zero—sometimes positive, sometimes negative, mostly within a couple of standard errors of zero. The farther our \(t\) statistic lands from zero, the more difference we saw over and above that expected by chance alone, and the more convincing the evidence of a treatment effect becomes.

An independent-samples \(t\) test, step by step

So let’s run with the example of giving two different groups of people $10, telling one group to spend it on themselves and the other group to spend it on someone else. We’ll analyze the same little set of 10 happiness ratings we looked at in Activity 12.1, practicing using these new calculations and the five steps of hypothesis testing in the context of independent samples.

Step 1: State the hypotheses

The null hypothesis says that the two population means are the same: \(\mu_1 - \mu_2 = 0\). Which sample we call 1 and which we call 2 is arbitrary; swapping them only flips the sign of the difference. Here we’ll call the spend-on-other group sample 1 and subtract the spend-on-self group’s mean, so higher ratings for spending on others give a positive difference.

We’ll use a nondirectional alternative, looking for a difference in either direction. (As usual, a directional test would need to be justified and chosen before inspecting the data.) So our hypotheses can be stated as:

\[ H_0: \mu_{\text{other}} - \mu_{\text{self}} = 0 \]

\[ H_1: \mu_{\text{other}} - \mu_{\text{self}} \ne 0 \]

Step 2: Set the decision criteria

As before, our degrees of freedom determine which \(t\) curve we use to set the critical regions.

We’ll use \(\alpha = .05\). With five people in each group, \(df = 4 + 4 = 8\) (Equation 12.5). Looking in the two-tailed .05 column of the \(t\) table gives critical values of \(\pm 2.306\). We reject the null if \(t < -2.306\) or \(t > 2.306\).

Table 12.2: An excerpt of the \(t\) table, with the \(df = 8\) row highlighted. The two-tailed \(.05\) heading puts \(.025\) in each tail.
t table excerpt for 6 through 10 degrees of freedom, highlighting the two-tailed .05 critical value of 2.306 at df = 8.

Step 3: Collect and analyze the data

Step three is where we get our data and calculate our test statistic. Here are the happiness scores for our two groups of five, the same ones we saw in Activity 12.1.

Figure 12.2: Happiness ratings for the two spending groups.
Happiness ratings for the two spending groups. Spend on self: 4, 1, 7, 3, 5. Spend on other: 6, 3, 5, 7, 4.

To calculate the pooled variance, we’ll need each sample’s sum of squares (or variance, or standard deviation; they’re all closely related). Figure 12.3 shows the calculations for each sample, using the definition approach we first used in Chapter 4. The spend-on-other group is sample 1, with \(SS_1 = 10\); the spend-on-self group is sample 2, with \(SS_2 = 20\). The standard deviations are the same ones we saw in Activity 12.1.

Figure 12.3: Deviations, sums of squares, variances, and standard deviations for the two spending groups.
Variability tables for the two spending groups. Spend on other: scores 6, 3, 5, 7, 4; mean 5; SS = 10; variance 2.5; SD 1.58. Spend on self: scores 4, 1, 7, 3, 5; mean 4; SS = 20; variance 5; SD 2.24.

First, we pool the variances (Equation 12.4):

\[ s_p^2 = \frac{SS_1 + SS_2}{df_1 + df_2} = \frac{10 + 20}{4 + 4} = 3.75 \]

Then we use the pooled variance to compute the estimated standard error of the mean difference (Equation 12.3):

\[ s_{M_1 - M_2} = \sqrt{\frac{s_p^2}{n_1} + \frac{s_p^2}{n_2}} = \sqrt{\frac{3.75}{5} + \frac{3.75}{5}} = \sqrt{1.5} \approx 1.225 \]

Then we can put that estimated standard error into the denominator and we have our \(t\) statistic:

\[ t = \frac{M_1 - M_2}{s_{M_1 - M_2}} = \frac{5 - 4}{1.225} \approx 0.82 \]

Table 12.3: Summary statistics for the spending test. Sample 1 is the spend-on-other group; sample 2 is the spend-on-self group.
Quantity Symbol Spending data
Sample sizes \(n_1\), \(n_2\) 5, 5
Sample \(df\)s \(df_1\), \(df_2\) 4, 4
Sample means \(M_1\), \(M_2\) 5, 4
Sums of squares \(SS_1\), \(SS_2\) 10, 20
Pooled variance \(s_p^2\) \(3.75\)
Estimated standard error \(s_{M_1 - M_2}\) \(1.225\)
Degrees of freedom for \(t\) \(df = df_1 + df_2\) \(8\)

Step 4: Make a decision

Our \(t = 0.82\) falls between the critical values of \(\pm 2.306\) we found in Step 2, so we fail to reject the null hypothesis.

Figure 12.4: The observed \(t = 0.82\) falls between the critical values of the null \(t\) distribution with \(df = 8\).
Null t distribution with 8 degrees of freedom. The two rejection regions lie beyond ±2.306; the observed t of 0.82 falls between them.

The corresponding two-tailed \(p\)-value is approximately \(.44\), well above our \(\alpha\) of \(.05\).

Phew! That was a lot of work. Now you can try the same calculations with some different data.

Practice an independent-samples \(t\) test

0 of 5
1

A study compares two independent samples. Sample 1 has \(n_1 = 5\) and a variance of \(s_1^2 = 4\). Sample 2 has \(n_2 = 9\) and a variance of \(s_2^2 = 10\). What is the pooled variance, \(s_p^2\)?

Hint

Weight each variance by its degrees of freedom, or convert each variance back to a sum of squares (\(SS = df \times s^2\)) first.

Answer

8

Explanation

\(SS_1 = 4 \times 4 = 16\) and \(SS_2 = 8 \times 10 = 80\), so \(s_p^2 = (16 + 80)/(4 + 8) = 96/12 = 8\). A simple average of the two variances would give 7. The pooled variance is closer to 10 because the second sample is larger, so its estimate counts for more.

2

Continuing with the same two samples (\(n_1 = 5\), \(n_2 = 9\), and the pooled variance you found in the previous question), what is the estimated standard error of the mean difference, \(s_{M_1 - M_2}\)?

Answer

1.58

Explanation

\(s_{M_1 - M_2} = \sqrt{8/5 + 8/9} = \sqrt{1.6 + 0.889} = \sqrt{2.489} \approx 1.58\).

3

The sample means are \(M_1 = 12\) and \(M_2 = 9\). The null hypothesis says \(\mu_1 - \mu_2 = 0\). What is \(t\)?

Answer

1.9

Explanation

\(t = (12 - 9)/1.58 \approx 1.90\).

4

With \(n_1 = 5\) and \(n_2 = 9\), how many degrees of freedom does this test have?

Answer

12

Explanation

\(df = n_1 + n_2 - 2 = 5 + 9 - 2 = 12\).

5

For a two-tailed test with \(\alpha = .05\) and the \(df\) you found in question 4, the critical values are \(\pm 2.179\). With the \(t\) you calculated in question 3, what decision should you make?

Response options

Fail to reject the null hypothesis

Reject the null hypothesis

Answer

Fail to reject the null hypothesis

Explanation

\(t = 1.90\) doesn’t reach the critical value of 2.179, so it isn’t in either critical region.

Quiz 12.2

Step 5: Estimate the effect, interval, and power

As in Chapter 11, we aren’t quite done once we’ve made our decision. With a nonsignificant result, these estimates are still important. A nonsignificant result doesn’t mean that no effect exists, but rather that our data don’t provide strong enough evidence to conclude that an effect exists. Effect size and the confidence interval can give a sense of what our data can and can’t rule out, and statistical power can help us plan for future studies.

Effect size

For the independent-samples \(t\) test, Cohen’s \(d\) divides the difference between the sample means by the pooled standard deviation—the square root of the pooled variance:

\[d = \frac{M_1 - M_2}{\sqrt{s_p^2}} = \frac{5 - 4}{\sqrt{3.75}} \approx 0.52\]

By Cohen’s rough benchmarks, a difference of half a standard deviation would be a medium-sized effect; by Funder and Ozer’s (2019) it would actually be considered quite large. Of course, with five people per group, this estimate is very imprecise, as the confidence interval will show.

Confidence interval

We can calculate a confidence interval much as we did for the single-sample \(t\) test. The difference here is that our interval isn’t for a particular population mean, but for the difference between two population means, \(\mu_1 - \mu_2\). The formula takes the same form as before, using our new estimate and its estimated standard error:

\[ (M_1 - M_2) \pm t \times s_{M_1 - M_2} \]

For a 95% interval, we use the same critical value, \(2.306\), as our two-tailed test at \(\alpha = .05\).

\[ (M_1 - M_2) \pm t \times s_{M_1 - M_2} = 1 \pm 2.306(1.225) \approx [-1.82,\ 3.82] \]

Figure 12.5: The 95% \(t\) interval for the difference between population means includes zero, agreeing with the two-tailed test at \(\alpha = .05\).
95% t confidence interval for the difference in mean happiness rating: −1.82 to 3.82, with point estimate 1. The null value of 0 lies inside the interval.

Notice here that the confidence interval includes a mean difference of zero within its limits. Our hypothesis test failed to reject the null hypothesis because our \(t = 0.82\) was not among the most extreme 5% of values in the null \(t\) distribution. As we saw in Chapter 10, a 95% interval and a two-tailed test at \(\alpha = .05\), using the same standard error, will always agree in this way.

But notice also how wide the interval is. It runs from almost 2 points favoring spending on yourself to almost 4 points favoring spending on someone else, on a 7-point scale. Our data are compatible with no difference, and with sizable differences in either direction. So our nonsignificant result here means “uncertain,” not necessarily “no difference.”

Statistical power

Remember that plugging the result we observed back into a power calculation, observed power, doesn’t really add any new information (Chapter 11). As we said in Chapter 9, power is more useful for planning.

Say we consider a difference of one point on the 7-point scale worth detecting, in either direction. For two equally sized groups, we would use the sample-size equation from Chapter 9 (Equation 9.2), with one change:

\[ n \approx \frac{2\left(z_{1-\alpha/2} + z_{1-\beta}\right)^2}{d^2} \]

The numerator gets multiplied by 2 because both groups contribute sampling error, just as both contributed a term to the standard error of the mean difference. The \(n\) this calculation gives us is the number of people per group.

Here, \(d\) is the hypothesized difference in standard deviation units, so we need a value for the population standard deviation. We still don’t know it, but our pooled standard deviation gives us an estimate, \(\sqrt{3.75} \approx 1.94\). A difference of one point is then \(d = 1/1.94 \approx 0.52\). For a two-tailed test with \(\alpha = .05\) and power of .80:

\[ n \approx \frac{2(1.96 + 0.84)^2}{0.516^2} \approx 58.9 \]

Rounding up, that’s 59 people per group, or 118 in total; two-group designs need more people than a single-sample test to detect the same \(d\).2 As before, we might still want to aim higher because of the uncertainty in our estimate of the population standard deviation. If the population standard deviation is larger than our samples here suggested, a study with 59 per group would actually have less power than we intended, so it can be prudent to aim for more than the calculations would suggest.

Reporting and interpreting the results

Reporting results

A nonsignificant result still needs all the relevant information to be reported. Here’s how we might report ours:

A two-tailed independent-samples \(t\) test comparing ratings of happiness relative to usual for people who spent the money on someone else (\(M = 5\), \(SD = 1.58\)) and people who spent it on themselves (\(M = 4\), \(SD = 2.24\)) found a nonsignificant difference, \(M_1 - M_2 = 1.00\), 95% CI [-1.82, 3.82], \(t(8) = 0.82\), \(p > .05\), \(d = 0.52\).

As in Chapter 11, you should report the kind of hypothesis test, the descriptive statistics, the estimate with its confidence interval, the test statistic and its degrees of freedom in parentheses, whether \(p\) fell below \(\alpha\), and the effect size.

Interpreting the results

So what does it mean, that we failed to reject our null hypothesis here? Not that we have established that spending makes no difference to happiness. As the confidence interval shows most clearly, our data are compatible with no difference, but also with sizable differences in either direction. Five people per group just can’t tell those possibilities apart; we’d need something like 59 per group to reliably detect a difference of one point.

Had we found a significant difference, though, this design could potentially let us say more than the class reaction time study in Chapter 11 could. There, the class wasn’t assigned to study statistics, so we had to consider alternative explanations for the difference. Here, supposing we randomly assigned people to their spending condition, the groups should differ, on average, only in how they spent the money. Random assignment rules out many alternative explanations.

This kind of design and statistical test also works without random assignment. If we let people choose which way to spend their money, we could still compare the samples this way. But the groups might differ in other ways. Maybe generous people would choose to spend on someone else, and maybe generous people are happier to begin with (cf. Dickens, 1843). With random assignment, people who happen to be cheerful, or having a bad day, or whatever, are just as likely to end up in either group, so the only systematic difference between the groups is the one we created. Sometimes researchers want to compare groups that can’t be randomly assigned, like men and women, or people who voted for one political party or another, or something like that. The independent-samples \(t\) test can still be used, but the results are correlational rather than causal. The two original populations might be different in other ways, as well as the one we’re interested in. A significant result wouldn’t tell us what caused the difference.

That’s not to say that random assignment is always superior, just that it changes what we can conclude. And it doesn’t solve other potential problems. Random assignment doesn’t necessarily make our participants representative of everyone in the population we’re trying to make inferences about, or tell us whether any difference would last beyond that day. Even with a significant result from an experiment with random assignment, we should be cautious about how far the finding might generalize beyond the specific circumstances of the study.

One study, and the body of evidence

The real research I based the prosocial spending example on is a nice illustration of why we always need to look beyond any one result, whatever it shows. An initial experiment with 46 people found significantly greater happiness after spending on others, with an estimated effect of \(d = 0.67\) (Dunn et al., 2008). But its 95% confidence interval, [0.05, 1.27], left plenty of uncertainty about how big the effect might be (Aknin et al., 2020). Later studies used much larger samples. In a 2020 report, an experiment with 712 people using a small payment either to buy treats for themselves or a sick child found a smaller significant effect, \(d = 0.36\). Online experiments asking people to recall past spending initially found a nonsignificant result; then, with a modified procedure and over 5,000 people, a significant but very small effect, \(d = 0.06\) (Aknin et al., 2020). And a closer replication of the original experiment in 2022 found a nonsignificant result on the original happiness measure, but a significant result on an additional, exploratory question about happiness just after the purchase (Kim et al., 2022).3 So any single finding will never be definitive. The question becomes how big a difference we can detect, how precisely we can estimate it, and under what circumstances it appears.

Assumptions of the independent-samples \(t\) test

Interpreting the outcome of a test fairly also depends on whether the assumptions of the test are reasonable. As with the single-sample test, the exact \(t\) reference distribution assumes independent observations from normal populations. The procedure can tolerate some departures from normality, but as we’ve said before, there is no automatic cutoff (at \(n = 30\) or anywhere else). We should check any data for skew, outliers, and any other unusual features.

Note also that single responses on the seven-point rating scale I used for our example can’t form an exactly normal population, and five people per group gives us little protection from departures from that assumption. A real study would need more care about its measurement and distributions. Often participants would respond to several items and researchers analyze the averaged scores, which are more likely to be approximately normal. As we said back in Chapter 1, treating ordinal Likert items as interval scales is common, but not uncontroversial.

As we’ve seen in previous chapters, this test assumes that our scores are independent. This applies to scores within each sample: one person’s score shouldn’t depend on another person’s score. As the name of the test implies, the two samples must also be independent. Nothing pairs a particular score in one group with a particular score in the other; they’re different people, with no matching or other links across groups. That’s what makes these independent samples. (This is the assumption the next chapter will break.)

And third, for this pooled version of the independent-samples \(t\) test, we assume that the two populations from which the samples are selected have equal variances. This is called homogeneity of variance. Pooling treats our two sample variances as estimates of the same population variance. If the two populations actually have different variances, the pooled variance is a compromise that matches neither, and the estimated standard error can be wrong, especially when the sample sizes are unequal.4

Summary

So when we don’t have a reference value for a population mean, we can build the comparison into the design. The basic logic of the test doesn’t change, but we use a version of the \(t\) statistic which takes the difference between two sample means as its statistic, a difference of zero for its null hypothesis parameter, and pools variances and degrees of freedom to account for the combined uncertainty in both samples’ estimates.

Now imagine another design for this kind of research: we could have the same person spend some money on themselves and some money on someone else, and compare their happiness ratings after each purchase. The data would look much the same: two sets of scores. But we’d be violating that assumption of independent samples, because we’d have two scores from each person. Can we modify our approach to the \(t\) statistic again to account for the relatedness? That’s our topic for the next chapter.

Learning Checks

0 of 7
1

A researcher randomly assigns 40 students to study with music or in silence, then gives everyone the same quiz. Which test fits this design?

Response options

An independent-samples \(t\) test

A single-sample \(t\) test, comparing the music group with the scale’s midpoint

A single-sample \(z\) test, because there are 40 students

Answer

An independent-samples \(t\) test

Explanation

There are two groups of different people, and the question is whether their means differ. We don’t need to specify either population mean or know the population standard deviation; the usual null hypothesis says their difference is zero.

2

Why does the standard error of the mean difference include a term for each sample?

Response options

Each sample mean has its own sampling error, and the difference between them inherits both.

Because the two samples always have different variances.

Because the standard error measures the spread of all the individual scores in both groups.

Answer

Each sample mean has its own sampling error, and the difference between them inherits both.

Explanation

Even if the null hypothesis is true, each sample mean wobbles from sample to sample, so their difference wobbles with both.

3

An independent-samples \(t\) test finds a mean difference of 2.3 and a 95% CI of [0.3, 4.3]. What decision does the matching two-tailed test, using the same standard error, make at \(\alpha = .05\)?

Response options

Reject \(H_0\), because zero lies outside the interval.

Fail to reject \(H_0\), because 2.3 lies inside the interval.

Fail to reject \(H_0\), because the interval contains more than one possible difference.

Answer

Reject \(H_0\), because zero lies outside the interval.

Explanation

A 95% CI that excludes the null value of zero corresponds to \(p < .05\) for a matching two-tailed test. The interval is centered on the observed difference, 2.3; what matters for this decision is whether it includes zero.

4

What does the independent-samples \(t\) test assume about the two populations’ variances?

Response options

They are equal.

They differ by the same amount as their means.

They are equal to the observed sample variances.

Answer

They are equal.

Explanation

The sample variances can differ through sampling error. Pooling treats them as estimates of one common population variance. Welch’s version does not require equal population variances.

5

A small study finds \(t(8) = 0.82\), \(p = .44\), with a 95% CI for the mean difference of \([-1.82, 3.82]\). What’s the best conclusion?

Response options

The data can’t distinguish no difference from a sizable difference in either direction.

The treatment has no effect.

The treatment has an effect, but it isn’t significant.

Answer

The data can’t distinguish no difference from a sizable difference in either direction.

Explanation

A nonsignificant result means the data are compatible with no difference, but the wide interval shows they’re compatible with sizable differences too.

6

A study finds a mean difference of 6, a pooled standard deviation of 3, and an estimated standard error of 1.5. What is Cohen’s \(d\)?

Answer

2

Explanation

\(d = 6/3 = 2\). Dividing by the standard error would give \(t = 4\) for a null difference of zero. Effect size uses the spread of scores; \(t\) uses the uncertainty in the estimate.

7

For a planned study with two equally sized groups, the chapter’s approximate sample-size equation gives \(n = 50\). How many participants should you plan for in total?

Answer

100

Explanation

The equation gives 50 per group, so 100 altogether. This is a planning estimate for the chosen target difference, not a calculation of observed power.

Aknin, L. B., Dunn, E. W., Proulx, J., Lok, I., & Norton, M. I. (2020). Does spending money on others promote happiness?: A registered replication report. Journal of Personality and Social Psychology, 119(2), e15–e26. https://doi.org/10.1037/pspa0000191
Dickens, C. (1843). A Christmas carol. Chapman & Hall. https://www.gutenberg.org/ebooks/46
Dunn, E. W., Aknin, L. B., & Norton, M. I. (2008). Spending money on others promotes happiness. Science, 319(5870), 1687–1688. https://doi.org/10.1126/science.1150952
Dunn, E. W., Aknin, L. B., & Norton, M. I. (2014). Prosocial spending and happiness: Using money to benefit others pays off. Current Directions in Psychological Science, 23(1), 41–47. https://doi.org/10.1177/0963721413512503
Funder, D. C., & Ozer, D. J. (2019). Evaluating effect size in psychological research: Sense and nonsense. Advances in Methods and Practices in Psychological Science, 2(2), 156–168. https://doi.org/10.1177/2515245919847202
Kim, G., Adams, I., Diaw, M., Celly, M., Nelson, L. D., & Jung, M. H. (2022). Prosocial spending encourages happiness: A replication of the only experiment reported in Dunn, Aknin, and Norton (2008). PLOS ONE, 17(9), e0272434. https://doi.org/10.1371/journal.pone.0272434

  1. We’d probably want to validate that somehow, or a significant result might tell us more about that assumption than about the money.↩︎

  2. As in Chapter 11, statistical software can do the exact calculation using the noncentral \(t\) distribution. Here it gives 60 per group.↩︎

  3. Some of the real research also did things like adjusting for happiness measured before the experimental task. Our example simplifies the design and uses illustrative data.↩︎

  4. Many statistical programs, including R, use a version of the test called Welch’s \(t\) test by default, which doesn’t make this assumption. Instead of pooling, it uses each sample’s own variance, \(s_{M_1 - M_2} = \sqrt{s_1^2/n_1 + s_2^2/n_2}\), and adjusts the degrees of freedom according to this equation:

    \[df = \frac{\left(\frac{s_1^2}{n_1}+\frac{s_2^2}{n_2}\right)^2}{\frac{\left(\frac{s_1^2}{n_1}\right)^2}{n_1-1} + \frac{\left(\frac{s_2^2}{n_2}\right)^2}{n_2-1}}\]

    This is not an equation that you have to know or really to understand for our purposes; I’m only showing it here because I like its nice cascading look. But this is why software may report degrees of freedom that aren’t a whole number. For our spending data, Welch’s test gives \(df = 7.20\). (With equal sample sizes, Welch’s \(t\) is the same as ours, \(0.82\), and \(p\) is almost identical, about \(.44\).)↩︎

11  The \(t\) test
13  Related-samples \(t\) test