Linear Regression Calculator

Find lines of best fit step by step

The calculator will find the line of best fit for the given set of paired data using the least squares method, with steps shown.

Related calculator: Quadratic Regression Calculator


If the calculator did not compute something or you have identified an error, or you have a suggestion/feedback, please write it in the comments below.

Your Input

Find the line of best fit for $$$\left\{\left(1, 2\right), \left(2, 5\right), \left(3, 7\right), \left(4, 11\right), \left(5, 15\right)\right\}$$$.


The number of observations is $$$n = 5$$$.

Generate the following table:

$$$x$$$$$$y$$$$$$x y$$$$$$x^{2}$$$$$$y^{2}$$$

The line of best fit is $$$y = m x + b$$$.

$$$m = \frac{n(\sum xy)-(\sum x)(\sum y)}{n(\sum x^2)-(\sum x)^2} = \frac{5 \cdot 152 - \left(15\right)\cdot \left(40\right)}{5 \cdot 55 - 15^{2}} = \frac{16}{5}$$$

$$$b = \frac{(\sum y)(\sum x^2)-(\sum x)(\sum xy)}{n(\sum x^2)-(\sum x)^2} = \frac{\left(40\right)\cdot \left(55\right) - \left(15\right)\cdot \left(152\right)}{5 \cdot 55 - 15^{2}} = - \frac{8}{5}$$$

Thus, the line of best fit is $$$y = \frac{16 x}{5} - \frac{8}{5}$$$.


The line of best fit is $$$y = \frac{16 x}{5} - \frac{8}{5} = 3.2 x - 1.6$$$A.