Correlation & Linear Regression Calculator

Work out the Pearson correlation coefficient and a best-fit straight line from a list of x,y data pairs.

How it is worked out

The Pearson correlation coefficient r measures how closely two variables move together in a straight-line way, from −1 (perfect negative) to +1 (perfect positive); 0 means no linear relationship. The regression line y = a + bx is the straight line that minimises the sum of squared vertical distances to the points (the "least squares" method); its slope is b and intercept is a. R² (equal to r² for a simple linear regression) is the proportion of the variation in y that the line explains.

Source: standard statistical definitions (Pearson product-moment correlation coefficient; ordinary least squares regression), as taught in any introductory statistics course.

Want mean, median, mode or standard deviation instead? Try the Mean, Median, Mode Calculator or the Standard Deviation Calculator.

Running into a technical issue or something that doesn't work right on this page? Please let us know straight away via our Contact page — that's how we find out what's broken and get it fixed.