# 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*∑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_{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