Linear Regression Calculator
You can use this Linear Regression Calculator to find out the equation of the regression line along with the linear correlation coefficient. It also produces the scatter plot with the line of best fit. Enter all known values of X and Y into the form below and click the "Calculate" button to calculate the linear regression equation. Click on the "Reset" to clear the results and enter new data.
Reference
The Linear Regression Calculator uses the following formulas:
The equation of a simple linear regression line (the line of best fit) is y = mx + b,
Slope m: m = (n*∑xi yi - (∑xi)*(∑yi)) / (n*∑xi2 - (∑xi)2)
Intercept b: b = (∑yi - m*(∑xi)) / n
Mean x: x̄ = ∑xi / n
Mean y: ȳ = ∑yi / n
Sample correlation coefficient r: r = (n*∑xiyi - (∑xi)(∑yi)) / Sqrt([n*∑xi2 - (∑xi)2][n*∑yi2 - (∑yi)2])
-1 < r < +1
Where:
n is the total number of samples,
xi (x1, x2, ... ,xn) are the x values,
yi (y1, y2, ... ,yn) are the y values,
∑xi is the sum of x values,
∑yi is the sum of y values,
∑xi yi is the sum of products of x and y values,
∑xi2 is the sum of squares of x values,
∑yi2 is the sum of squares of y values.
You may also be interested in our Quadratic Regression Calculator or Gini Coefficient Calculator