# OLS Formulation Proving with equations

OLS Formulation Proving with equations

Y – β2X           =          β1

β2           =          ∑xy/∑xi2

β2           =          ∑xiYi/∑Xi2-nX2

β2           =          ∑Xiyi/∑Xi2-nX2

these are also β2 shapes. We can write it in this shape.

We prove that why we are write the β2 in this shape ∑ (X-X) (Y-Y)/ ∑(X-X)2

First                            ∑ (x-X) (y-Y)              Multiplying

=          ∑[xy-Yx-yX+Xy]

=          ∑xy-Y∑x-X∑y+nXY

=          ∑xy-Y∑x/n.n-X∑y/n.n +nXY

=          ∑XY-YXn-XYn+nXY

=          ∑xy-YXn

=          ∑xy- (∑y/n) (∑x/n).n

=          ∑ xy-∑y∑x/n              so ∑xy-∑y∑x/n=∑(x-X)(y-Y)

Second                      ∑(x-X)2

=          ∑[x2=X2 – 2Xx]          Multiplying

=          ∑x2+nX2 – 2X∑x

=          ∑x2+nX2 – 2X[(∑x) (n/n)]

=          ∑x2+nX2 – 2X[∑x/n.n]

=          ∑x2+nX2 – 2XXn

=          ∑x2+nX2 – 2nX2

=          ∑x2+ (–nX2)

=          ∑x2–nX2

X=∑x/n           =          ∑X2-n(∑x/n)2

=          ∑X2 – n.1/n2 (∑x)2

=          ∑X2 –(∑x/n)2

So we can write it ∑(x-X)2 or ∑xi2

Because x-X is denote by x

And y-Y is denote by y

Why we write the β1 in the following shape.

OLS Formulation Proving with equations :-

β1 = Y-β2X

we prove

β1 = Y – β2X

Its normal equation

∑y = nβ1 = β2∑x

Dividing by n both sides

∑y/n = nβ1/n + β2∑x/n

Y = β1 = β2X

Rearrange

β1 = Y – β2X

Why we write the β2’s upper value in the following shape.

∑xiYi or ∑Xiyi

We proof

First

∑xiyi = ∑xiYi              where yi=y-Y , where ∑xi=0

∑xiyi = ∑xi (y-Y)

∑xiyi = ∑xiYi – Y∑xi

∑xiyi = ∑xiYi

So we proved that ∑xiyi = ∑xiYi

Second

∑xiyi = ∑Xiyi              where x=(x-X) , where ∑yi=0

∑xiyi = ∑(x-X)yi

∑xiyi = ∑yi (x-X)

∑xiyi = ∑yixi-X∑yi

∑xiyi = ∑yiXi

So this is proved that ∑xiyi = ∑yiXi

y = β1 + β2xi +ûi                                (D)                   ∑yixi = β2xi2   = 0

Y = β1 + β2xi                                                              ∑yixi = β2∑xi2

Y = β1 = β2X=U                                 (E)                   β2 = ∑yixi/∑xi2

Subtracting E from D

yi=β2Xi=ûi

to apply OLS

ui = yi – Yi                 where we write B2  in this shape

Minimizing :- ∑ûi2 = ∑(yi –β2xi)2

∂∑ûi2/∂β2          =             2∑(yi- β2xi)(-xi)=0

=          -2∑(yi- β2xi)(xi)=0

=          ∑(yi- β2xi)(xi)=0

=          β2 = ∑xy/∑xi2