Linear Regression with Least Square

The simple linear regression model has the form of

y=c0+c1x,(1)\tag{1} y = c_0 + c_1 x,

where formula for c1c_1 is

c1=i(xixˉ)(yiyˉ)i(xixˉ)2(2)\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 c0c_0 is

c0=yˉc1xˉ.(3)\tag{3} c_0 = \bar{y} - c_1 \bar{x}.

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

xˉ=1Nixi(4)\tag{4} \bar{x} = \frac1N \sum_i x_i

and

yˉ=1Niyi,(5)\tag{5} \bar{y} = \frac1N \sum_i y_i,

where NN is Number of pairs of (xi,yi)(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.