Tutorials › Introduction to Statistics › Calculating Slope from Correlation and Standard Deviations

Least-Squares Regression Lines · Tutorial 258 of 996

Calculating Slope from Correlation and Standard Deviations

Use the correlation and the two sample standard deviations to calculate and interpret a least-squares slope in context.

Beginner 9 min read

What You'll Learn

  • Apply the formula connecting the least-squares slope to correlation and sample standard deviations.
  • Keep explanatory and response variables, and their units, in the correct order.
  • Interpret the slope’s sign and its response-units-per-explanatory-unit scale.
  • Recognize when the correlation-based formula is undefined.
  • Distinguish a correlation from a regression slope.

From Correlation to Slope

Correlation summarizes the direction and strength of a linear association without units. A regression slope answers a different question: how much the fitted response changes for a one-unit increase in the explanatory variable. These quantities are connected. Once the correlation and the sample standard deviations are known, the least-squares slope can be calculated without fitting the line from scratch.

Let \(x\) denote the explanatory variable and \(y\) the response variable. The fitted least-squares regression line has the form \(\hat{y}=b_0+b_1x\), where \(b_1\) is its slope. In this tutorial, \(r\) is the sample correlation between the paired \(x\)- and \(y\)-values, \(s_x\) is the sample standard deviation of the explanatory-variable values, and \(s_y\) is the sample standard deviation of the response-variable values.

Formula: When both variables have positive sample standard deviations, the least-squares slope is $$ b_1 = r\frac{s_y}{s_x}. $$ The order matters: multiply the correlation by the response standard deviation, then divide by the explanatory standard deviation.

This formula calculates the slope, not the intercept. It applies to paired quantitative data: each \(x\)-value must be matched with its corresponding \(y\)-value. For the formula using \(r\), both variables must vary in the sample, so \(s_x>0\) and \(s_y>0\). No assumption of normally distributed values is needed just to calculate this descriptive slope. The slope is most useful as a summary when a straight-line pattern is a reasonable description of the association; strong curvature or influential unusual observations can make that summary misleading.

Why the Formula Has This Form

The formula can be understood through standardization. Standardizing \(x\) means measuring its values in sample standard deviations from their mean; standardizing \(y\) does the same for the response. In those standardized units, the least-squares slope is \(r\). Converting back to the original measurement scales multiplies by \(s_y\) to restore response units and divides by \(s_x\) to account for the explanatory-variable scale.

The conversion can be written directly. If \(z_x=(x-\bar{x})/s_x\) and \(z_y=(y-\bar{y})/s_y\), then a one-unit increase in \(x\) corresponds to an increase of \(1/s_x\) in \(z_x\). A fitted change of \(r\) standardized response units corresponds to \(r s_y\) response units. Therefore the fitted change in \(y\) for a one-unit increase in \(x\) is

$$ b_1 = \frac{r s_y}{s_x}. $$

This also explains the units and sign. The correlation \(r\) has no units, while \(s_y/s_x\) has units of response per explanatory unit. Since standard deviations are positive, the sign of \(b_1\) is the sign of \(r\): a positive association gives a positive slope, and a negative association gives a negative slope.

Worked Example: Calculating a Slope From Paired Measurements

Suppose four hypothetical study sessions have explanatory-variable values \(x\) of 1, 2, 3, and 4 hours, and corresponding response values \(y\) of 2, 3, 5, and 6 points on a hypothetical assessment. Calculate the least-squares slope from the correlation and sample standard deviations.

First, the sample means are \(\bar{x}=2.5\) hours and \(\bar{y}=4\) points. The sums of squared deviations are

$$ \sum (x_i-\bar{x})^2 = 5,\qquad \sum (y_i-\bar{y})^2 = 10. $$

With \(n=4\), the sample standard deviations are

$$ s_x=\sqrt{\frac{5}{3}}=1.291\text{ hours},\qquad s_y=\sqrt{\frac{10}{3}}=1.826\text{ points}. $$

The sum of the paired cross-products of deviations is

$$ \sum (x_i-\bar{x})(y_i-\bar{y})=7. $$

Thus the sample correlation is

$$ r=\frac{7}{\sqrt{5\cdot 10}}=0.9899. $$

Now apply the slope formula, retaining the order \(s_y/s_x\):

$$ b_1 = r\frac{s_y}{s_x} =0.9899\frac{1.826\text{ points}}{1.291\text{ hours}} =1.400\text{ points per hour}. $$

The fitted line has a positive slope. In this sample, its predicted assessment score rises by 1.400 points for each additional hour of the explanatory measurement. This describes the fitted line, not a guaranteed change for every session and not evidence that increasing the hours causes a higher score.

Interpreting the Sign and Scale

A slope has a direction and a size. Its sign describes whether fitted response values tend to rise or fall as \(x\) increases. Its magnitude gives the change in fitted \(y\), in the response variable’s units, for a one-unit increase in \(x\). The standard deviations matter: two data sets can have the same correlation but different slopes if their measurement scales differ.

Worked Example: A Negative Slope in Context

In a hypothetical sample of 16 people, \(x\) is weekly screen time measured in hours and \(y\) is a response score measured in points. Suppose the sample summaries are \(r=-0.60\), \(s_x=3.0\) hours, and \(s_y=4.0\) points. Calculate and interpret the slope.

Both standard deviations are positive, so the correlation-based formula is defined. Substitution gives

$$ b_1 = (-0.60)\frac{4.0\text{ points}}{3.0\text{ hours}} =-0.80\text{ points per hour}. $$

The negative sign agrees with the negative correlation. The fitted response score decreases by 0.80 points for each one-hour increase in weekly screen time. This is a description of the linear association in these hypothetical data; it does not establish that screen time causes the score to change.

The value \(-0.60\) alone is not the slope. It indicates the direction and strength of the linear association on a unit-free scale. The ratio \(s_y/s_x\) supplies the scale needed to express the fitted change in points per hour.

Worked Example: How Changing Units Changes the Slope

Suppose, in another hypothetical sample, \(x\) is weekly exercise time and \(y\) is resting heart rate in beats per minute. The summaries are \(r=0.45\), \(s_x=2.0\) hours per week, and \(s_y=8.0\) beats per minute. Calculate the slope when exercise time is measured in hours, then convert the explanatory variable to minutes.

With hours as the unit for \(x\),

$$ b_1 = 0.45\frac{8.0\text{ beats per minute}}{2.0\text{ hours per week}} =1.8\frac{\text{beats per minute}}{\text{hour per week}}. $$

The positive slope means that the fitted resting heart rate increases by 1.8 beats per minute for each additional hour per week of exercise time in this sample. This association alone does not imply a causal effect.

One hour is 60 minutes, so \(s_x=120\) minutes per week. The correlation and response standard deviation do not change. In minutes, the slope is

$$ b_1 = 0.45\frac{8.0\text{ beats per minute}}{120\text{ minutes per week}} =0.030\frac{\text{beats per minute}}{\text{minute per week}}. $$

The numerical slope is smaller because a one-minute increase is a smaller change than a one-hour increase. The fitted relationship has not changed; only the unit used to measure the explanatory variable has changed.

When the Formula Cannot Be Used

The correlation-based formula requires \(s_x>0\) and \(s_y>0\). If every observed \(x\)-value is identical, \(s_x=0\), and there is no variation in the explanatory variable from which to determine a unique least-squares slope. If \(s_x>0\) but every \(y\)-value is identical, then \(s_y=0\). The least-squares slope is then \(0\), because a horizontal line at that constant response value fits the data exactly, but the sample correlation \(r\) is undefined. The expression \(r s_y/s_x\) therefore cannot be used in that case.

These cases are distinct. It is not enough to check only that the explanatory variable varies: the formula specifically uses a correlation, and the correlation is undefined if either variable has zero sample standard deviation.

Common Mistakes

  • Reversing the standard deviations. The formula is \(b_1=r(s_y/s_x)\), not \(r(s_x/s_y)\). The correct ratio gives response units per explanatory unit.
  • Treating correlation as the slope. Correlation is unitless and lies between \(-1\) and \(1\); a slope has measurement units and is not restricted to that range.
  • Ignoring the sign. Since the standard deviations are positive, the slope has the same sign as \(r\). A negative \(r\) cannot produce a positive slope under this formula.
  • Using the formula when a variable does not vary. If \(s_y=0\), the slope is zero when \(s_x>0\), but \(r\) is undefined, so the correlation formula is unavailable. If \(s_x=0\), the slope is not uniquely determined.
  • Turning a fitted association into a causal claim. A slope describes the fitted relationship in the data. By itself, it does not show that changing \(x\) causes a change in \(y\).
Key takeaway: For paired data with \(s_x>0\) and \(s_y>0\), calculate the least-squares slope as \(b_1=r(s_y/s_x)\). The correlation supplies the sign and standardized strength; the ratio of standard deviations supplies the slope’s scale and units.

Check Your Understanding

Use the formula and attend to the units and conditions in each question.

  1. A hypothetical sample has \(r=0.30\), \(s_x=5\) kilograms, and \(s_y=2\) centimeters. What is the least-squares slope, including its units?
  2. Two hypothetical variables have \(r=-0.70\), \(s_x=4\) hours, and \(s_y=6\) points. State the slope and interpret its sign and scale.
  3. Why can two data sets have the same correlation but different least-squares slopes?
  4. If \(s_x>0\) but \(s_y=0\), what is the least-squares slope, and why can it not be calculated using \(r(s_y/s_x)\)?
  5. A student says that a slope of \(0.4\) means the correlation is \(0.4\). Explain why this conclusion is not generally justified.