× HomeMath BoardArchiveType

A(b0,b1)=i=1n(yi(b0+b1xi))2A(b_0, b_1) = \sum_{i=1}^n (y_i -(b_0 + b_1 x_i))^2

b0A(b0,b1)=i=1n2(yi(b0+b1xi))=0\frac{\partial}{\partial b_0}A(b_0 , b_1) = -\sum_{i=1}^n2(y_i -(b_0 + b_1 x_i))= 0

b1A(b0,b1)=i=1n2xi(yi(b0+b1xi))=0\frac{\partial}{\partial b_1}A(b_0 , b_1) = -\sum_{i=1}^n2x_i(y_i -(b_0 + b_1 x_i)) = 0

i=1nyi=nb0+(i=1nxi)b1 \sum_{i=1}^n y_i = nb_0+ \left(\sum_{i=1}^n x_i\right)b_1

i=1nxiyi=(i=1nxi)b0+(i=1nxi2)b1\sum_{i=1}^nx_i y_i = \left(\sum_{i=1}^nx_i\right)b_0 + \left(\sum_{i=1}^nx_i^2\right)b_1

(i=1nxi)(i=1nyi)=(ni=1nxi)b0+(i=1nxi)2b1 \left(\sum_{i=1}^nx_i\right)\left(\sum_{i=1}^n y_i\right) = \left(n\sum_{i=1}^nx_i\right)b_0+ \left(\sum_{i=1}^n x_i\right)^2b_1

ni=1nxiyi=(ni=1nxi)b0+(ni=1nxi2)b1n\sum_{i=1}^nx_i y_i = \left(n\sum_{i=1}^nx_i\right)b_0 + \left(n\sum_{i=1}^nx_i^2\right)b_1

(i=1nxi)(i=1nyi)ni=1nxiyi=((i=1nxi)2(ni=1nxi2))b1\left(\sum_{i=1}^nx_i\right)\left(\sum_{i=1}^n y_i\right)- n\sum_{i=1}^nx_i y_i = \left(\left(\sum_{i=1}^n x_i\right)^2 - \left(n\sum_{i=1}^nx_i^2\right)\right)b_1

We know that Pearson's r is defined as

r=1(n1)sxsyi=1n(xixˉ)(yiyˉ)r = \frac{1}{(n-1)s_x s_y} \sum_{i=1}^n (x_i-\bar{x})(y_i-\bar{y})

r=1(n1)sxsyi=1nxiyixiyˉxˉyi+xˉyˉr = \frac{1}{(n-1)s_x s_y} \sum_{i=1}^nx_i y_i-x_i \bar{y}-\bar{x}y_i +\bar{x}\bar{y}

r=1(n1)sxsyi=1nxiyi1nxi(j=1nyj)1n(j=1nxj)yi+1n2(j=1nxj)(i=1nyi)r = \frac{1}{(n-1)s_x s_y} \sum_{i=1}^nx_i y_i-\frac{1}{n}x_i \left(\sum_{j=1}^n y_j\right)-\frac{1}{n}\left(\sum_{j=1}^n x_j\right)y_i +\frac{1}{n^2}\left(\sum_{j=1}^n x_j\right)\left(\sum_{i=1}^n y_i\right)

n(n1)sxsyr=(j=1nxj)(i=1nyi)ni=1nxiyi-n(n-1)s_x s_yr= \left(\sum_{j=1}^n x_j\right)\left(\sum_{i=1}^n y_i\right)-n\sum_{i=1}^nx_i y_i

So we will have

n(n1)sxsyr=((i=1nxi)2(ni=1nxi2))b1    -n(n-1)s_xs_yr = \left(\left(\sum_{i=1}^n x_i\right)^2 - \left(n\sum_{i=1}^nx_i^2\right)\right)b_1 \implies

(n1)sxsyr=(i=1nxi21n(i=1nxi)2)b1(n-1)s_xs_yr = \left( \sum_{i=1}^nx_i^2 - \frac{1}{n}\left(\sum_{i=1}^n x_i\right)^2\right)b_1

We know that sx2=1(n1)i=1n(xixˉ)2    (n1)sx2=i=1n(xixˉ)2=i=1nxi22xˉxi+xˉ2=i=1nxi21n(i=1nxi)2s_x^2 = \frac{1}{(n-1)} \sum_{i=1}^n (x_i - \bar{x}) ^2 \implies (n-1)s_x^2 = \sum_{i=1}^n (x_i - \bar{x}) ^2=\sum_{i=1}^nx_i^2 -2\bar{x}x_i +\bar{x}^2 = \sum_{i=1}^nx_i^2-\frac{1}{n}\left(\sum_{i=1}^nx_i\right)^2

So we will have

(n1)sxsyr=(n1)sx2b1(n-1)s_xs_yr = (n-1)s_x^2b_1

b1=sysxrb_1 = \frac{s_y}{s_x}r

i=1nyi=nb0+(i=1nxi)b1 \sum_{i=1}^n y_i = nb_0+ \left(\sum_{i=1}^n x_i\right)b_1

b0=yˉxˉb1b_0 = \bar{y} - \bar{x}b_1