0
$\begingroup$

I am running a regression test for which I overall have two variables (x and y) and I would like to test if any of them is dependent on the other.

y = ax + intercept

No matter which one of the variables is the dependent one, I get the same R-squared and p-values (either with Matlab or with Rstudio). Intercept and predictor coefficients do change according to which variable is the independent one, but R-squared and p-value don't. Why is this happening? Can anyone explain and/or add any relevant paper?

Thanks in advance!

$\endgroup$
2
  • 1
    $\begingroup$ In a simple linear regression (one predictor) like you have, $R^2 = cor(x, y)^2$. Since $cor(x, y) = cor(y, x)$, the $R^2$ does not change, either. $\endgroup$ – Dave Jun 8 at 16:09
  • $\begingroup$ Thanks for your answer! I understand the maths but still this doesn't make sense to me. If y is dependent on x, then why is it equally possible that x is dependent on y? Isn't the null hypothesis in linear regression saying that y doesn't depend on x (the direction does matter)? While null hypothesis in correlation (e.g Pearson's) assumes that there isn't any kind of depency, no matter where it comes from... $\endgroup$ – Katerina Kornilia Jun 9 at 8:42
1
$\begingroup$

I will try to explain the intuition. In simple linear regression, you model association between x and y. Thus it is irrelevant if x explain y or y explain x. Either way the relation between the two is the same. Therefore you would expect to get the same R^2 and p-value no-matter the order.

$\endgroup$
1
  • $\begingroup$ Thanks for the explanation! $\endgroup$ – Katerina Kornilia Jun 9 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.