A grid of nonoverlapping multicolored dots pops into view, aligns at perfect positive correlation, then moves smoothly to a correlation of about 0.6.
In this chapter and the next, we’ll cover the techniques of correlation and regression. Whereas the \(z\), \(t\), and ANOVA statistics we’ve covered so far deal with examining differences between means, correlation and regression focus on associations between variables. As we’ll see, though, this isn’t as big a difference as you might expect. Correlation and regression are just further extensions of the basic idea of variability that has powered all of our inferential statistics so far.
Buying happiness
In Chapter 12, we imagined giving people $10 and telling them to spend it either on themselves or on someone else. I based that idea on a real experiment, in which people randomly assigned to spend a small amount of cash on someone else reported being happier later that day than people assigned to spend it on themselves (Dunn et al., 2008). At the end of the chapter I made a big to-do about how one study is never the final word on anything.
Well, the researchers actually did more than one kind of study. In the same paper, they reported another in which they didn’t give out cash or assign anyone to anything. Instead they just surveyed a representative sample of 632 Americans, asking how happy they were in general and how much they spent in a typical month on gifts for other people and donations to charity.
How might we analyze the data to see whether spending on others goes with being happier? We don’t really have groups to compare in this case, just two answers from each person. I suppose we could make some groups. We could split the sample into people who spent something on others and people who spent nothing, and compare the two groups’ mean happiness with an independent-samples \(t\) test.
But that would throw away a lot of good information. Everyone who spent anything gets lumped together, so we lose any distinction between someone who spent $5 on others and someone who spent $500. There has to be a better way! How might we make use of each person’s actual amount spent?
What do we do with the numbers?
0 of 4
1
Think about someone who spent a lot more on others than the average
person in the sample. If spending on others really does go with being
happier, where would you expect their happiness to be, compared with the
average?
Answer
Above average
Explanation
Probably above average. We can’t be sure about any one person, but if
the two variables go together, being high on one should tend to go with
being high on the other.
2
Now think about someone who spent a lot less on others than
the average person. Where would you expect their happiness to be,
compared with the average?
Answer
Below average
Explanation
Probably below average. It’s the same pattern from the other
direction: low on one variable tends to go with low on the other. So
this person and the one in the last question have something in common.
Each is on the same side of the average for both variables.
3
What about someone who spent about the same as the average person?
Where would you expect their happiness to be, compared with the
average?
Answer
Close to average
Explanation
Probably somewhere close to average. If their spending is right in
the middle, it doesn’t point either way. That also means people like
this don’t tell us much about whether the two variables go together.
It’s the people far from average who show the pattern most clearly.
4
Any ideas how we might turn this idea into a single number that
describes the whole sample? You don’t need a formula; just jot down an
idea.
Explanation
One way would be to count how many people are on the same side of
both averages (above average on both, or below average on both), and how
many are on opposite sides. If the two variables had nothing to do with
each other, those counts should come out roughly even. As we’ll see,
that’s very close to the idea behind the correlation statistic. And as
the last question suggested, we might also want people far from average
to count for more than people close to it.
Quiz 17.1
The idea Quiz 17.1 was getting at is to look at each person’s answers together, not to find a difference between them (like the related-samples \(t\) test did), but to find an association. Take someone who spent more than average on other people. If that person was also happier than average, their two deviations point in the same direction. How about someone who was both a miser and miserable?1 Their deviations point in the same direction too.
Here’s what that idea looks like with some data. (These aren’t the real survey responses, just a handful of made-up people to illustrate.)
Activity 17.1: Same side, opposite sides
Scatterplot of invented data for 20 people: how much each spent on others last month against their happiness. Dashed lines at the two means split the plot into four quarters. People on the same side of both means are shown as solid dots, and people on opposite sides as hollow dots. Fifteen people are on the same side and five are on opposite sides. Two further sets of invented data show no relationship, with ten people on each, and a negative relationship, with seven on the same side and thirteen on opposite sides.
Counting dots in the four sections like this is a rough version of what a correlation does. The real math also takes into account precisely how far each person is from the two means, so that someone far above average on both counts for more than someone only just above. And just as with a difference between group means, we’ll need to know whether an apparent pattern is more than we’d expect by chance.
What would it mean?
Now I know you’re excited to do the math, and we’ll get to it soon. But first, let’s distinguish two closely related terms. A correlation coefficient is the number we’ll calculate to quantify how two variables go together. Correlational also describes a research design. If the researchers had created two groups by letting people choose to spend $10 on themselves or someone else, instead of randomly assigning them, they could have analyzed the data using a \(t\) test rather than a correlation coefficient. But it would be a correlational design nonetheless. If the people who spent their money on someone else were happier, would that tell us the same thing as finding that people randomly assigned to do so were happier?
What would the results mean?
0 of 3
1
Suppose we go back to our initial idea of analyzing the survey data
by comparing people who spent something on others with people who spent
nothing, and the \(t\) test was
significant. How does that compare with a significant result from the
experiment, as evidence that spending on others makes people
happier?
Hint
Think back to Chapter 12. What did random assignment do that the
survey can’t?
Answer
It’s weaker, since people chose how much to spend rather than being
assigned
Explanation
Switching to groups changes the statistic, but not the design. Nobody
was assigned to give or not give, so givers and non-givers might differ
in other ways too, just as generous people might choose to spend on
others in Chapter 12. The results are correlational rather than causal.
A larger, more representative sample helps with other things, like
precision and how far the results generalize, but not with what’s
causing what.
2
Suppose being happy makes people more inclined to spend money on
others. Which study’s result could that explain, even if spending on
others had no effect on happiness at all?
Hint
In the experiment, who decided how each person spent the money?
Answer
Only the survey’s
Explanation
In the survey, a link running in either direction would produce the
same pattern: happier people spending more on others. In the experiment,
the researchers decided who spent the money which way, so people’s
happiness beforehand couldn’t decide their group. Random assignment
spreads happier and less happy people across both conditions. (By
chance, one group could still end up with more happy people. That’s what
the significance test is for.)
3
Suppose spending money on other people doesn’t actually make anyone
happier. Something else does, like people’s total income. How could
differences in income still make it look spending and happiness go
together in the survey?
Hint
Think about what someone’s income might have to do with each answer
they gave, how much they spent on others and how happy they were.
Example answer
Someone with money left over after paying the bills might find it
easier to buy a friend a birthday present or donate to charity. They
might also be happier because they don’t have to worry about making
rent. That could make giving and happiness go together in the survey,
even if the gift didn’t make the giver any happier. Income would be a
third variable that could help explain both answers. One way to see how
much of the link it might explain would be to look at whether people
with similar incomes still show the same pattern.
Quiz 17.2
In the actual survey, people who spent more on others did tend to be happier. Can we conclude that spending on others makes people happier? Not necessarily. Maybe being happier makes people more generous. Or maybe there’s some other explanation. Perhaps people with higher incomes could afford to give more and also tended to be happier. The researchers anticipated that possibility and asked about income, too. Taking it into account (as we’ll learn how to do later in the chapter) barely changed the association.2
That makes income less convincing as a potential explanation, but I’m sure you can think of others. The researchers hadn’t measured everything that might make people both more generous and happier. As Dunn and colleagues put it themselves, “the correlational nature of this design precludes causal inferences.”
That’s why they did the experiment, giving people some money and telling them who to spend it on. But experiments have disadvantages of their own. In everyday life, people aren’t usually handed an envelope of cash and told how to spend it. An experiment can give a causal answer to a narrow, somewhat contrived question. The survey answers a more realistic question, less conclusively. Together they contribute to a body of evidence, but neither is definitive on its own.
The correlation coefficient
Now we can get into the details of the correlation statistic itself. The statistic we’ll use is called Pearson’s \(r\) correlation coefficient, named after Karl Pearson—the statistician Gosset went to study with in Chapter 11. But its development also involved another familiar figure: Francis Galton, whose board of bouncing balls helped us think about sampling in Chapter 7.
Galton was interested in how people’s physical characteristics varied together. Taller people tend to have bigger feet, for example, but not always. How could you put a number on the consistency of the relationship between measurements? Galton had already used the letter \(r\) in his work on regression, the closely related technique we’ll meet in the next chapter. But Pearson developed the mathematical treatment behind the coefficient we use today (Pearson, 1896), which is why it bears his name.
Characteristics
The correlation coefficient is a single number that quantifies the strength and direction of a linear association between two quantitative variables.3 Because of how it’s calculated (as we’ll see shortly), \(r\) can range from \(-1\) to \(1\).
The absolute value quantifies the strength of the relationship, or, in other words, the consistency of the association between the variables. The stronger and more consistent their association, the closer the correlation will be to 1 (or \(-1\)). The weaker and less consistent their relationship, the closer the correlation will be to 0.
The sign, positive or negative, indicates the direction of the correlation. A positive correlation is one for which increases in one variable are associated with increases in the other—or, correspondingly, lower scores on one are associated with lower scores on the other. A negative correlation means that higher scores on one variable are associated with lower scores on the other—that they move in opposite directions.
These characteristics are illustrated in the scatterplots in Figure 17.1.
Figure 17.1: Scatterplots illustrating various correlation coefficients. I’ve drawn an ellipse to summarize the shape of the cloud. The stronger the correlation, the closer the cloud comes to forming a straight line.
Points with r = −1: all the points fall on a downward-sloping straight line and the ellipse collapses to a line.
Point cloud with r = −.50: a broad ellipse stretches downward through the cloud.
Point cloud with r = 0: an approximately circular ellipse shows no upward or downward tendency.
Point cloud with r = .50: a broad ellipse stretches upward through the cloud.
Points with r = 1: all the points fall on a straight line and the ellipse collapses to a line.
At zero, the ellipse in Figure 17.1 is basically a circle, with no upward or downward tendency, meaning that there is no consistent linear relationship between the two variables. As the correlation gets stronger, the ellipse gets longer and thinner. A “perfect correlation” of either \(1\) or \(-1\) means that every change in one variable is accompanied by a proportional change in the other; the dots fall into a straight line, and the ellipse becomes a line. In a sense, the correlation coefficient is a measure of how closely the data points follow a straight-line pattern.4
Calculating \(r\)
Now let’s see how to calculate Pearson’s \(r\). It’s based on the ideas of variability and covariability.
Here’s the equation for Pearson’s \(r\):
\[ r = \frac{SP}{\sqrt{SS_X SS_Y}} \tag{17.1}\]
\(SS_X\) and \(SS_Y\) should look familiar. \(SS\), as usual, refers to the sum of squared deviations, a measure of how scores vary around their mean. So here we have the separate sums of squares for \(X\) and \(Y\) getting combined in the denominator.
The numerator is a new quantity, \(SP\), the sum of products. This quantifies the covariability of \(X\) and \(Y\): the extent to which changes in \(X\) are associated with corresponding changes in \(Y\).
Remember that to calculate \(SS\), we square the deviation scores. And another way of saying that we square something is to say we multiply it by itself. So here are two equivalent ways of writing the equation for sum of squares:
\[ SS = \Sigma(X - M)^2 \]
\[ SS = \Sigma(X - M)(X - M) \]
The reason I point this out is that \(SP\) does something quite similar, but instead of multiplying deviations by themselves, like \(SS\) does, we multiply them by one another, to get the product of the two deviations. Then we sum those products to get the sum of products, \(SP\).
\[ SP = \Sigma(X - M_X)(Y - M_Y) \tag{17.2}\]
With \(SS\) we ask how far the scores on one variable spread around their mean. Some are below their mean, some above, but the squaring makes all the resulting values positive. With \(SP\), in contrast, the products can be positive or negative. Above average on both? Positive. Below average on both? Also a positive product, because we’ll be multiplying two negative deviations. Above on one and below on the other? That will make for a negative product.
So the numerator of Equation 17.1 measures how much \(X\) and \(Y\) vary together, and it can be positive or negative. The denominator combines how much each one varies on its own. Those were squared, so the denominator is always positive, and it requires the square root to put things back into the same units as the numerator.
If there were a perfect correlation, with every point on a straight line, then every deviation on \(X\) would be matched by a proportional deviation on \(Y\). All the variability in \(X\) would be matched by the variability in \(Y\), and vice versa. Those separate variabilities in the denominator would be equal to the covariability in the numerator. This is why \(r\) is bounded between \(-1\) and \(1\): the numerator can be equal to the denominator (or its negative), but its absolute value can never be greater. The more variability that isn’t shared, the smaller \(SP\) gets relative to the denominator, and the closer \(r\) gets to zero.
Worked example
Let’s work through a simple example to see how the sum of products is calculated. Suppose we’re interested in how the number of cups of coffee a student drinks on the morning of a test is related to their score. Maybe the caffeine will increase alertness and cognitive performance, leading to better test scores. We have data for seven students, as shown in Table 17.1.
Table 17.1: Cups of coffee and test scores for seven students.
Participant
Coffee (cups), \(X\)
Test score, \(Y\)
A
\(0\)
\(90\)
B
\(0.5\)
\(60\)
C
\(0.5\)
\(85\)
D
\(1\)
\(65\)
E
\(1.5\)
\(50\)
F
\(1.5\)
\(65\)
G
\(2\)
\(75\)
Before we work through the full calculation, let’s picture the two sums of squares and the sum of products for this little dataset.
Activity 17.2: Picturing sums of squares and products
The tutorial first draws squares for deviations in coffee consumption (SS_X = 3), then test scores (SS_Y = 1200). The coffee and test score scatterplot with dashed lines at the two means, 1 cup and a score of 70. Each student's product of deviations is drawn as a rectangle between their point and the place where the mean lines cross: −20 for student A, 5 for B, −7.5 for C, 0 for D, −10 for E, −2.5 for F, and 5 for G. They sum to SP = −30.
If you’re working by hand, Activity 17.3 is Chapter 4’s deviations table extended to include deviations and squared deviations for both variables. There’s just one new column, for those products. To make it, we multiply each row’s two deviations to get the product, then sum up that column to get \(SP\).
Activity 17.3: The sum of products by hand
A table built a step at a time for the seven students, A to G. Coffee: deviations from the mean of 1 cup (−1, −0.5, −0.5, 0, 0.5, 0.5, 1) and their squares, summing to SS_X = 3. Test score: deviations from the mean of 70 (20, −10, 15, −5, −20, −5, 5) and their squares, summing to SS_Y = 1200. Then each student's two deviations multiplied together, one row at a time: −20, 5, −7.5, 0, −10, −2.5, 5. They sum to SP = −30.
That gives us everything we need to calculate the correlation coefficient:
If \(SP = -30\), \(SS_X = 3\), and \(SS_Y = 400\), what is Pearson’s \(r\)?
Answer
-0.87
Explanation
\(r = \dfrac{SP}{\sqrt{SS_X SS_Y}} =
\dfrac{-30}{\sqrt{3 \times 400}} = \dfrac{-30}{34.64} = -.87\).
The sum of products is the same as in our coffee data, but there’s less
variability in \(Y\) for it to be
compared with, so the correlation is stronger.
Quiz 17.3
A correlation test, step by step
So we’ve calculated a correlation coefficient, \(r\), for our little coffee consumption and test performance data set. The correlation came out negative: drinking more coffee was associated with lower test scores. But is that a significant relationship, or just due to chance? To know that, we need to submit the data to a full hypothesis test, following the same basic procedure we’ve used for every other hypothesis test.
Step 1: State the hypotheses
We use \(r\) for the sample correlation and the Greek letter \(\rho\) (rho) for the population correlation. The null hypothesis sets \(\rho\) to zero. Our nondirectional alternative allows for a linear association in either direction.
\[ H_0: \rho = 0 \]
\[ H_1: \rho \ne 0 \]
So the correlation hypothesis test asks, how likely is it that a correlation as strong as the one we observed would occur if there were no association in the population?
Step 2: Set the decision criteria
This is going to sound weird, but the test statistic for a correlation is actually a \(t\) statistic. Pearson’s \(r\) describes the size of the association in our sample, not how probable it is under the null hypothesis. So to test the null, we turn the \(r\) into a \(t\). We’ll see how in the next step, but for now, we need its degrees of freedom to find the critical \(t\). Its degrees of freedom are \(n - 2\), where \(n\) counts the pairs. Seven students give us seven observations of the relationship, even though we’ve recorded fourteen scores.
Why subtract two? Well, picture just two points on a scatterplot. We wouldn’t need an ellipse around them; we could draw a straight line passing through both, fitting perfectly. The correlation would be one or negative one. There’d be no opportunity for either point to deviate from the line, because those two points determine the line itself. It’s only when we add more observations that we can see any scatter around it. So fitting the line uses up two degrees of freedom, leaving \(n - 2\) deviations free to vary.5
So with seven pairs of scores in our data set, we have \(df = 5\). For our two-tailed test at \(\alpha = .05\), the critical values are \(\pm 2.571\).
Table 17.2: An excerpt of the \(t\) table, with the \(df = 5\) row highlighted. The two-tailed \(.05\) heading puts \(.025\) in each tail.
t table excerpt for 1 through 7 degrees of freedom, highlighting the two-tailed .05 critical value of 2.571 at df = 5.
Step 3: Collect and analyze the data
We already found \(r = -.50\) (Activity 17.3). To test our hypothesis, we need to convert that into a \(t\) statistic. Remember the basic structure of a \(t\) statistic (Equation 12.1)? We subtract a population parameter defined by the null hypothesis from our sample statistic, then divide by a standard error. Here the null says \(\rho = 0\), and our sample statistic is \(r\). The denominator is the standard error of the correlation, \(s_r\).
\[ t = \frac{r - \rho}{s_r} \tag{17.3}\]
The equation for the standard error of the correlation is a little different from the ones we’ve seen before. It depends on the correlation itself, as well as the number of pairs of scores.
Remember how \(\eta^2\) in Chapter 14 told us what proportion of the total variability was accounted for by differences between the groups? \(r^2\) does a similar job for a linear relationship: it tells us the proportion of the variability in one variable that’s shared with the other. For our coffee data, \(r^2 = (-.50)^2 = .25\). So 25% of the variability in test scores is shared with coffee consumption, leaving 75% unaccounted for by that relationship. That’s the \(1 - r^2\) in the numerator.
So the standard error reflects variability left over after accounting for the predictable relationship, divided by the degrees of freedom, with a square root to undo the squaring. A stronger correlation makes the standard error smaller, because there is more predictability and less variability unaccounted for. As with the other standard errors we’ve seen, more observations make it smaller too, because more data gives us a more precise estimate.
Our \(t = -1.29\) falls between the two critical values, so we fail to reject the null hypothesis.
Figure 17.2: The observed \(t = -1.29\) falls between the critical values of the null \(t\) distribution with \(df = 5\).
Null t distribution with 5 degrees of freedom. The two rejection regions lie beyond ±2.571; the observed t of −1.29 falls between them.
The corresponding two-tailed \(p\)-value is approximately \(.25\), well above our \(\alpha\) of \(.05\).
Reporting and interpreting the results
Reporting results
As always, we need to report the results of our hypothesis test. Here, that statement will include the value of the correlation coefficient, Pearson’s \(r\), its degrees of freedom in parentheses, and the \(p\)-value for the correlation.
Drinking more coffee was associated with lower test scores, but the correlation did not reach statistical significance; \(r(5) = -.50\), \(p = .25\).
Interpreting the results
So what can we make of our result? We failed to reject the null hypothesis, but that doesn’t establish that there’s no relationship. We only have seven pairs of scores. Our \(r = -.50\) describes a fairly strong negative association in this sample, but with so few observations, it isn’t strong enough evidence to reject the null.
Same correlation, different samples
Two studies each find a correlation of \(r
= .30\). One has 10 pairs of scores and the other has 100. Using
a two-tailed test with \(\alpha =
.05\), which correlation is statistically significant? Calculate
\(t\) for each study and compare with
the critical values: \(\pm 2.306\) for
10 pairs and \(\pm 1.984\) for 100
pairs.
Hint
The standard error of the correlation has \(n - 2\) in its denominator. What does a
bigger sample do to \(t\)?
Answer
Only the one from the study with 100 pairs
Explanation
With 10 pairs, \(t(8) = .30 / \sqrt{(1 -
.09)/8} = 0.89\), well short of the critical value of \(\pm 2.306\). With 100 pairs, \(t(98) = .30 / \sqrt{(1 - .09)/98} = 3.11\),
beyond the critical value of about \(\pm
1.98\). The correlation is the same size in both studies; what
changes is how much evidence it rests on.
Quiz 17.4
On the other hand, a weak correlation can be statistically significant, if it comes from a large enough sample. Suppose we increased the sample for our study up to \(n = 300\). In the larger sample, the correlation between coffee and test score is only \(-.15\). With \(df = 298\), the critical values are \(\pm 1.968\). Converting \(r = -.15\) gives \(t = -2.62\), beyond the critical value, so this smaller correlation would reach statistical significance, \(r(298) = -.15\), \(p = .009\). In fact, we could convert the critical \(t\) to an \(r\), which would tell us that with 300 pairs, any correlation stronger than about \(\pm .11\) would be significant. So whether a correlation is significant and how strong it is are separate questions.
That significance decision comes down to a binary threshold, but how should we interpret the correlation as a measure of effect size? How impressive is a correlation of \(.15\)? What about \(.05\), or \(.30\)? Cohen called \(r = .30\)medium(Cohen, 1988). Funder and Ozer, whose argument about small effects adding up we met in Chapter 9, call it large in psychological research (Funder & Ozer, 2019). In the social sciences, the behaviors or attitudes or whatever we’re interested in are generally multiply determined. There are a lot of reasons why you get a particular score on a particular exam, not just how many cups of coffee you drank or how many hours of sleep you got. Those things might just reveal a small piece of the puzzle. And a small piece can be worth knowing about, even if it doesn’t look terribly impressive on a scatterplot (Figure 17.3).
Figure 17.3: A very small correlation (\(r = .05\), left) and a large one by Funder and Ozer’s standards (\(r = .30\), right). At \(.05\) there’s barely any visible pattern. At \(.30\) there’s a more obvious upward trend. It would generally be considered quite a strong relationship in the context of social scientific research, even though there is still a lot of variability around the trend. In the social sciences, there always will be.
Scatterplot of 100 observations with r = .05. There is barely any visible pattern; the ellipse is almost a circle.
The same 100 observations rearranged to give r = .30. There is a visible upward trend, though scores still vary widely at any given X.
Correlation and causation
In the spending survey, the researchers asked whether income could account for the relationship between giving and happiness. But what does “taking income into account” actually involve? We can see the basic idea using nothing more than correlations.
Think back to our coffee and test score example. We found a negative correlation between coffee consumption and test scores, but we don’t know whether drinking coffee is causing lower test scores, or whether students who expect to do poorly on the exam are drinking more coffee, or whether some other factor is behind both. Maybe students who haven’t been sleeping are both drinking more coffee and scoring lower on the exam.
So suppose the study also recorded each student’s average nightly sleep over the week before the exam. (That sleep came before the morning’s coffee, so the coffee can’t have caused it.) Here are our seven students again, with their sleep. (We’ll use all 300 students for the correlations, but this shows what the data look like with a third variable.)
Table 17.3: The seven students from Table 17.1, now with their average nightly sleep over the week before the exam.
Participant
Coffee (cups)
Test score
Sleep (hours)
A
\(0\)
\(90\)
\(9\)
B
\(0.5\)
\(60\)
\(8\)
C
\(0.5\)
\(85\)
\(8\)
D
\(1\)
\(65\)
\(5\)
E
\(1.5\)
\(50\)
\(6\)
F
\(1.5\)
\(65\)
\(6\)
G
\(2\)
\(75\)
\(7\)
With three variables we can calculate three correlations, one for each pair. Table 17.4 shows them for all 300 students in what’s called a correlation matrix. Pick a row and a column and read across and down to where they meet. We’ve only filled in the lower half because correlating sleep with coffee gives us exactly the same number as correlating coffee with sleep.
Table 17.4: Correlation matrix for coffee, test score, and sleep across all 300 students in the invented study.
Coffee
Test score
Sleep
Coffee
—
Test score
\(-.15\)
—
Sleep
\(-.35\)
\(.30\)
—
Students who slept less tended to drink more coffee (\(r = -.35\)) and get lower test scores (\(r = .30\)). So how much of the relationship between coffee and test score is still there once we take sleep into account?
Partial correlations
If we’ve measured all three things, we can answer that question with a partial correlation. Think of two students who got the same amount of sleep. Would knowing which one drank more coffee still tell us anything about who scored higher? For each student, we work out how much more or less coffee they drank than we’d predict from their sleep. Then we do the same for their test score. The partial correlation is the correlation between those two sets of deviations. We’ll use this technique of measuring deviations from a prediction in the next chapter, but for now, we can calculate a partial correlation directly from the three correlation coefficients we already have. Here \(X\) is coffee, \(Y\) is test score, and \(Z\) is sleep.
The \(r_{XY \cdot Z}\) notation indicates we’re producing a correlation between \(X\) and \(Y\), controlling for \(Z\). The numerator subtracts covariability associated with sleep—sleep’s joint association with coffee and test scores. In the denominator, each \((1-r^2)\) is the fraction of variability left after accounting for sleep, first for coffee and then for test scores. Combining those fractions puts the result on the same \(−1\) to \(1\) scale as a regular correlation coefficient.
Figure 17.4: Accounting for sleep. The solid lines show sleep’s correlations with coffee and with test score. The dashed line shows the correlation between coffee and test score that remains after accounting for sleep: \(-.05\), down from \(-.15\). All values are invented.
Accounting for sleep brings the correlation much closer to zero, from \(-.15\) to \(-.05\). Compare that with the spending survey at the beginning of the chapter. There, taking income into account barely changed the association between spending on others and happiness.
We can test a partial correlation by converting it to \(t\) the same way as before, except that we lose one more degree of freedom for each variable we account for, so here \(df = n - 3 = 297\). For the full sample of 300, that gives \(t = -0.87\), well short of the critical values of \(\pm 1.968\), so there’s no longer a significant association between coffee and test score, once we account for sleep. But we might also be interested in a slightly different question: how much did the association change? That would be a separate test, distinct from the significance of the partial correlation itself. We won’t go into the details here; I just want you to recognize the general idea if you come across it in research papers or whatever.
Looking at partial correlations, particularly when we set out to do our research with a specific third variable in mind, can add valuable context to our understanding of the relationships between variables. But it still doesn’t establish causation or rule out other explanations. Other unmeasured factors could still be influencing the relationship. That brings us back to the advantage of random assignment in Chapter 12. It should mean that all the other influences on the thing we’re interested in get evenly distributed across groups. It doesn’t make the effect of sleep or whatever else might be important go away; it just averages them out so that any remaining difference between groups is due to the variable we manipulated (or to chance, which is what the significance test is for).
Your turn
Suppose a survey finds that teenagers who spend more time on social
media report lower well-being. It’s tempting to conclude that social
media makes teenagers unhappy. Come up with two other explanations: one
where the causation runs the other way, and one where a third variable
is behind both.
Example answer
The other way around: teenagers who are already unhappy might spend
more time on social media, perhaps looking for distraction or company. A
third variable: teenagers with less going on in their lives, or with
less parental supervision, might both spend more time online and feel
worse, without either one causing the other.
Explanation
There are plenty of other possibilities. The point is that the
correlation by itself can’t tell them apart.
Quiz 17.5
Correlation assumptions
With correlational data, we have pairs of scores from the same person, and we’re interested in whether those scores are related. As with the related-samples analyses we’ve used, the assumption of independence applies between people, not between the two scores within a pair.
For the significance test we’ve used, we also assume the pairs of scores come from a bivariate normal distribution. With the \(t\) test and ANOVA we assumed scores came from a normally distributed population. With two variables being considered together, both populations should be normal, and at any given value of \(X\), the \(Y\) scores should be normally distributed. Visually, the cloud of dots on a scatterplot should be roughly elliptical, densest in the middle and thinning out smoothly toward the edges. The test can tolerate some departures from bivariate normality, though seven pairs tell us little about the shape of the population.
Figure 17.5: Two clouds of 100 points with the same correlation, \(r = .50\). On the left, the points come from a bivariate normal distribution: densest in the middle and thinning out evenly in every direction. On the right, both variables are positively skewed. The points pile up in the lower-left corner and straggle out to the upper right, violating the assumption.
An approximately bivariate normal cloud of 100 points with r = .50. The points are densest in the middle and thin out evenly in every direction.
A skewed cloud of 100 points, also with r = .50. Most points are crammed into the lower-left corner, with a long, sparse tail stretching up and to the right.
Lastly, when I defined Pearson’s \(r\), I said it measures the strength of linear association: how consistently the points follow a straight line. So if we calculate Pearson’s correlation coefficient, we’re assuming linearity.
It’s important to check, because things can be related in ways that a straight line doesn’t capture. Maybe the relationship between \(X\) and \(Y\) starts out with \(Y\) increasing as \(X\) increases, but changes direction at some point: as \(X\) keeps increasing, \(Y\) starts to decrease. (The first scoop of ice cream might improve your mood; by the fifth you might start feeling worse.) Or maybe \(X\) and \(Y\) keep increasing together, but the rate of increase changes at some point. Figure 17.6 illustrates some predictable (though increasingly contrived) relationships that Pearson’s \(r\) fails to capture. This is why it’s worth looking at the scatterplot before trying to summarize the relationship with a single number.
Figure 17.6: Three examples of nonlinear relationships: a U-shaped relationship, a wave, and something entirely contrived—data arranged in the shape of a star. None are random or unpredictable, but all three have exactly the same linear correlation: \(r = 0\), because it only captures linear relationships.
Points follow a U-shaped curve: Y falls and then rises as X increases. The linear correlation is r = 0.
Points follow a wave: Y repeatedly rises and falls as X increases. The linear correlation is r = 0.
Points trace the outline of a five-pointed star. The linear correlation is r = 0 despite the clear pattern.
Learning Checks
0 of 12
1
A researcher records how many hours 80 teenagers slept on a school
night and on a weekend night, to see whether they sleep longer at
weekends. Is this a comparison of means, or a correlation?
Hint
Each person has two scores here. But what’s the question being asked
about them?
Answer
A comparison of means
Explanation
Each teenager does have two scores. But they’re two measurements of
the same variable, and the question is whether the mean differs between
the two nights. That’s the related-samples \(t\) test from Chapter 13. A correlation
would answer a different question: whether the teenagers who sleep
longest on school nights also sleep longest at weekends.
2
Which of these correlations is the strongest?
Answer
\(r = -.70\)
Explanation
Strength is the absolute magnitude: how far the correlation is from
zero. The sign only tells us the direction, so \(-.70\) is a stronger relationship than
\(.50\).
3
Suppose the test in our coffee study had been marked too harshly, and
we add 10 points to every student’s score. What happens to the
correlation between coffee and test score?
Hint
What happens to each student’s deviation from the mean test
score?
Answer
It stays the same
Explanation
The mean goes up by 10 points too, so every deviation stays exactly
as it was, and so do \(SS_Y\) and \(SP\). The correlation depends on where the
scores are relative to their means, not on the means themselves.
4
Four people have the following pairs of scores.
\(X\)
\(Y\)
1
2
2
1
3
4
4
3
What is the sum of products, \(SP\)?
Hint
Find the two means, then multiply each person’s deviation on \(X\) by their deviation on \(Y\) and add the four products.
Answer
3
Explanation
Both means are 2.5. The products are \((-1.5)(-.5) = .75\), \((-.5)(-1.5) = .75\), \((.5)(1.5) = .75\), and \((1.5)(.5) = .75\). Adding them gives \(SP = 3\).
5
For those same four pairs, \(SS_X = SS_Y =
5\). Use your sum of products to calculate Pearson’s \(r\).
Use the correlation you just calculated for those four pairs to find
\(t\) for the test of \(\rho = 0\).
Hint
There are four pairs, so \(df = 4 - 2 =
2\).
Answer
1.06
Explanation
\(t = .60 / \sqrt{(1 - .60^2)/(4 - 2)} =
.60 / \sqrt{.32} = 1.06\). With \(df =
2\), the two-tailed \(.05\)
critical values are \(\pm 4.303\), so
we fail to reject the null hypothesis.
7
A paper reports a correlation as \(r(48) =
.32\), \(p = .02\). How many
pairs of scores was it based on?
Answer
50
Explanation
The number in parentheses is the degrees of freedom, not the sample
size. For a correlation, \(df = n -
2\), so \(n = 48 + 2 = 50\)
pairs.
8
In a large survey, the correlation between coffee drinking and test
scores is statistically significant, \(p <
.001\). Which conclusion does that support?
Answer
A result this strong is unlikely under the null hypothesis
Explanation
The significance test addresses chance, and only chance. A very small
\(p\)-value makes it hard to believe
there’s no association in the population, but it says nothing about why
the two variables go together.
9
Think back to our seven students, with coffee consumption (\(x\)), test score (\(y\)), and hours of sleep (\(z\)). For just those seven students, \(r_{xy} = -.50\), \(r_{xz} = -.667\), and \(r_{yz} = .667\). What is \(r_{xy.z}\)?
Answer
-0.1
Explanation
\(r_{xy.z} = \dfrac{-.50 -
(-.667)(.667)}{\sqrt{(1 - .667^2)(1 - .667^2)}} \approx \dfrac{-.50 +
.444}{.556} \approx -.10\). The correlation between coffee and
test score is much weaker once we account for sleep.
10
In a survey, hours of exercise per week and mood correlate at \(r = .40\). Accounting for income, the
partial correlation is \(.38\). What
does that suggest?
Hint
Compare this with what happened when we accounted for sleep in the
coffee study, and with income in the spending survey.
Answer
Income doesn’t explain much of the link, though other third variables
still could
Explanation
Taking income into account barely changed the correlation, so
differences in income don’t appear to explain much of the link. That’s
what happened with income in the spending survey. Some other third
variable could still account for the link, so we still can’t conclude
that exercise causes better mood.
11
A researcher has 40 people rate their stress and their sleep quality
every night for a week, then calculates the correlation across all 280
pairs of ratings. Which assumption is the most obvious problem?
Hint
The two ratings in a pair are supposed to come from the same person.
What about different pairs?
Answer
Independence
Explanation
The two scores within a pair needn’t be independent, but the pairs
themselves are supposed to be independent. Here, each person contributes
seven pairs, and pairs from the same person will tend to resemble each
other. The test would treat 280 pairs as 280 independent observations
when there are really only 40 people.
12
A scatterplot shows a clear U shape: scores on \(Y\) are high when \(X\) is low, low when \(X\) is in the middle, and high again when
\(X\) is high. Pearson’s \(r\) comes out close to zero. What should we
conclude?
Answer
There’s no linear relationship, but there is a relationship that
\(r\) doesn’t capture
Explanation
Pearson’s \(r\) measures linear
relationships. On one side of the U the products of deviations are
mostly negative, on the other side mostly positive, and they cancel out.
This is one reason to look at the scatterplot as well as the
statistic.
Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Lawrence Erlbaum Associates.
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
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
Pearson, K. (1896). Mathematical contributions to the theory of evolution. III. Regression, heredity, and panmixia. Philosophical Transactions of the Royal Society of London. Series A, 187, 253–318. https://doi.org/10.1098/rsta.1896.0007
Yeah, I just now realized those words are related. 🤯↩︎
They did this not with correlation, but with regression, the topic of the next chapter. They’re closely related techniques which can answer the same kind of question.↩︎
The same calculation turns up under a few other names. Pearson’s \(r\) calculated on ranks is Spearman’s rank correlation. If one variable is quantitative and the other is coded 0 or 1, it’s a point-biserial correlation. Coding the two spending groups in Chapter 12 that way gives \(r = .28\) (with spend-on-other coded 1), and testing it gives the same \(t(8) = 0.82\) we got by comparing means. If both variables are coded 0 or 1, the correlation is called phi.↩︎
I should note that changing the scale of one axis doesn’t change the correlation, but it can make the ellipse look more or less rotund. The correlation coefficient measures how consistently the two variables go together, relative to their separate variability, rather than how the pattern happens to look in a particular graph with its particular scales and dimensions.↩︎
Slightly more technically, we’re estimating the slope and intercept of the line from the data, and each estimated parameter costs a degree of freedom. We’ll go into more detail on that in the next chapter.↩︎