# 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.

Linear Regression Calculator

## 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*∑x i y i - (∑x i )*(∑y i )) / (n*∑x i 2 - (∑x i ) 2 )

Intercept b : b = (∑y i - m*(∑x i )) / n

Mean x : x̄ = ∑x i / n

Mean y : ȳ = ∑y i / n

Sample correlation coefficient r : r = (n*∑x i y i - (∑x i )(∑y i )) / Sqrt([n*∑x i 2 - (∑x i ) 2 ][n*∑y i 2 - (∑y i ) 2 ])

-1 < r < +1

Where:

n  is the total number of samples,

x i (x 1 , x 2 , ... ,x n ) are the x values,

y i (y 1 , y 2 , ... ,y n ) are the y values,

∑x i is the sum of x values,

∑y i is the sum of y values,

∑x i y i is the sum of products of x and y values

∑x i 2 is the sum of squares of x values

∑y i 2 is the sum of squares of y values

You may also be interested in our Quadratic Regression Calculator or Gini Coefficient Calculator