Linear Regression with Least Square

The simple linear regression model has the form of

$$\tag{1} y = c_0 + c_1 x, $$

where formula for $c_1$ is

$$\tag{2} c_1 = \frac{\displaystyle \sum_i (x_i - \bar{x})(y_i - \bar{y})}{\displaystyle \sum_i (x_i - \bar{x})^2} $$

and for $c_0$ is

$$\tag{3} c_0 = \bar{y} - c_1 \bar{x}. $$

The terms $\bar{x}$ and $\bar{y}$ are calculated using

$$\tag{4} \bar{x} = \frac1N \sum_i x_i $$

and

$$\tag{5} \bar{y} = \frac1N \sum_i y_i, $$

where $N$ is Number of pairs of $(x_i, y_i)$ data.

  • Mark Inlow, “On Deriving the Least Squares Estimates in Introductory Regression Courses”, Journal of Probability and Statistical Science [J Probab Stat Sci], vol 20, no 1, pp 184-190, Aug 2022, url https://doi.org/10.37119/jpss2022.v20i1.506.