R-Squared Calculator
Compute the coefficient of determination R² between two data sets — the share of variance explained — along with the Pearson correlation r.
How it works
r = Σ(x − x̄)(y − ȳ) ÷ √(Σ(x − x̄)² · Σ(y − ȳ)²) · R² = r²
R-squared, the coefficient of determination, is the proportion of the variation in one variable that a linear relationship with another explains — a number from 0 to 1. For a simple two-variable fit it is exactly the square of the Pearson correlation r, so an r of 0.8 gives an R² of 0.64, meaning 64% of the variance is accounted for. A higher R² means the points hug the line more tightly, but it never proves causation and can be inflated by curved or clustered data.
Worked example
For X = 1, 2, 3, 4, 5 and Y = 2, 4, 5, 4, 5, the Pearson correlation works out to r ≈ 0.7746, so R² = 0.7746² ≈ 0.60. That means about 60% of the variation in Y is explained by its linear relationship with X, and 40% remains as unexplained scatter.
Frequently asked questions
What does an R² of 0.6 actually mean?
It means 60% of the variation in one variable is explained by its linear relationship with the other, leaving 40% unexplained. R² is a share of variance, so it turns the abstract correlation r into an intuitive "how much of the story does the line tell" figure.
Is a high R² always good?
Not necessarily. A high R² can come from overfitting, a curved pattern squeezed into a line, or a lurking variable, and it never establishes causation. A low R² is not always bad either — in noisy fields like social science, explaining even 20% of variance can be valuable.
How does R² relate to the correlation r?
For a simple linear relationship between two variables, R² is just r squared. So r always sits between −1 and 1 and keeps its sign, while R² is between 0 and 1 and drops the sign, telling you the magnitude of the fit without its direction.
Related calculators
For education — check assumptions (sample size, distribution) before using statistics in real decisions.