Same r both ways
- Input
- r(horas,nota) e r(nota,horas)
- Expected output
- 0,9934 nos dois casos
The Pearson formula treats X and Y identically; no column order changes the result.
difference between correlation and linear regression
Correlation and regression start from the same paired data, but they answer different questions: correlation measures how much two variables move together, a single symmetric number between -1 and 1; regression fits a line that points in one direction, predicting Y from X. Using one in place of the other is the most common mistake: asking for a predictive line when the only question is whether a relationship exists, or the other way around.
The Pearson formula treats X and Y identically; no column order changes the result.
0.131579 ≠ 1/7.5 (0.133333): each line minimizes a different error, so swapping X for Y produces a distinct model, not the first one's inverse.
Squaring the Pearson r matches exactly the R² the regression calculator returns for the same line, only in simple linear regression.
Pearson's r measures the strength and direction of the linear relationship between two variables. It ranges from −1 to +1: values near ±1 indicate strong correlation; near 0 indicate weak or absent correlation.
Because the r formula sums both variables' deviations at once, without picking which one is the predictor; regression, in contrast, picks one variable to predict and minimizes only the error in it, so swapping that choice produces a different line, like 7.5 versus 0.131579 in the hours-and-score example.
Only in simple linear regression, with a single X: there, squaring the Pearson r matches the regression's R² exactly, like 0.986842 in the hours-and-score example. With more than one explanatory variable, R² stops being the square of a single r.
When the question is only "do these variables move together, and by how much", without needing to predict a specific value: correlation answers that with a single symmetric number, without requiring a choice of which variable is X and which is Y.
One x, y pair per line. Maximum 200 pairs.
All data stays in your browser. No data is sent to any server.