update exercises week 38

This commit is contained in:
Morten Hjorth-Jensen
2025-09-16 03:57:50 +02:00
parent 9f547ac70d
commit 3ca128990b
7 changed files with 10 additions and 24 deletions
Binary file not shown.
@@ -178,20 +178,12 @@
"We see that $\\mathbb{E} \\big[ \\hat{\\boldsymbol{\\beta}}^{\\mathrm{Ridge}} \\big] \\not= \\mathbb{E} \\big[\\hat{\\boldsymbol{\\beta}}^{\\mathrm{OLS}}\\big ]$ for any $\\lambda > 0$.\n"
]
},
{
"cell_type": "markdown",
"id": "65f6f914",
"metadata": {},
"source": [
"**b)** Why do we say that Ridge regression gives a biased estimate? Is this a problem?\n"
]
},
{
"cell_type": "markdown",
"id": "b4e721fc",
"metadata": {},
"source": [
"**c)** Show that the variance is\n"
"**b)** Show that the variance is\n"
]
},
{
@@ -297,7 +289,8 @@
"source": [
"$$\n",
"\\mathrm{var}[\\tilde{y}]=\\mathbb{E}\\left[\\left(\\tilde{\\boldsymbol{y}}-\\mathbb{E}\\left[\\boldsymbol{\\tilde{y}}\\right]\\right)^2\\right]=\\frac{1}{n}\\sum_i(\\tilde{y}_i-\\mathbb{E}\\left[\\boldsymbol{\\tilde{y}}\\right])^2.\n",
"$$\n"
"$$\n",
"In order to arrive at the equation for the bias, we have to approximate the unknown function $f$ with the output/target values $y$."
]
},
{
@@ -480,8 +480,7 @@ A given parameter <span class="math notranslate nohighlight">\({\boldsymbol{\hat
\mathbb{E} \big[ \hat{\boldsymbol{\beta}}^{\mathrm{Ridge}} \big]=(\mathbf{X}^{T} \mathbf{X} + \lambda \mathbf{I}_{pp})^{-1} (\mathbf{X}^{\top} \mathbf{X})\boldsymbol{\beta}
\]</div>
<p>We see that <span class="math notranslate nohighlight">\(\mathbb{E} \big[ \hat{\boldsymbol{\beta}}^{\mathrm{Ridge}} \big] \not= \mathbb{E} \big[\hat{\boldsymbol{\beta}}^{\mathrm{OLS}}\big ]\)</span> for any <span class="math notranslate nohighlight">\(\lambda &gt; 0\)</span>.</p>
<p><strong>b)</strong> Why do we say that Ridge regression gives a biased estimate? Is this a problem?</p>
<p><strong>c)</strong> Show that the variance is</p>
<p><strong>b)</strong> Show that the variance is</p>
<div class="math notranslate nohighlight">
\[
\mathbf{Var}[\hat{\boldsymbol{\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}
@@ -517,6 +516,7 @@ C(\boldsymbol{X},\boldsymbol{\beta}) =\frac{1}{n}\sum_{i=0}^{n-1}(y_i-\tilde{y}_
\[
\mathrm{var}[\tilde{y}]=\mathbb{E}\left[\left(\tilde{\boldsymbol{y}}-\mathbb{E}\left[\boldsymbol{\tilde{y}}\right]\right)^2\right]=\frac{1}{n}\sum_i(\tilde{y}_i-\mathbb{E}\left[\boldsymbol{\tilde{y}}\right])^2.
\]</div>
<p>In order to arrive at the equation for the bias, we have to approximate the unknown function <span class="math notranslate nohighlight">\(f\)</span> with the output/target values <span class="math notranslate nohighlight">\(y\)</span>.</p>
<p><strong>b)</strong> Explain what the terms mean and discuss their interpretations.</p>
</section>
<section id="exercise-4-computing-the-bias-and-variance">
File diff suppressed because one or more lines are too long
@@ -178,20 +178,12 @@
"We see that $\\mathbb{E} \\big[ \\hat{\\boldsymbol{\\beta}}^{\\mathrm{Ridge}} \\big] \\not= \\mathbb{E} \\big[\\hat{\\boldsymbol{\\beta}}^{\\mathrm{OLS}}\\big ]$ for any $\\lambda > 0$.\n"
]
},
{
"cell_type": "markdown",
"id": "65f6f914",
"metadata": {},
"source": [
"**b)** Why do we say that Ridge regression gives a biased estimate? Is this a problem?\n"
]
},
{
"cell_type": "markdown",
"id": "b4e721fc",
"metadata": {},
"source": [
"**c)** Show that the variance is\n"
"**b)** Show that the variance is\n"
]
},
{
@@ -297,7 +289,8 @@
"source": [
"$$\n",
"\\mathrm{var}[\\tilde{y}]=\\mathbb{E}\\left[\\left(\\tilde{\\boldsymbol{y}}-\\mathbb{E}\\left[\\boldsymbol{\\tilde{y}}\\right]\\right)^2\\right]=\\frac{1}{n}\\sum_i(\\tilde{y}_i-\\mathbb{E}\\left[\\boldsymbol{\\tilde{y}}\\right])^2.\n",
"$$\n"
"$$\n",
"In order to arrive at the equation for the bias, we have to approximate the unknown function $f$ with the output/target values $y$."
]
},
{
+1 -1
View File
@@ -290,7 +290,7 @@
"$$\n",
"\\mathrm{var}[\\tilde{y}]=\\mathbb{E}\\left[\\left(\\tilde{\\boldsymbol{y}}-\\mathbb{E}\\left[\\boldsymbol{\\tilde{y}}\\right]\\right)^2\\right]=\\frac{1}{n}\\sum_i(\\tilde{y}_i-\\mathbb{E}\\left[\\boldsymbol{\\tilde{y}}\\right])^2.\n",
"$$\n",
"In order to arrive at the last equation, we have to approximate the unknown function $f$ with the output/target values $y$."
"In order to arrive at the equation for the bias, we have to approximate the unknown function $f$ with the output/target values $y$."
]
},
{