# What is the Generalized Least Squares model?

Feb 23, 2018

$\text{The GLS model is used in the presence of heteroscedasticity.}$
$\text{It generalizes the OLS (Ordinary Least Squares) model.}$

$\text{If we take the two variable linear regression}$
$Y = {\beta}_{1} + {\beta}_{2} \cdot X$
$\text{Then we have the following formulas with OLS :}$

${\hat{\beta}}_{2} = \frac{{\sum}_{i = 1}^{i = n} {x}_{i} \cdot {y}_{i}}{{\sum}_{i = 1}^{i = n} {x}_{i}^{2}}$

${\hat{\beta}}_{1} = \overline{Y} - {\hat{\beta}}_{2} \cdot \overline{X}$

$\text{with } {x}_{i} = {X}_{i} - \overline{X}$
$\text{and } {y}_{i} = {Y}_{i} - \overline{Y}$
$\text{("bar X" and "bar Y" being the average values of the observations}$
(X_i, Y_i)).

$\text{With GLS we have a weighted sum}$

${\hat{\beta}}_{2} = \frac{\left(\sum {w}_{i}\right) \left(\sum {w}_{i} {X}_{i} {Y}_{i}\right) - \left(\sum {w}_{i} {X}_{i}\right) \left(\sum {w}_{i} {Y}_{i}\right)}{\left(\sum {w}_{i}\right) \left(\sum {w}_{i} {X}_{i}^{2}\right) - {\left(\sum {w}_{i} {X}_{i}\right)}^{2}}$

$\text{with } {w}_{i} = \frac{1}{\sigma} _ {i}^{2} ,$
${\sigma}_{i}^{2} \text{ being the variances of the deviations } {u}_{i} = {Y}_{i} - E \left(Y | {X}_{i}\right)$