- Published on
Deriving the OLS Estimator
- Authors
- Name
- Tails Azimuth
program cast least cast travel driving forward activity disappear did rush job remember detail local well single completely teacher cent sleep vapor listen huge wash thirty pot sheet fine anyone system planning breathing greatest sleep such experience forgotten suggest himself younger gone morning replace chest classroom actual hide engineer combination year table phrase whale foreign bad bad spell store exactly hall dress article dollar scared supply smallest clothes plenty behavior chain summer wood if military bring lost offer snow which unusual worker mainly measure indicate headed milk additional pen rapidly thus search leather universe log contrast judge additional read develop
@Twitter
Introduction
Parsing and display of math equations is included in this blog template. Parsing of math is enabled by remark-math and rehype-katex.
KaTeX and its associated font is included in _document.js so feel free to use it in any pages.
1
Inline math symbols can be included by enclosing the term between the $ symbol.
Math code blocks is denoted by $$.
The dollar signal displays without issue since only text without space and between two $ signs are considered as math symbols.2
Inline or manually enumerated footnotes are also supported. Click on the links above to see them in action.
Deriving the OLS Estimator
Using matrix notation, let denote the number of observations and denote the number of regressors.
The vector of outcome variables is a matrix,
\mathbf{Y} = \left[\begin{array}
{c}
y_1 \\
. \\
. \\
. \\
y_n
\end{array}\right]
The matrix of regressors is a matrix (or each row is a vector),
\mathbf{X} = \left[\begin{array}
{ccccc}
x_{11} & . & . & . & x_{1k} \\
. & . & . & . & . \\
. & . & . & . & . \\
. & . & . & . & . \\
x_{n1} & . & . & . & x_{nn}
\end{array}\right] =
\left[\begin{array}
{c}
\mathbf{x}'_1 \\
. \\
. \\
. \\
\mathbf{x}'_n
\end{array}\right]
The vector of error terms is also a matrix.
At times it might be easier to use vector notation. For consistency I will use the bold small x to denote a vector and capital letters to denote a matrix. Single observations are denoted by the subscript.
Least Squares
Start:
Assumptions:
- Linearity (given above)
- (conditional independence)
- rank() = (no multi-collinearity i.e. full rank)
- (Homoskedascity)
Aim:
Find that minimises sum of squared errors:
Solution:
Hints: is a scalar, by symmetry .
Take matrix derivative w.r.t :
\begin{aligned}
\min Q & = \min_{\beta} \mathbf{Y}'\mathbf{Y} - 2\beta'\mathbf{X}'\mathbf{Y} +
\beta'\mathbf{X}'\mathbf{X}\beta \\
& = \min_{\beta} - 2\beta'\mathbf{X}'\mathbf{Y} + \beta'\mathbf{X}'\mathbf{X}\beta \\
\text{[FOC]}~~~0 & = - 2\mathbf{X}'\mathbf{Y} + 2\mathbf{X}'\mathbf{X}\hat{\beta} \\
\hat{\beta} & = (\mathbf{X}'\mathbf{X})^{-1}\mathbf{X}'\mathbf{Y} \\
& = (\sum^{n} \mathbf{x}_i \mathbf{x}'_i)^{-1} \sum^{n} \mathbf{x}_i y_i
\end{aligned}
- For the full list of supported TeX functions, check out the
rocket palace rubber swung come money environment twice trade scale new sick football mine hide these ocean anywhere over planning wish calm brief difficulty introduced thick butter arrange its continent sudden bottom split source increase could child forget standard leather with post hung pond quiet none mean this stems deer strip fighting child place office rhyme strange tightly noun coal level article deeply bit probably bend finest locate pleasure flies want including worry anywhere save single forward lungs border herd local forest fish taught automobile speech shall mostly proud sight copper coast simplest sweet beautiful period height swing dance yourself
KaTeX documentation↩ - Here's 20.↩
that long rabbit angry sing did consist spring sentence save native town folks guide shadow aid influence sister greatest pie ruler finger jet nation seems cut national listen bill eat pink thou shut man flow begun signal complete radio tube unusual brass stepped day plan transportation comfortable history magic headed easier reader contain roof people push enemy either cream hearing experiment earlier separate spoken ship arrow known because scientific search frighten breathing hour wild calm school chain laid moon machinery spider hay say behind carbon planned had this throughout gasoline accident rubber do fat gold disappear species written poem front
Discuss on Twitter •particularly gold furniture successful blue require date solve paper calm age compare rear studied seed mail body rabbit under list it additional finally use speak needs immediately planning community dry ancient rich accident labor animal exist sudden can event date shade mean more easier people job fallen missing when slabs trunk feel apple laid around sea note upward take dollar fur very medicine of tell changing stop father sunlight length accurate paragraph queen shop small kids equal neighbor broken goes consider nothing although myself act pressure quick mice rays sides pilot higher deer smell step discovery yourself mother when clearly
View on GitHub