The Linear Regression Calculator fits a straight line to your data using the least squares method. Enter pairs of (x, y) values to find the regression equation y = mx + b, correlation coefficient (Pearson r), and coefficient of determination (R-squared).
The calculator offers four modes: simple linear regression with slope and intercept, correlation analysis with strength interpretation, prediction mode to estimate y for any x value, and residual analysis showing how well the model fits each data point. An SVG scatter plot with the regression line is displayed for all modes.
Your calculations will appear here
Linear regression finds the straight line that best fits a set of data points by minimising the sum of squared vertical distances (residuals) from the points to the line. This is known as the method of least squares.
The slope m represents the change in y for each unit increase in x. The intercept b is the value of y when x equals zero. Together they form the equation y = mx + b.
The Pearson correlation coefficient r measures the strength and direction of the linear relationship between x and y. It ranges from -1 (perfect negative) to +1 (perfect positive), with 0 indicating no linear relationship.
The coefficient of determination R-squared is the square of r. It represents the proportion of variance in y that is explained by the linear relationship with x. An R-squared of 0.85 means 85% of the variability in y is accounted for by x.
Residuals (e = y - y-hat) should ideally be randomly scattered around zero. Patterns in the residuals suggest the linear model may not be appropriate for the data.
Problem: Find the regression line for the points (1,2), (2,4), (3,5), (4,4), (5,5).
Solution: Mean x = 3, mean y = 4. Sum of (xi - xbar)(yi - ybar) = 4. Sum of (xi - xbar) squared = 10. Slope = 4/10 = 0.4. Intercept = 4 - 0.4 x 3 = 2.8.
Answer: y = 0.4x + 2.8
Problem: Using y = 0.4x + 2.8, predict y when x = 10.
Solution: Substitute x = 10: y = 0.4(10) + 2.8 = 4 + 2.8 = 6.8.
Answer: y = 6.8
Problem: For data (1,1), (2,2), (3,3), (4,4), find the Pearson r.
Solution: All points lie exactly on the line y = x. The correlation is perfect positive.
Answer: r = 1.0, R-squared = 1.0
Calculate probability of events, complements, unions, and intersections. Free online probability calculator for statistics.
Calculate standard deviation, variance, mean, and more for any dataset. Supports population and sample statistics. Free online tool.
Calculate z-scores, find values from z-scores, and determine probabilities. Free online z-score calculator with bell curve visualisation.
Calculate binomial probabilities, cumulative distributions, and expected values. Free online binomial distribution calculator with bar chart.
Calculate probabilities for normal distributions. Find areas under the bell curve, percentiles, and inverse values. Free online tool.
Calculate Pearson correlation coefficient, R-squared, and regression line. Free online correlation calculator with scatter plot.