# Ordinary Least Squares Formulas and equations

Ordinary Least Squares Formulas, solved equations and squares

In respect of β1

Taking derivation and

= – 2 ∑ (Yi – β1 – β2Xi) equating to zero

We can write it in the following shape.

∑(Yi – β1 – β2Xi) = 0

Multiplying by ∑

∑Yi – nβ1 – β2∑Xi       (A)

∑Yi = nβ1 + β2∑Xi     Re-arrange

In respect of β2

= – 2 [ ∑ (YiXi – β1Xi – β2 Xi2) ]

= ∑YiXi – β1∑Xi – β2∑Xi2        (B)

∑YiXi = β1∑Xi + β2 ∑Xi2         Re-arrange

We find the 2 equations (A) and (B) with the help of (A) and (B) we find β1 and β2 easily.

• ∑Yi = nβ1 – β2∑Xi
• ∑YiXi = β1∑Xi + β2∑Xi2

Multiplying the equation (A) be ∑Xi and (B) by n.

∑Xi (∑Yi = nβ1 + β2∑Xi)

n(∑YiXi = β1∑Xi + β2∑Xi2)

∑XiYi = nβ1∑Xi + β2∑Xi2

n∑XiYi = nβ1∑Xi ± nβ2(∑Xi2)

n∑XiYi – ∑YiXi = nβ2∑Xi2 – β2∑Xi2

n∑XiYi – ∑YiXi = β2 (n∑Xi2 – ∑Xi2)

n∑XiYi – ∑YiXi          = β2                       or         ∑(X-X) – (Y-Y)           or         ∑XY

n∑Xi2 – (∑Xi)2                                                               ∑ (X –X)                                 ∑Xi2

Ordinary Least Squares Formulas: From the some method we find β1

A –  ∑Yi = nβ1 + β2∑Xi

B – ∑YiXi = β2∑Xi + β2∑Xi2

Multiplying the equation (A) by ∑Xi2 and (B) by ∑Xi

∑Xi2 (∑Yi = nβ1 + β2 ∑Xi)

∑Xi (∑YiXi = β1 ∑Xi + β2∑Xi2)

∑XiYi2 = nβ1∑Xi2 + β2∑Xi3

∑XiYi  =  β1(∑Xi)2 ± β2∑Xi3

∑Yi∑Xi2 – ∑XYi∑Xi = nβ1∑Xi2 – β1(∑Xi)2

∑Yi∑Xi2 – ∑XYi∑Xi = β1 (n∑Xi2 – (∑Xi2))

∑Yi∑Xi2 – ∑YiXi∑Xi             =    β1

n∑Xi2 – (∑Xi)2

Y – β2X                       =          β1

Related Article:

Classical Linear Regression Model

The OLS Estimators: Properties and formula

OLS Formulation Proving with equations

Ordinary Least Squares Formulas

The method of Ordinary Least Squares