Tutorials › Introduction to Statistics › Making Predictions With a Fitted Line

Least-Squares Regression Lines · Tutorial 265 of 996

Making Predictions With a Fitted Line

Use a fitted regression line to calculate a predicted response and explain what that prediction does—and does not—represent.

Beginner 8 min read

What You'll Learn

  • Identify the explanatory value and response variable in a prediction question.
  • Substitute the explanatory value into the fitted regression equation.
  • Calculate predictions from equations written directly or read from software output.
  • Track units through the calculation and report the result in context.
  • Distinguish a fitted prediction from an observed response or a guaranteed individual outcome.
  • Recognize when a prediction’s interpretation depends on whether the fitted line is appropriate for the situation.

From a Fitted Line to a Prediction

A fitted regression equation turns a specified value of an explanatory variable into a predicted value of a response variable. This is a direct calculation: identify the given explanatory value, put it into the equation, and evaluate. The arithmetic is usually brief, but a useful answer also names the predicted quantity, includes its units, and distinguishes the prediction from what will actually happen to an individual.

For example, suppose a fitted line relates hours spent studying to quiz score. If a question gives a study time of 4 hours, the regression equation can be used to calculate the line’s predicted score at that value. The result is not necessarily any student’s actual score. It is the response value assigned by the fitted line to the specified study time.

Definition: A fitted regression line is written as \(\hat{y}=b_0+b_1x\), where \(x\) is a value of the explanatory variable, \(\hat{y}\) is the predicted response at that value, \(b_0\) is the fitted intercept, and \(b_1\) is the fitted slope. To make a prediction at a specified \(x\), substitute that value for \(x\) and calculate \(\hat{y}\).

The coefficients \(b_0\) and \(b_1\) are determined from paired data. When software reports a regression equation, its intercept and slope are the values to use in that equation. The prediction calculation does not require refitting the line: it evaluates the already-fitted equation at the requested explanatory value.

A Reliable Substitution Procedure

Before calculating, make sure the value supplied in the question belongs to the explanatory variable and is expressed in the units used to fit the line. Then substitute it for \(x\), preserve the signs and parentheses, and calculate the resulting \(\hat{y}\). Finally, state what \(\hat{y}\) measures in the situation.

1
Identify the variables and the supplied value.
Determine what \(x\) represents, what \(y\) represents, and the units of the given explanatory value.
2
Write the fitted equation.
Use the intercept and slope as reported, including a negative sign if the slope is negative.
3
Substitute and evaluate.
Replace \(x\) with the supplied value and show the arithmetic leading to \(\hat{y}\).
4
Report the prediction in context.
Name the response, give its units, and make clear that the value is predicted by the fitted line.

The calculation follows directly from the equation’s meaning. At any selected explanatory value \(x_0\), the point on the fitted line has coordinates \((x_0,\hat{y})\). Substituting \(x_0\) into the line’s equation gives the second coordinate:

$$ \hat{y}=b_0+b_1x_0. $$

This is the complete justification for the calculation: the predicted response is the vertical coordinate of the fitted line at the specified horizontal coordinate. The operation is substitution, not a separate statistical estimate from newly collected data.

Worked Example: Predicting a Quiz Score

Hypothetical example. A teacher fits a least-squares regression line to paired data on study time and quiz score. The explanatory variable \(x\) is study time in hours, and the response \(y\) is quiz score in points. The fitted equation is \(\hat{y}=42.6+5.15x\). What score does the line predict for a student who studied 4.5 hours?

The supplied explanatory value is \(x=4.5\) hours. Substitute 4.5 for \(x\):

$$ \begin{aligned} \hat{y} &= 42.6+5.15(4.5)\\ &=42.6+23.175\\ &=65.775. \end{aligned} $$

The fitted line predicts a quiz score of about 65.8 points for a study time of 4.5 hours. The slope has units of points per hour, so multiplying it by 4.5 hours gives a score measured in points; the intercept is also measured in points.

This is the line’s predicted score at 4.5 hours, not a claim that every student who studies that long will earn 65.8 points. Individual scores can differ from the fitted prediction.

Keeping the Equation and Units Straight

Regression equations may appear in mathematical notation or as software output. In either form, identify which coefficient is the intercept and which is the slope before substituting. A line reported as “intercept = 8.2, slope = 3.4” means \(\hat{y}=8.2+3.4x\), not \(8.2x+3.4\). The equation’s variables and units determine how to describe the resulting prediction.

Units also provide a useful check on the arithmetic. The intercept has the same units as the response. The slope has response units per explanatory-variable unit, so slope multiplied by \(x\) has response units. Consequently, both terms in the equation can be added to produce a predicted response.

Worked Example: Using Coefficients Reported by Software

Hypothetical example. Software reports an intercept of 8.2 and a slope of 3.4 for a fitted line relating bicycle commute distance \(x\), in kilometers, to commute time \(y\), in minutes. Find the predicted commute time for a distance of 6 kilometers.

The response is commute time, measured in minutes. The software coefficients give the equation \(\hat{y}=8.2+3.4x\). Substitute \(x=6\):

$$ \begin{aligned} \hat{y} &= 8.2+3.4(6)\\ &=8.2+20.4\\ &=28.6. \end{aligned} $$

The fitted line predicts a commute time of 28.6 minutes for a 6-kilometer bicycle commute. The product \(3.4\text{ minutes per kilometer}\times6\text{ kilometers}\) is 20.4 minutes, so it can be added to the intercept, 8.2 minutes.

The prediction is for the response variable, commute time. It is not a prediction of distance, because distance is the explanatory variable that was supplied.

A negative slope is handled in the same way as a positive slope: preserve the negative sign when substituting. A negative fitted slope means that the line’s predicted response decreases as the explanatory value increases. In a single prediction calculation, it contributes a negative amount to the intercept.

Worked Example: Substituting a Negative Slope

Hypothetical example. A fitted line relates the number of hours since a device was fully charged, \(x\), to its remaining battery charge, \(y\), in percentage points. The equation is \(\hat{y}=98.4-6.25x\). Calculate the predicted remaining charge after 7.2 hours.

Here \(x=7.2\) hours. Substitute this value and keep the minus sign in the equation:

$$ \begin{aligned} \hat{y} &= 98.4-6.25(7.2)\\ &=98.4-45.0\\ &=53.4. \end{aligned} $$

The fitted line predicts 53.4 percentage points of battery charge after 7.2 hours. The slope’s units are percentage points per hour, and its contribution at 7.2 hours is \(-45.0\) percentage points.

The minus sign belongs to the slope’s contribution. Replacing the subtraction with addition would give a different result and would not evaluate the reported fitted line.

What a Prediction Represents

A prediction is a value calculated from the fitted equation, not a recorded response for a particular individual. In a context where the line is used to describe the response level associated with an explanatory value, \(\hat{y}\) represents the line’s estimated response at that value. For an individual outcome, the actual response may be above or below the prediction.

The arithmetic alone cannot establish that the fitted line is appropriate for every situation or every explanatory value. Interpret the result in light of the data and context on which the line was fitted. The explanatory variable must be understood in the same way and measured in the same units as in the fitted equation. A calculated number may be exact as an evaluation of the equation while still being a poor guide to a real response if the equation is not suitable for that use.

A fitted association also does not, by itself, show that changing \(x\) causes a change in \(y\). The prediction describes what the fitted line assigns to a supplied explanatory value. A causal claim requires grounds beyond the substitution calculation.

Common Mistakes

  • Putting the supplied value in the wrong place. The given explanatory value replaces \(x\), not \(\hat{y}\). The result after substitution is the predicted response.
  • Reversing the coefficients. In \(\hat{y}=b_0+b_1x\), the intercept is added and the slope is multiplied by \(x\). Do not multiply the intercept by the explanatory value.
  • Dropping a negative sign. If the fitted equation has a negative slope, retain its sign throughout the substitution and arithmetic.
  • Reporting a number without context or units. A complete response names the predicted quantity, such as “28.6 minutes,” rather than giving only “28.6.”
  • Treating the prediction as a guaranteed outcome. The line gives a fitted value. It does not ensure that a particular individual’s observed response will equal that value.
Key takeaway: For a fitted line \(\hat{y}=b_0+b_1x\), a prediction at \(x=x_0\) is calculated as \(\hat{y}=b_0+b_1x_0\). Substitute the explanatory value carefully, check units, and report the result as the line’s predicted response—not as a guaranteed observed outcome.

Check Your Understanding

For each question, show the substitution and state the predicted response in context.

  1. A fitted line for weekly exercise time \(x\), in hours, and a fitness score \(y\), in points, is \(\hat{y}=31+4.2x\). What score does it predict for \(x=3\) hours?
  2. A software report gives intercept \(12.5\) and slope \(-1.8\). Write the fitted equation, then calculate its prediction at \(x=4\).
  3. For the equation \(\hat{y}=6+2.5x\), the explanatory variable is measured in meters and the response is measured in seconds. What are the units of the slope and of a prediction?
  4. Explain why a fitted prediction of 65.8 points does not mean that every individual with the specified explanatory value will have an observed response of 65.8 points.
  5. A fitted line is \(\hat{y}=9+3x\). A student substitutes a supplied explanatory value into the position of \(\hat{y}\) and calls the result a prediction. Identify the mistake and describe the correct substitution.