beta--> theta
This commit is contained in:
@@ -37,7 +37,7 @@ move from a linear algebra analysis to a statistical analysis. In
|
||||
particular, we will focus on what the regularization terms can result
|
||||
in. We will amongst other things show that the regularization
|
||||
parameter can reduce considerably the variance of the parameters
|
||||
$\beta$.
|
||||
$\theta$.
|
||||
|
||||
|
||||
On of the advantages of doing linear regression is that we actually end up with
|
||||
@@ -60,7 +60,7 @@ independent, i.e.:
|
||||
The randomness of $\varepsilon_i$ implies that
|
||||
$\mathbf{y}_i$ is also a random variable. In particular,
|
||||
$\mathbf{y}_i$ is normally distributed, because $\varepsilon_i \sim
|
||||
\mathcal{N}(0, \sigma^2)$ and $\mathbf{X}_{i,\ast} \, \bm{\beta}$ is a
|
||||
\mathcal{N}(0, \sigma^2)$ and $\mathbf{X}_{i,\ast} \, \bm{\theta}$ is a
|
||||
non-random scalar. To specify the parameters of the distribution of
|
||||
$\mathbf{y}_i$ we need to calculate its first two moments.
|
||||
|
||||
@@ -85,7 +85,7 @@ We approximate this function with our model from the solution of the linear regr
|
||||
function $f$ is approximated by $\bm{\tilde{y}}$ where we want to minimize $(\bm{y}-\bm{\tilde{y}})^2$, our MSE, with
|
||||
!bt
|
||||
\[
|
||||
\bm{\tilde{y}} = \bm{X}\bm{\beta}.
|
||||
\bm{\tilde{y}} = \bm{X}\bm{\theta}.
|
||||
\]
|
||||
!et
|
||||
|
||||
@@ -96,8 +96,8 @@ We can calculate the expectation value of $\bm{y}$ for a given element $i$
|
||||
!bt
|
||||
\begin{align*}
|
||||
\mathbb{E}(y_i) & =
|
||||
\mathbb{E}(\mathbf{X}_{i, \ast} \, \bm{\beta}) + \mathbb{E}(\varepsilon_i)
|
||||
\, \, \, = \, \, \, \mathbf{X}_{i, \ast} \, \beta,
|
||||
\mathbb{E}(\mathbf{X}_{i, \ast} \, \bm{\theta}) + \mathbb{E}(\varepsilon_i)
|
||||
\, \, \, = \, \, \, \mathbf{X}_{i, \ast} \, \theta,
|
||||
\end{align*}
|
||||
!et
|
||||
while
|
||||
@@ -106,97 +106,97 @@ its variance is
|
||||
\begin{align*} \mbox{Var}(y_i) & = \mathbb{E} \{ [y_i
|
||||
- \mathbb{E}(y_i)]^2 \} \, \, \, = \, \, \, \mathbb{E} ( y_i^2 ) -
|
||||
[\mathbb{E}(y_i)]^2 \\ & = \mathbb{E} [ ( \mathbf{X}_{i, \ast} \,
|
||||
\beta + \varepsilon_i )^2] - ( \mathbf{X}_{i, \ast} \, \bm{\beta})^2 \\ &
|
||||
= \mathbb{E} [ ( \mathbf{X}_{i, \ast} \, \bm{\beta})^2 + 2 \varepsilon_i
|
||||
\mathbf{X}_{i, \ast} \, \bm{\beta} + \varepsilon_i^2 ] - ( \mathbf{X}_{i,
|
||||
\ast} \, \beta)^2 \\ & = ( \mathbf{X}_{i, \ast} \, \bm{\beta})^2 + 2
|
||||
\mathbb{E}(\varepsilon_i) \mathbf{X}_{i, \ast} \, \bm{\beta} +
|
||||
\mathbb{E}(\varepsilon_i^2 ) - ( \mathbf{X}_{i, \ast} \, \bm{\beta})^2
|
||||
\theta + \varepsilon_i )^2] - ( \mathbf{X}_{i, \ast} \, \bm{\theta})^2 \\ &
|
||||
= \mathbb{E} [ ( \mathbf{X}_{i, \ast} \, \bm{\theta})^2 + 2 \varepsilon_i
|
||||
\mathbf{X}_{i, \ast} \, \bm{\theta} + \varepsilon_i^2 ] - ( \mathbf{X}_{i,
|
||||
\ast} \, \theta)^2 \\ & = ( \mathbf{X}_{i, \ast} \, \bm{\theta})^2 + 2
|
||||
\mathbb{E}(\varepsilon_i) \mathbf{X}_{i, \ast} \, \bm{\theta} +
|
||||
\mathbb{E}(\varepsilon_i^2 ) - ( \mathbf{X}_{i, \ast} \, \bm{\theta})^2
|
||||
\\ & = \mathbb{E}(\varepsilon_i^2 ) \, \, \, = \, \, \,
|
||||
\mbox{Var}(\varepsilon_i) \, \, \, = \, \, \, \sigma^2.
|
||||
\end{align*}
|
||||
!et
|
||||
Hence, $y_i \sim \mathcal{N}( \mathbf{X}_{i, \ast} \, \bm{\beta}, \sigma^2)$, that is $\bm{y}$ follows a normal distribution with
|
||||
mean value $\bm{X}\bm{\beta}$ and variance $\sigma^2$ (not be confused with the singular values of the SVD).
|
||||
Hence, $y_i \sim \mathcal{N}( \mathbf{X}_{i, \ast} \, \bm{\theta}, \sigma^2)$, that is $\bm{y}$ follows a normal distribution with
|
||||
mean value $\bm{X}\bm{\theta}$ and variance $\sigma^2$ (not be confused with the singular values of the SVD).
|
||||
|
||||
!split
|
||||
===== Expectation value and variance for $\bm{\beta}$ =====
|
||||
===== Expectation value and variance for $\bm{\theta}$ =====
|
||||
|
||||
With the OLS expressions for the optimal parameters $\bm{\hat{\beta}}$ we can evaluate the expectation value
|
||||
With the OLS expressions for the optimal parameters $\bm{\hat{\theta}}$ we can evaluate the expectation value
|
||||
!bt
|
||||
\[
|
||||
\mathbb{E}(\bm{\hat{\beta}}) = \mathbb{E}[ (\mathbf{X}^{\top} \mathbf{X})^{-1}\mathbf{X}^{T} \mathbf{Y}]=(\mathbf{X}^{T} \mathbf{X})^{-1}\mathbf{X}^{T} \mathbb{E}[ \mathbf{Y}]=(\mathbf{X}^{T} \mathbf{X})^{-1} \mathbf{X}^{T}\mathbf{X}\bm{\beta}=\bm{\beta}.
|
||||
\mathbb{E}(\bm{\hat{\theta}}) = \mathbb{E}[ (\mathbf{X}^{\top} \mathbf{X})^{-1}\mathbf{X}^{T} \mathbf{Y}]=(\mathbf{X}^{T} \mathbf{X})^{-1}\mathbf{X}^{T} \mathbb{E}[ \mathbf{Y}]=(\mathbf{X}^{T} \mathbf{X})^{-1} \mathbf{X}^{T}\mathbf{X}\bm{\theta}=\bm{\theta}.
|
||||
\]
|
||||
!et
|
||||
This means that the estimator of the regression parameters is unbiased.
|
||||
|
||||
We can also calculate the variance
|
||||
|
||||
The variance of the optimal value $\bm{\hat{\beta}}$ is
|
||||
The variance of the optimal value $\bm{\hat{\theta}}$ is
|
||||
!bt
|
||||
\begin{eqnarray*}
|
||||
\mbox{Var}(\bm{\hat{\beta}}) & = & \mathbb{E} \{ [\bm{\beta} - \mathbb{E}(\bm{\beta})] [\bm{\beta} - \mathbb{E}(\bm{\beta})]^{T} \}
|
||||
\mbox{Var}(\bm{\hat{\theta}}) & = & \mathbb{E} \{ [\bm{\theta} - \mathbb{E}(\bm{\theta})] [\bm{\theta} - \mathbb{E}(\bm{\theta})]^{T} \}
|
||||
\\
|
||||
& = & \mathbb{E} \{ [(\mathbf{X}^{T} \mathbf{X})^{-1} \, \mathbf{X}^{T} \mathbf{Y} - \bm{\beta}] \, [(\mathbf{X}^{T} \mathbf{X})^{-1} \, \mathbf{X}^{T} \mathbf{Y} - \bm{\beta}]^{T} \}
|
||||
& = & \mathbb{E} \{ [(\mathbf{X}^{T} \mathbf{X})^{-1} \, \mathbf{X}^{T} \mathbf{Y} - \bm{\theta}] \, [(\mathbf{X}^{T} \mathbf{X})^{-1} \, \mathbf{X}^{T} \mathbf{Y} - \bm{\theta}]^{T} \}
|
||||
\\
|
||||
% & = & \mathbb{E} \{ [(\mathbf{X}^{T} \mathbf{X})^{-1} \, \mathbf{X}^{T} \mathbf{Y}] \, [(\mathbf{X}^{T} \mathbf{X})^{-1} \, \mathbf{X}^{T} \mathbf{Y}]^{T} \} - \bm{\beta} \, \bm{\beta}^{T}
|
||||
% & = & \mathbb{E} \{ [(\mathbf{X}^{T} \mathbf{X})^{-1} \, \mathbf{X}^{T} \mathbf{Y}] \, [(\mathbf{X}^{T} \mathbf{X})^{-1} \, \mathbf{X}^{T} \mathbf{Y}]^{T} \} - \bm{\theta} \, \bm{\theta}^{T}
|
||||
% \\
|
||||
% & = & \mathbb{E} \{ (\mathbf{X}^{T} \mathbf{X})^{-1} \, \mathbf{X}^{T} \mathbf{Y} \, \mathbf{Y}^{T} \, \mathbf{X} \, (\mathbf{X}^{T} \mathbf{X})^{-1} \} - \bm{\beta} \, \bm{\beta}^{T}
|
||||
% & = & \mathbb{E} \{ (\mathbf{X}^{T} \mathbf{X})^{-1} \, \mathbf{X}^{T} \mathbf{Y} \, \mathbf{Y}^{T} \, \mathbf{X} \, (\mathbf{X}^{T} \mathbf{X})^{-1} \} - \bm{\theta} \, \bm{\theta}^{T}
|
||||
% \\
|
||||
& = & (\mathbf{X}^{T} \mathbf{X})^{-1} \, \mathbf{X}^{T} \, \mathbb{E} \{ \mathbf{Y} \, \mathbf{Y}^{T} \} \, \mathbf{X} \, (\mathbf{X}^{T} \mathbf{X})^{-1} - \bm{\beta} \, \bm{\beta}^{T}
|
||||
& = & (\mathbf{X}^{T} \mathbf{X})^{-1} \, \mathbf{X}^{T} \, \mathbb{E} \{ \mathbf{Y} \, \mathbf{Y}^{T} \} \, \mathbf{X} \, (\mathbf{X}^{T} \mathbf{X})^{-1} - \bm{\theta} \, \bm{\theta}^{T}
|
||||
\\
|
||||
& = & (\mathbf{X}^{T} \mathbf{X})^{-1} \, \mathbf{X}^{T} \, \{ \mathbf{X} \, \bm{\beta} \, \bm{\beta}^{T} \, \mathbf{X}^{T} + \sigma^2 \} \, \mathbf{X} \, (\mathbf{X}^{T} \mathbf{X})^{-1} - \bm{\beta} \, \bm{\beta}^{T}
|
||||
& = & (\mathbf{X}^{T} \mathbf{X})^{-1} \, \mathbf{X}^{T} \, \{ \mathbf{X} \, \bm{\theta} \, \bm{\theta}^{T} \, \mathbf{X}^{T} + \sigma^2 \} \, \mathbf{X} \, (\mathbf{X}^{T} \mathbf{X})^{-1} - \bm{\theta} \, \bm{\theta}^{T}
|
||||
% \\
|
||||
% & = & (\mathbf{X}^T \mathbf{X})^{-1} \, \mathbf{X}^T \, \mathbf{X} \, \bm{\beta} \, \bm{\beta}^T \, \mathbf{X}^T \, \mathbf{X} \, (\mathbf{X}^T % \mathbf{X})^{-1}
|
||||
% & = & (\mathbf{X}^T \mathbf{X})^{-1} \, \mathbf{X}^T \, \mathbf{X} \, \bm{\theta} \, \bm{\theta}^T \, \mathbf{X}^T \, \mathbf{X} \, (\mathbf{X}^T % \mathbf{X})^{-1}
|
||||
% \\
|
||||
% & & + \, \, \sigma^2 \, (\mathbf{X}^T \mathbf{X})^{-1} \, \mathbf{X}^T \, \mathbf{X} \, (\mathbf{X}^T \mathbf{X})^{-1} - \bm{\beta} \bm{\beta}^T
|
||||
% & & + \, \, \sigma^2 \, (\mathbf{X}^T \mathbf{X})^{-1} \, \mathbf{X}^T \, \mathbf{X} \, (\mathbf{X}^T \mathbf{X})^{-1} - \bm{\theta} \bm{\theta}^T
|
||||
\\
|
||||
& = & \bm{\beta} \, \bm{\beta}^{T} + \sigma^2 \, (\mathbf{X}^{T} \mathbf{X})^{-1} - \bm{\beta} \, \bm{\beta}^{T}
|
||||
& = & \bm{\theta} \, \bm{\theta}^{T} + \sigma^2 \, (\mathbf{X}^{T} \mathbf{X})^{-1} - \bm{\theta} \, \bm{\theta}^{T}
|
||||
\, \, \, = \, \, \, \sigma^2 \, (\mathbf{X}^{T} \mathbf{X})^{-1},
|
||||
\end{eqnarray*}
|
||||
!et
|
||||
|
||||
where we have used that $\mathbb{E} (\mathbf{Y} \mathbf{Y}^{T}) =
|
||||
\mathbf{X} \, \bm{\beta} \, \bm{\beta}^{T} \, \mathbf{X}^{T} +
|
||||
\sigma^2 \, \mathbf{I}_{nn}$. From $\mbox{Var}(\bm{\beta}) = \sigma^2
|
||||
\mathbf{X} \, \bm{\theta} \, \bm{\theta}^{T} \, \mathbf{X}^{T} +
|
||||
\sigma^2 \, \mathbf{I}_{nn}$. From $\mbox{Var}(\bm{\theta}) = \sigma^2
|
||||
\, (\mathbf{X}^{T} \mathbf{X})^{-1}$, one obtains an estimate of the
|
||||
variance of the estimate of the $j$-th regression coefficient:
|
||||
$\bm{\sigma}^2 (\bm{\beta}_j ) = \bm{\sigma}^2 [(\mathbf{X}^{T} \mathbf{X})^{-1}]_{jj} $. This may be used to
|
||||
$\bm{\sigma}^2 (\bm{\theta}_j ) = \bm{\sigma}^2 [(\mathbf{X}^{T} \mathbf{X})^{-1}]_{jj} $. This may be used to
|
||||
construct a confidence interval for the estimates.
|
||||
|
||||
|
||||
In a similar way, we can obtain analytical expressions for say the
|
||||
expectation values of the parameters $\bm{\beta}$ and their variance
|
||||
expectation values of the parameters $\bm{\theta}$ and their variance
|
||||
when we employ Ridge regression, allowing us again to define a confidence interval.
|
||||
|
||||
It is rather straightforward to show that
|
||||
!bt
|
||||
\[
|
||||
\mathbb{E} \big[ \bm{\beta}^{\mathrm{Ridge}} \big]=(\mathbf{X}^{T} \mathbf{X} + \lambda \mathbf{I}_{pp})^{-1} (\mathbf{X}^{\top} \mathbf{X})\bm{\beta}^{\mathrm{OLS}}.
|
||||
\mathbb{E} \big[ \bm{\theta}^{\mathrm{Ridge}} \big]=(\mathbf{X}^{T} \mathbf{X} + \lambda \mathbf{I}_{pp})^{-1} (\mathbf{X}^{\top} \mathbf{X})\bm{\theta}^{\mathrm{OLS}}.
|
||||
\]
|
||||
!et
|
||||
We see clearly that
|
||||
$\mathbb{E} \big[ \bm{\beta}^{\mathrm{Ridge}} \big] \not= \bm{\beta}^{\mathrm{OLS}}$ for any $\lambda > 0$. We say then that the ridge estimator is biased.
|
||||
$\mathbb{E} \big[ \bm{\theta}^{\mathrm{Ridge}} \big] \not= \bm{\theta}^{\mathrm{OLS}}$ for any $\lambda > 0$. We say then that the ridge estimator is biased.
|
||||
|
||||
We can also compute the variance as
|
||||
|
||||
!bt
|
||||
\[
|
||||
\mbox{Var}[\bm{\beta}^{\mathrm{Ridge}}]=\sigma^2[ \mathbf{X}^{T} \mathbf{X} + \lambda \mathbf{I} ]^{-1} \mathbf{X}^{T} \mathbf{X} \{ [ \mathbf{X}^{\top} \mathbf{X} + \lambda \mathbf{I} ]^{-1}\}^{T},
|
||||
\mbox{Var}[\bm{\theta}^{\mathrm{Ridge}}]=\sigma^2[ \mathbf{X}^{T} \mathbf{X} + \lambda \mathbf{I} ]^{-1} \mathbf{X}^{T} \mathbf{X} \{ [ \mathbf{X}^{\top} \mathbf{X} + \lambda \mathbf{I} ]^{-1}\}^{T},
|
||||
\]
|
||||
!et
|
||||
and it is easy to see that if the parameter $\lambda$ goes to infinity then the variance of Ridge parameters $\bm{\beta}$ goes to zero.
|
||||
and it is easy to see that if the parameter $\lambda$ goes to infinity then the variance of Ridge parameters $\bm{\theta}$ goes to zero.
|
||||
|
||||
With this, we can compute the difference
|
||||
|
||||
!bt
|
||||
\[
|
||||
\mbox{Var}[\bm{\beta}^{\mathrm{OLS}}]-\mbox{Var}(\bm{\beta}^{\mathrm{Ridge}})=\sigma^2 [ \mathbf{X}^{T} \mathbf{X} + \lambda \mathbf{I} ]^{-1}[ 2\lambda\mathbf{I} + \lambda^2 (\mathbf{X}^{T} \mathbf{X})^{-1} ] \{ [ \mathbf{X}^{T} \mathbf{X} + \lambda \mathbf{I} ]^{-1}\}^{T}.
|
||||
\mbox{Var}[\bm{\theta}^{\mathrm{OLS}}]-\mbox{Var}(\bm{\theta}^{\mathrm{Ridge}})=\sigma^2 [ \mathbf{X}^{T} \mathbf{X} + \lambda \mathbf{I} ]^{-1}[ 2\lambda\mathbf{I} + \lambda^2 (\mathbf{X}^{T} \mathbf{X})^{-1} ] \{ [ \mathbf{X}^{T} \mathbf{X} + \lambda \mathbf{I} ]^{-1}\}^{T}.
|
||||
\]
|
||||
!et
|
||||
The difference is non-negative definite since each component of the
|
||||
matrix product is non-negative definite.
|
||||
This means the variance we obtain with the standard OLS will always for $\lambda > 0$ be larger than the variance of $\bm{\beta}$ obtained with the Ridge estimator. This has interesting consequences when we discuss the so-called bias-variance trade-off below.
|
||||
This means the variance we obtain with the standard OLS will always for $\lambda > 0$ be larger than the variance of $\bm{\theta}$ obtained with the Ridge estimator. This has interesting consequences when we discuss the so-called bias-variance trade-off below.
|
||||
|
||||
|
||||
!split
|
||||
@@ -209,15 +209,15 @@ distribution with zero mean value and an undetermined variance
|
||||
$\sigma^2$.
|
||||
|
||||
We found above that the outputs $\bm{y}$ have a mean value given by
|
||||
$\bm{X}\hat{\bm{\beta}}$ and variance $\sigma^2$. Since the entries to
|
||||
$\bm{X}\hat{\bm{\theta}}$ and variance $\sigma^2$. Since the entries to
|
||||
the design matrix are not stochastic variables, we can assume that the
|
||||
probability distribution of our targets is also a normal distribution
|
||||
but now with mean value $\bm{X}\hat{\bm{\beta}}$. This means that a
|
||||
but now with mean value $\bm{X}\hat{\bm{\theta}}$. This means that a
|
||||
single output $y_i$ is given by the Gaussian distribution
|
||||
|
||||
!bt
|
||||
\[
|
||||
y_i\sim \mathcal{N}(\bm{X}_{i,*}\bm{\beta}, \sigma^2)=\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\bm{X}_{i,*}\bm{\beta})^2}{2\sigma^2}\right]}.
|
||||
y_i\sim \mathcal{N}(\bm{X}_{i,*}\bm{\theta}, \sigma^2)=\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\bm{X}_{i,*}\bm{\theta})^2}{2\sigma^2}\right]}.
|
||||
\]
|
||||
!et
|
||||
|
||||
@@ -228,16 +228,16 @@ We assume now that the various $y_i$ values are stochastically distributed accor
|
||||
We define this distribution as
|
||||
!bt
|
||||
\[
|
||||
p(y_i, \bm{X}\vert\bm{\beta})=\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\bm{X}_{i,*}\bm{\beta})^2}{2\sigma^2}\right]},
|
||||
p(y_i, \bm{X}\vert\bm{\theta})=\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\bm{X}_{i,*}\bm{\theta})^2}{2\sigma^2}\right]},
|
||||
\]
|
||||
!et
|
||||
which reads as finding the likelihood of an event $y_i$ with the input variables $\bm{X}$ given the parameters (to be determined) $\bm{\beta}$.
|
||||
which reads as finding the likelihood of an event $y_i$ with the input variables $\bm{X}$ given the parameters (to be determined) $\bm{\theta}$.
|
||||
|
||||
Since these events are assumed to be independent and identicall distributed we can build the probability distribution function (PDF) for all possible event $\bm{y}$ as the product of the single events, that is we have
|
||||
|
||||
!bt
|
||||
\[
|
||||
p(\bm{y},\bm{X}\vert\bm{\beta})=\prod_{i=0}^{n-1}\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\bm{X}_{i,*}\bm{\beta})^2}{2\sigma^2}\right]}=\prod_{i=0}^{n-1}p(y_i,\bm{X}\vert\bm{\beta}).
|
||||
p(\bm{y},\bm{X}\vert\bm{\theta})=\prod_{i=0}^{n-1}\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\bm{X}_{i,*}\bm{\theta})^2}{2\sigma^2}\right]}=\prod_{i=0}^{n-1}p(y_i,\bm{X}\vert\bm{\theta}).
|
||||
\]
|
||||
!et
|
||||
|
||||
@@ -252,11 +252,11 @@ In the more general case the various inputs should be replaced by the possible f
|
||||
We can now rewrite the above probability as
|
||||
!bt
|
||||
\[
|
||||
p(\bm{D}\vert\bm{\beta})=\prod_{i=0}^{n-1}\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\bm{X}_{i,*}\bm{\beta})^2}{2\sigma^2}\right]}.
|
||||
p(\bm{D}\vert\bm{\theta})=\prod_{i=0}^{n-1}\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\bm{X}_{i,*}\bm{\theta})^2}{2\sigma^2}\right]}.
|
||||
\]
|
||||
!et
|
||||
|
||||
It is a conditional probability (see below) and reads as the likelihood of a domain of events $\bm{D}$ given a set of parameters $\bm{\beta}$.
|
||||
It is a conditional probability (see below) and reads as the likelihood of a domain of events $\bm{D}$ given a set of parameters $\bm{\theta}$.
|
||||
|
||||
!split
|
||||
===== Maximum Likelihood Estimation (MLE) =====
|
||||
@@ -269,7 +269,7 @@ data is the most probable.
|
||||
|
||||
|
||||
We will assume here that our events are given by the above Gaussian
|
||||
distribution and we will determine the optimal parameters $\beta$ by
|
||||
distribution and we will determine the optimal parameters $\theta$ by
|
||||
maximizing the above PDF. However, computing the derivatives of a
|
||||
product function is cumbersome and can easily lead to overflow and/or
|
||||
underflowproblems, with potentials for loss of numerical precision.
|
||||
@@ -293,27 +293,27 @@ We could now define a new cost function to minimize, namely the negative logarit
|
||||
|
||||
!bt
|
||||
\[
|
||||
C(\bm{\beta}=-\log{\prod_{i=0}^{n-1}p(y_i,\bm{X}\vert\bm{\beta})}=-\sum_{i=0}^{n-1}\log{p(y_i,\bm{X}\vert\bm{\beta})},
|
||||
C(\bm{\theta}=-\log{\prod_{i=0}^{n-1}p(y_i,\bm{X}\vert\bm{\theta})}=-\sum_{i=0}^{n-1}\log{p(y_i,\bm{X}\vert\bm{\theta})},
|
||||
\]
|
||||
!et
|
||||
which becomes
|
||||
!bt
|
||||
\[
|
||||
C(\bm{\beta}=\frac{n}{2}\log{2\pi\sigma^2}+\frac{\vert\vert (\bm{y}-\bm{X}\bm{\beta})\vert\vert_2^2}{2\sigma^2}.
|
||||
C(\bm{\theta}=\frac{n}{2}\log{2\pi\sigma^2}+\frac{\vert\vert (\bm{y}-\bm{X}\bm{\theta})\vert\vert_2^2}{2\sigma^2}.
|
||||
\]
|
||||
!et
|
||||
|
||||
Taking the derivative of the *new* cost function with respect to the parameters $\beta$ we recognize our familiar OLS equation, namely
|
||||
Taking the derivative of the *new* cost function with respect to the parameters $\theta$ we recognize our familiar OLS equation, namely
|
||||
|
||||
!bt
|
||||
\[
|
||||
\bm{X}^T\left(\bm{y}-\bm{X}\bm{\beta}\right) =0,
|
||||
\bm{X}^T\left(\bm{y}-\bm{X}\bm{\theta}\right) =0,
|
||||
\]
|
||||
!et
|
||||
which leads to the well-known OLS equation for the optimal paramters $\beta$
|
||||
which leads to the well-known OLS equation for the optimal paramters $\theta$
|
||||
!bt
|
||||
\[
|
||||
\hat{\bm{\beta}}^{\mathrm{OLS}}=\left(\bm{X}^T\bm{X}\right)^{-1}\bm{X}^T\bm{y}!
|
||||
\hat{\bm{\theta}}^{\mathrm{OLS}}=\left(\bm{X}^T\bm{X}\right)^{-1}\bm{X}^T\bm{y}!
|
||||
\]
|
||||
!et
|
||||
|
||||
@@ -601,13 +601,13 @@ $\tilde{p}(x)$.
|
||||
|
||||
Confidence intervals are used in statistics and represent a type of estimate
|
||||
computed from the observed data. This gives a range of values for an
|
||||
unknown parameter such as the parameters $\bm{\beta}$ from linear regression.
|
||||
unknown parameter such as the parameters $\bm{\theta}$ from linear regression.
|
||||
|
||||
With the OLS expressions for the parameters $\bm{\beta}$ we found
|
||||
$\mathbb{E}(\bm{\beta}) = \bm{\beta}$, which means that the estimator of the regression parameters is unbiased.
|
||||
With the OLS expressions for the parameters $\bm{\theta}$ we found
|
||||
$\mathbb{E}(\bm{\theta}) = \bm{\theta}$, which means that the estimator of the regression parameters is unbiased.
|
||||
|
||||
In the exercises this week we show that the variance of the estimate of the $j$-th regression coefficient is
|
||||
$\bm{\sigma}^2 (\bm{\beta}_j ) = \bm{\sigma}^2 [(\mathbf{X}^{T} \mathbf{X})^{-1}]_{jj} $.
|
||||
$\bm{\sigma}^2 (\bm{\theta}_j ) = \bm{\sigma}^2 [(\mathbf{X}^{T} \mathbf{X})^{-1}]_{jj} $.
|
||||
|
||||
This quantity can be used to
|
||||
construct a confidence interval for the estimates.
|
||||
@@ -616,14 +616,14 @@ construct a confidence interval for the estimates.
|
||||
!split
|
||||
===== Standard Approach based on the Normal Distribution =====
|
||||
|
||||
We will assume that the parameters $\beta$ follow a normal
|
||||
We will assume that the parameters $\theta$ follow a normal
|
||||
distribution. We can then define the confidence interval. Here we will be using as
|
||||
shorthands $\mu_{\beta}$ for the above mean value and $\sigma_{\beta}$
|
||||
shorthands $\mu_{\theta}$ for the above mean value and $\sigma_{\theta}$
|
||||
for the standard deviation. We have then a confidence interval
|
||||
|
||||
!bt
|
||||
\[
|
||||
\left(\mu_{\beta}\pm \frac{z\sigma_{\beta}}{\sqrt{n}}\right),
|
||||
\left(\mu_{\theta}\pm \frac{z\sigma_{\theta}}{\sqrt{n}}\right),
|
||||
\]
|
||||
!et
|
||||
|
||||
@@ -642,11 +642,11 @@ Bootstrap method, why it works and various theorems related to it.
|
||||
!split
|
||||
===== Resampling methods: Bootstrap background =====
|
||||
|
||||
Since $\widehat{\beta} = \widehat{\beta}(\bm{X})$ is a function of random variables,
|
||||
$\widehat{\beta}$ itself must be a random variable. Thus it has
|
||||
Since $\widehat{\theta} = \widehat{\theta}(\bm{X})$ is a function of random variables,
|
||||
$\widehat{\theta}$ itself must be a random variable. Thus it has
|
||||
a pdf, call this function $p(\bm{t})$. The aim of the bootstrap is to
|
||||
estimate $p(\bm{t})$ by the relative frequency of
|
||||
$\widehat{\beta}$. You can think of this as using a histogram
|
||||
$\widehat{\theta}$. You can think of this as using a histogram
|
||||
in the place of $p(\bm{t})$. If the relative frequency closely
|
||||
resembles $p(\vec{t})$, then using numerics, it is straight forward to
|
||||
estimate all the interesting parameters of $p(\bm{t})$ using point
|
||||
@@ -656,17 +656,17 @@ estimators.
|
||||
!split
|
||||
===== Resampling methods: More Bootstrap background =====
|
||||
|
||||
In the case that $\widehat{\beta}$ has
|
||||
In the case that $\widehat{\theta}$ has
|
||||
more than one component, and the components are independent, we use the
|
||||
same estimator on each component separately. If the probability
|
||||
density function of $X_i$, $p(x)$, had been known, then it would have
|
||||
been straightforward to do this by:
|
||||
o Drawing lots of numbers from $p(x)$, suppose we call one such set of numbers $(X_1^*, X_2^*, \cdots, X_n^*)$.
|
||||
o Then using these numbers, we could compute a replica of $\widehat{\beta}$ called $\widehat{\beta}^*$.
|
||||
o Then using these numbers, we could compute a replica of $\widehat{\theta}$ called $\widehat{\theta}^*$.
|
||||
|
||||
By repeated use of the above two points, many
|
||||
estimates of $\widehat{\beta}$ can be obtained. The
|
||||
idea is to use the relative frequency of $\widehat{\beta}^*$
|
||||
estimates of $\widehat{\theta}$ can be obtained. The
|
||||
idea is to use the relative frequency of $\widehat{\theta}^*$
|
||||
(think of a histogram) as an estimate of $p(\bm{t})$.
|
||||
|
||||
!split
|
||||
@@ -692,18 +692,18 @@ The independent bootstrap works like this:
|
||||
|
||||
o Draw with replacement $n$ numbers for the observed variables $\bm{x} = (x_1,x_2,\cdots,x_n)$.
|
||||
o Define a vector $\bm{x}^*$ containing the values which were drawn from $\bm{x}$.
|
||||
o Using the vector $\bm{x}^*$ compute $\widehat{\beta}^*$ by evaluating $\widehat \beta$ under the observations $\bm{x}^*$.
|
||||
o Using the vector $\bm{x}^*$ compute $\widehat{\theta}^*$ by evaluating $\widehat \theta$ under the observations $\bm{x}^*$.
|
||||
o Repeat this process $k$ times.
|
||||
|
||||
When you are done, you can draw a histogram of the relative frequency
|
||||
of $\widehat \beta^*$. This is your estimate of the probability
|
||||
of $\widehat \theta^*$. This is your estimate of the probability
|
||||
distribution $p(t)$. Using this probability distribution you can
|
||||
estimate any statistics thereof. In principle you never draw the
|
||||
histogram of the relative frequency of $\widehat{\beta}^*$. Instead
|
||||
histogram of the relative frequency of $\widehat{\theta}^*$. Instead
|
||||
you use the estimators corresponding to the statistic of interest. For
|
||||
example, if you are interested in estimating the variance of $\widehat
|
||||
\beta$, apply the etsimator $\widehat \sigma^2$ to the values
|
||||
$\widehat \beta^*$.
|
||||
\theta$, apply the etsimator $\widehat \sigma^2$ to the values
|
||||
$\widehat \theta^*$.
|
||||
|
||||
|
||||
!split
|
||||
@@ -791,13 +791,13 @@ where $\epsilon$ is normally distributed with mean zero and standard deviation $
|
||||
|
||||
In our derivation of the ordinary least squares method we defined then
|
||||
an approximation to the function $f$ in terms of the parameters
|
||||
$\bm{\beta}$ and the design matrix $\bm{X}$ which embody our model,
|
||||
that is $\bm{\tilde{y}}=\bm{X}\bm{\beta}$.
|
||||
$\bm{\theta}$ and the design matrix $\bm{X}$ which embody our model,
|
||||
that is $\bm{\tilde{y}}=\bm{X}\bm{\theta}$.
|
||||
|
||||
Thereafter we found the parameters $\bm{\beta}$ by optimizing the means squared error via the so-called cost function
|
||||
Thereafter we found the parameters $\bm{\theta}$ by optimizing the means squared error via the so-called cost function
|
||||
!bt
|
||||
\[
|
||||
C(\bm{X},\bm{\beta}) =\frac{1}{n}\sum_{i=0}^{n-1}(y_i-\tilde{y}_i)^2=\mathbb{E}\left[(\bm{y}-\bm{\tilde{y}})^2\right].
|
||||
C(\bm{X},\bm{\theta}) =\frac{1}{n}\sum_{i=0}^{n-1}(y_i-\tilde{y}_i)^2=\mathbb{E}\left[(\bm{y}-\bm{\tilde{y}})^2\right].
|
||||
\]
|
||||
!et
|
||||
|
||||
|
||||
Reference in New Issue
Block a user