# How do you calculate the slope and intercept of a regression line?

Jun 29, 2016

$m = \frac{n \Sigma x y - \left(\Sigma x\right) \left(\Sigma y\right)}{n \Sigma {x}^{2} - {\left(\Sigma x\right)}^{2}}$

and $c = \frac{\Sigma y - m \Sigma x}{n}$

#### Explanation:

Let the data be given as $\left(x , y\right)$ and data set be

$\left({x}_{1} , {y}_{1}\right) , \left({x}_{2} , {y}_{2}\right) , \left({x}_{3} , {y}_{3}\right) , \ldots \ldots . \left({x}_{n} , {y}_{n}\right)$.

Then the fit for given data is of the type $y = m x + c$, $m$ being slope of regression line and $c$ being intercept of regression line.

Here $m = \frac{n \Sigma x y - \left(\Sigma x\right) \left(\Sigma y\right)}{n \Sigma {x}^{2} - {\left(\Sigma x\right)}^{2}}$

and $c = \frac{\Sigma y - m \Sigma x}{n}$