# 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