1

Why are the regression lines different for the plot at the upper right and the one at the lower left(image attached) corner when using scatterplotMatrix in the car library?

Both seem to mark the same points with the axis interchanged. Why then are the regression lines different. Shouldn't the regression lines be the same in both?

enter image description here

lmo
  • 37,904
  • 9
  • 56
  • 69

1 Answers1

1

No, they shouldn't. For instance, consider the "Developed" group. In the bottom left case we have Alcohol ~ Life.expectancy meaning that the regression line tries to be "in the middle" of possible values of Alcohol as Life.expectancy changes. As a result, we cover only values a small range of Alcohol values, around (5.5, 9). However, in the top right case we have Life.expectancy ~ Alcohol meaning that the regression line tries to be "in the middle" of possible values of Life.expectancy as Alcohol changes. By definition, in this case we cover all values of alcohol, the (0, 15) interval.

In terms of coefficients we also have no reason to get something similar. E.g.,

set.seed(2)
y <- rnorm(100)
x <- rnorm(100, sd = 0.2)
coef(lm(y ~ x))
# (Intercept)           x 
# -0.02879037 -0.32651252 
cov(y, x) / var(x)
# [1] -0.3265125
coef(lm(x ~ y))
#  (Intercept)            y 
#  0.005553734 -0.009420632 
cov(y, x) / var(y)
# [1] -0.009420632

That is, the slope is obtained by dividing the covariance (the same in both cases) by the variance of the independent variable for the purpose of making the scale the same. In your case Alcohol clearly has a different scale than Life.expectancy, hence different results.

Julius Vainora
  • 47,421
  • 9
  • 90
  • 102