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!