# Simple Linear Regression Anova statistics

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?

• 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. – Dave Jun 8 at 16:09