Different lines are used to predict Y and to predict X

The correlation coefficient is symmetric in the two variables — the correlation coefficient between X and Y is the same as that between Y and X. However the least squares line predicting Y from X is not the same as that used to predict X from Y (even after rearranging the equation).

If the scatterplot is drawn with the variable Y on the vertical axis, the least squares line for predicting Y from X,

y  =  b0 + b1 x

minimises the sum of squared vertical distances between the points on a scatterplot and the line. On the other hand, if we are interested in predicting X from Y using a line,

x  =  c0 + c1 y

the residuals are the horizontal distances between the points and the line in the same scatterplot, and least squares minimises the sum of squares of these.

Different lines minimise the sum of squares of horizontal and vertical distances.

About the two least squares lines

The two least squares lines can be simply written in terms of standardised variables,

Equation of least squares line to predict Y from X
Equation of least squares line to predict X from Y

where r is the correlation coefficient between X and Y. Since r is always less than 1, the least squares line for predicting Y from X is the more horizontal (closer to being parallel to the x-axis) of the two lines.

Revenue in garden centres

The scatterplot below shows the weekly sales figures ($000) in two similar garden centres over a period of 100 weeks. Sales receipts for both shops are affected by weather, season and various other factors that affect the two garden centres in a similar way, so the weekly figures are correlated.

The line that is initially drawn on the scatterplot looks a reasonable fit to the data — it would predict each shop's sales to be equal to that of the other shop. However this is not the least squares line for predicting Shop A's sales.

Click the checkbox Shop A under the scatterplot. This draws the residuals from using the line to predict Shop A's sales from those of Shop B. The residual sum of squares is also shown under the scatterplot. Drag the red arrow on the scatterplot to rotate the line and observe that the residual sum of squares is minimised when the line is closer to horizontal.

Now turn off the checkbox Shop A and click the checkbox Shop B. The residuals for predicting Shop B's sales from those of Shop A are now shown as horizontal lines and their sum of squares is displayed. Drag the line and observe that the residual sum of squares is minimised when the line is more vertical than before.