Checking correlation after reversing one variable’s scale
Flip the direction of one variable and Pearson correlation changes sign while keeping its size. This guide checks that with paired lists, then explains reverse coding, linear rescaling and what a sign does and does not tell you.
What the correlation sign records
Pearson correlation r summarizes how closely two numeric variables follow a straight-line pattern. The size of r, from 0 to 1, says how tight the pattern is. The sign says which way it points. A positive r means that higher values of one variable tend to go with higher values of the other, and a negative r means that higher values of one go with lower values of the other. Because the sign records orientation, it depends on how each variable is coded. If you reverse the direction of one variable, so that what used to be high becomes low, the sign must flip. This guide verifies that with the smallest possible example and then looks at where reversed coding arises in practice. The Pearson Correlation Calculator uses r equal to Sxy divided by the square root of Sxx times Syy.
The worked pair of lists
Take x equal to 1, 2, 3 and y equal to 2, 4, 6. The means are 2 and 4. The deviations of x are minus 1, 0, 1, and those of y are minus 2, 0, 2. Sxy is the sum of the products, (minus 1)(minus 2) plus 0 plus (1)(2), which is 4. Sxx is 1 plus 0 plus 1, or 2, and Syy is 4 plus 0 plus 4, or 8. Then r is 4 divided by the square root of 16, which is 1. The points lie exactly on an increasing line. Now replace y with minus 2, minus 4, minus 6. The deviations of y become 2, 0, minus 2, so Sxy is minus 4, Sxx and Syy stay the same, and r is minus 4 divided by 4, which is minus 1.
Why only the sign changes
Multiplying a variable by a constant c multiplies its deviations from the mean by c. That multiplies Sxy by c and Syy by c squared. In the formula, the numerator scales by c and the square root in the denominator scales by the absolute value of c. If c is positive, these cancel and r is unchanged. If c is negative, they cancel except for a factor of minus 1, and r changes sign. The size of r is untouched because reversing a scale does not alter how tightly the points follow a line. It only turns the line from rising to falling. This also applies to shifting a variable by a constant, which leaves r alone. So only the sign of the multiplier matters, and the magnitude of the multiplier is irrelevant to correlation. A quick test confirms it. Multiplying the y list 2, 4, 6 by minus 0.5 gives minus 1, minus 2, minus 3, and r is still minus 1, while adding 10 to every value of y leaves r untouched.
A less perfect example
Perfect correlations rarely occur, so check a messier one. Let x equal 1, 2, 3, 4, 5 and y equal 2, 1, 4, 3, 5. The means are both 3. The x deviations are minus 2, minus 1, 0, 1, 2, and the y deviations are minus 1, minus 2, 1, 0, 2. Sxy is 2 plus 2 plus 0 plus 0 plus 4, or 8. Sxx is 10 and Syy is 1 plus 4 plus 1 plus 0 plus 4, or 10. So r is 8 divided by 10, which is 0.8, a strong positive pattern. Reverse y by subtracting each value from 6, giving 4, 5, 2, 3, 1. The deviations all change sign, Sxy becomes minus 8, and r is minus 0.8. The strength is the same, and the direction is opposite. These values are illustrative.
Reverse-coded items in surveys
Questionnaires often include items worded in opposite directions, such as one statement that agrees with a trait and another that disagrees with it. Before combining them, researchers reverse-code the negatively worded ones. On a five-point scale, a response x becomes 6 minus x, so 5 becomes 1 and 1 becomes 5. If you correlate a reverse-coded item with its original, you will get a negative value, and if you forget to reverse it before correlating it with other items, the sign of those correlations will look wrong. The arithmetic above explains why. Reverse coding is a negative linear transformation, so every correlation involving that item flips sign and keeps its size. Always record which items were reversed so a reader can interpret a table of correlations correctly.
Positive rescaling and unit changes
A positive multiplier leaves correlation unchanged, which is why r is independent of units. Converting temperature from Celsius to Fahrenheit multiplies by 1.8 and adds 32, a positive scale and a shift, so the correlation of temperature with anything else is the same in either unit. Converting a price from dollars to cents multiplies by 100 and does nothing to r. The sign change appears only when a transformation reverses order. Examples are subtracting from a maximum, multiplying by minus 1, and taking a reciprocal on positive values, although the reciprocal is not linear, so it changes the magnitude of r as well. Distinguish linear changes, which preserve the magnitude of r, from nonlinear transformations, which can change it.
How to read a negative value
A negative correlation does not mean a defect or an inverse proportion in a strict sense. It means that, within the data, the variable that is above its mean tends to be paired with a partner that is below its mean. The relationship might be a genuine tendency, a result of how the data were coded, or an artifact of a third factor. The sign is a description of the paired data and nothing more. It does not establish that one variable causes the other, and a sign flip caused by recoding says nothing new about the world. When reporting, state the direction of each variable. For example, say that higher scores mean more agreement. Without that note, a reader cannot tell whether a negative sign is meaningful or simply a coding choice. The size still deserves separate attention. A value of minus 0.2 and a value of minus 0.9 share a direction and differ greatly in how closely the points follow a line.
Cases where the calculation does not apply
The formula divides by the square root of Sxx times Syy. If either list has all identical values, its deviations are all zero, the denominator is zero, and r is undefined, so the calculator reports an error for a constant list. A flat variable has no pattern to correlate. The lists must also have the same length, with at least two values each, and be paired in order, so that the first x goes with the first y. Shuffling one list changes the answer. The calculator measures linear association only. A strong curved relationship, like a U-shaped pattern, can yield an r near zero even though the variables are tightly linked. Outliers can also dominate a small sample. With only three or five points, as in these examples, r is useful for illustrating arithmetic but gives little evidence about a population. Rank-based coefficients such as Spearman correlation handle curved but steadily rising patterns better, but they are a different statistic from the one this calculator reports.
Practical checks before you report r
Before publishing a correlation, look at the scatter plot, since r alone hides curvature and clusters. Confirm that both variables are coded the way the text describes, and check whether any were reversed. Verify that rows are paired correctly after sorting or filtering. If you reversed one variable, expect the sign of every correlation involving it to flip, and treat any other change as a sign that something else was altered. Also make sure the number of pairs is stated, because r from 5 pairs and r from 5,000 pairs carry very different weight. The calculator provides the coefficient for the data you enter. Deciding whether that coefficient is meaningful for a larger question requires context that the arithmetic cannot supply.
The slope of a fitted line flips as well
Correlation is closely tied to the slope of a least-squares line. The slope of y on x is Sxy divided by Sxx, so it carries the same sign as r. For the worked lists, Sxy is 4 and Sxx is 2, giving a slope of 2: each step in x goes with a rise of 2 in y. After reversing y, Sxy is minus 4 and the slope is minus 2. The line now falls by 2 for each step in x. Unlike r, the slope depends on units, so changing y from dollars to cents multiplies the slope by 100 but leaves r alone. That makes r useful for comparing the strength of relationships across different measures and the slope useful for predicting a quantity in its own units. Both change sign together whenever one variable is reversed.
A view through standardized scores
Correlation can also be read as an average product of z scores, where each value is expressed as the number of standard deviations from its mean. The x list 1, 2, 3 has z scores minus 1, 0 and 1 using the sample standard deviation, and so does the y list 2, 4, 6. Multiplying pairs gives 1, 0 and 1, and dividing the sum, 2, by n minus 1, which is 2, yields 1. Reversing y flips each of its z scores, giving 1, 0 and minus 1. The pair products become minus 1, 0 and minus 1, and the result is minus 1. This view shows why the sign flips and why the size does not: negating one list negates every product, while the standardization removes the effect of scale. It also explains why r stays between minus 1 and 1.
Reproduce the checks
Original orientation
Open the Pearson Correlation Calculator and enter:
- X observations
1,2,3- Y observations
2,4,6
Expected output:
R
1Both variables increase together.
Reversed y orientation
Open the Pearson Correlation Calculator and enter:
- X observations
1,2,3- Y observations
-2,-4,-6
Expected output:
R
-1Only one scale direction is reversed.
References and implementation scope
The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.
Sources
- Primary definition and convention reference ↗ · 2026-10-08