Tutorials › AP Statistics › Predicting x From y Using the Equation

Least-squares regression · Tutorial 869 of 1000

Predicting x From y Using the Equation

Rearrange a fitted regression equation to find the predictor value for a target predicted response, then compare that result with a separately fitted reverse-regression line.

Intermediate 9 min read

What You'll Learn

  • Rearrange a least-squares regression equation to solve for its predictor.
  • Interpret the solved value in the predictor’s units and in context.
  • Recognize what the algebraic inverse of a regression line represents.
  • Distinguish an algebraic inverse from a separately fitted regression of x on y.
  • Calculate and compare both predictions using paired data.
  • Identify why evaluating Y1 at a target response does not solve for x.

Solving a Regression Equation for the Predictor

In “Predicting With the Calculator’s Y1 Function,” you used a predictor value as an input and obtained a predicted response. Sometimes the question runs in the other direction: what value of the predictor would make the regression line predict a particular response? You can answer by solving the equation algebraically.

The distinction to keep in mind is that solving the equation for \(x\) reverses the fitted line algebraically. It does not, in general, produce the least-squares regression line that predicts \(x\) from \(y\). Those are different lines, fitted for different purposes.

Formula: For a regression equation \(\hat{y}=a+bx\), a target predicted response \(y^*\) corresponds to the predictor value $$ x=\frac{y^*-a}{b},\qquad b\ne 0. $$ This solves the original equation for \(x\). The result is in the predictor’s units.

Here, \(y^*\) is the target response value specified in a question. The solved \(x\) is the input at which the original line’s predicted response equals \(y^*\). It is not necessarily the predictor value for an individual case whose observed response is \(y^*\).

The algebra is straightforward: start with \(y^*=a+bx\), subtract \(a\) from both sides, then divide by \(b\). If the slope is zero, the line is horizontal: it either never reaches the target or predicts that target for every \(x\). There is no unique predictor value to find by division.

Algebraic Inverse Versus Reverse Regression

In a regression equation \(\hat{y}=a+bx\), the line was fitted to predict the response \(y\) from the predictor \(x\). Solving that equation for \(x\) gives an algebraic inverse: it describes the \(x\)-coordinate on the original line corresponding to a chosen predicted \(y\)-value.

A separate regression of \(x\) on \(y\) has a different job. It uses \(y\) as the predictor and \(x\) as the response, and its least-squares equation is written \(\hat{x}=c+dy\). This new line is fitted to the data with \(x\) and \(y\) roles reversed. As established in “The Idea of the Least-Squares Criterion,” a least-squares line minimizes squared residuals in its response variable. So the \(y\)-on-\(x\) line minimizes squared vertical residuals, while the \(x\)-on-\(y\) line minimizes squared horizontal residuals on the original scatterplot. Rearranging one line does not refit it to minimize the other set of residuals.

Key distinction: Solving \(\hat{y}=a+bx\) for \(x\) finds a point on the original fitted line. Fitting \(\hat{x}=c+dy\) creates a separate least-squares line with \(x\) as the response. Do not treat these as interchangeable.

Both lines pass through the sample means when fitted with intercepts, as covered in “Finding the Line Through the Means.” Consequently, the algebraic inverse and the reverse-regression line agree at the mean response. Away from that point, they generally give different predictor values.

A Reliable Way to Solve for x

Use this sequence whenever a question gives a target predicted response and asks for the predictor value. Keep the original regression equation and its variable roles visible throughout the calculation.

1
Identify the original equation and target.
Write \(\hat{y}=a+bx\) and identify the target response \(y^*\).
2
Set the predicted response equal to the target.
Use \(y^*=a+bx\), not an observed response unless the question explicitly gives one for this algebraic purpose.
3
Isolate \(x\).
Subtract the intercept and divide by the slope, provided \(b\ne 0\).
4
Check and interpret.
Substitute the result into the original equation, then state the predictor value with its units and context. Consider whether it is within the observed predictor range.

A calculator’s \(Y1\) function evaluates the stored line at a supplied \(x\); it does not automatically solve for \(x\) when given a target \(y\). Entering \(Y1(60)\), for example, asks for the line’s predicted response at \(x=60\), not the \(x\)-value associated with a target response of 60. Use algebra to solve for the input.

Worked Examples

Worked Example: Find Practice Time for a Target Score

A fictional model relates minutes of practice, \(x\), to a predicted skills score, \(\hat{y}\):

$$ \hat{y}=41+2.5x $$

How many minutes of practice correspond to a predicted score of 66 on this line?

Set the predicted score equal to 66 and solve:

$$ \begin{aligned} 66&=41+2.5x\\ 25&=2.5x\\ x&=\frac{25}{2.5}=10 \end{aligned} $$

Check: \(41+2.5(10)=41+25=66\). The fitted line predicts a score of 66 for 10 minutes of practice. The answer is in minutes because practice time is the predictor. It identifies an input on this model’s line; it does not guarantee that every person practicing for 10 minutes will receive a score of exactly 66.

Worked Example: Solve an Equation With a Negative Slope

A fictional model predicts a device’s battery percentage, \(\hat{y}\), after \(x\) hours of use:

$$ \hat{y}=98-1.6x $$

At how many hours of use does the line predict a battery level of 70 percent?

Set the predicted response to 70. Subtract the intercept, then divide by the negative slope:

$$ \begin{aligned} 70&=98-1.6x\\ -28&=-1.6x\\ x&=\frac{-28}{-1.6}=17.5 \end{aligned} $$

Check: \(98-1.6(17.5)=98-28=70\). The model’s line predicts a 70 percent battery level after 17.5 hours of use. The negative signs cancel, so the solved time is positive. Always keep the sign of the slope when rearranging the equation.

This mathematical answer should also be checked against the setting and the data used to fit the line. If 17.5 hours is beyond the observed usage range, this is an extrapolation: the equation returns a value, but the data may not support a reliable prediction there.

Worked Example: Compare the Inverse With a Separate x-on-y Regression

A fictional study records \(x\), weekly practice sessions, and \(y\), a skills score. The paired observations are:

Practice sessions, \(x\)Skills score, \(y\)
140
255
350
465
560

First find the least-squares regression equation predicting score from practice sessions. The means are \(\bar{x}=3\) and \(\bar{y}=54\). The deviations from these means give:

$$ \begin{aligned} \sum (x-\bar{x})(y-\bar{y}) &=(-2)(-14)+(-1)(1)+(0)(-4)+(1)(11)+(2)(6)\\ &=28-1+0+11+12=50,\\ \sum (x-\bar{x})^2&=4+1+0+1+4=10. \end{aligned} $$

Thus, the slope predicting \(y\) from \(x\) is \(50/10=5\), and the intercept is \(54-5(3)=39\). The original regression equation is \(\hat{y}=39+5x\). For a target predicted score of 60, its algebraic inverse gives:

$$ 60=39+5x \qquad\Longrightarrow\qquad x=\frac{60-39}{5}=4.2\text{ practice sessions}. $$

Now calculate the separate least-squares regression of practice sessions on score. The sum of squared score deviations is:

$$ \sum (y-\bar{y})^2=(-14)^2+1^2+(-4)^2+11^2+6^2 =196+1+16+121+36=370. $$

For this reverse regression, the slope is the sum of cross-products divided by the sum of squared deviations in the predictor \(y\): \(50/370=5/37\). Its intercept is:

$$ \bar{x}-\frac{5}{37}\bar{y} =3-\frac{5}{37}(54) =\frac{111-270}{37} =-\frac{159}{37}. $$

So the separate \(x\)-on-\(y\) line is \(\hat{x}=-\frac{159}{37}+\frac{5}{37}y\). At a score of 60, it predicts:

$$ \hat{x}=-\frac{159}{37}+\frac{5}{37}(60) =\frac{-159+300}{37} =\frac{141}{37} \approx 3.8108\text{ practice sessions}. $$

The algebraic inverse gives 4.2 sessions, while the separately fitted reverse-regression line gives about 3.8108 sessions. They are not the same calculation and need not agree. As a check on the arithmetic, the original line predicts \(39+5(4.2)=60\); the reverse line at \(y=60\) gives \(141/37\), not 4.2.

Both lines do agree at the sample means: the original line predicts \(39+5(3)=54\), and the reverse line predicts \((-159+5(54))/37=111/37=3\) sessions at a score of 54. Agreement there does not make the equations interchangeable at other values.

Common Mistakes and AP Exam Tips

  • Putting the target into \(Y1\) as though it were \(x\). \(Y1(60)\) evaluates the line at predictor value 60. To find the predictor for target response 60, solve \(60=a+bx\).
  • Calling an algebraic inverse a reverse regression. The inverse comes from rearranging the \(y\)-on-\(x\) equation. A reverse regression must be fitted separately with \(x\) as response and \(y\) as predictor.
  • Dropping a negative sign. In a decreasing relationship, the slope is negative. Keep it in the equation and show the subtraction and division steps.
  • Reporting the wrong units. The solved value is an \(x\)-value, so use the predictor’s units, not the response’s units.
  • Confusing a predicted response with an observed response. A solved input identifies where the fitted line reaches the target predicted response. It does not assert that an individual observation at that input will equal the target.
  • Ignoring the data range. Check whether the solved predictor value falls within the observed range. If it lies outside, explain that the calculation is extrapolation and may not be reliable.

For a clear AP-style response, name the equation being solved, show the algebra, and state what the result means in context with units. If a question asks for a regression of \(x\) on \(y\), do not simply rearrange the \(y\)-on-\(x\) equation; fit or use the separate reverse-regression equation.

Key takeaway: To find the predictor value corresponding to a target predicted response, solve \(\hat{y}=a+bx\) for \(x\). That algebraic inverse is not generally the least-squares regression line of \(x\) on \(y\).

Check Your Understanding

Answer using the distinction between solving an equation and fitting a new regression line.

  1. For \(\hat{y}=18+4x\), find the \(x\)-value corresponding to a target predicted response of 50. Include the algebra and units if \(x\) is measured in hours.
  2. For \(\hat{y}=90-2x\), what \(x\)-value corresponds to a predicted response of 64? Show how the negative slope affects the calculation.
  3. In your own words, what does solving \(\hat{y}=a+bx\) for \(x\) find?
  4. Why is that algebraic solution generally different from the prediction made by a separately fitted regression of \(x\) on \(y\)?
  5. If the solved \(x\)-value is outside the observed predictor range, what concern should you mention when interpreting it?