From dc285d7ea31c667e339742d14d2d8952f88360d5 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Oct 2026 22:33:00 +0000 Subject: [PATCH 1/8] Name the gap between a prediction function and the conditional mean Finish the prediction-function relink in the two remarks that follow the definition. In the prediction-error split, write the gap with the shared deviation macro and name it as the deviation of the prediction function from the conditional mean, the convention in the macros notation-choices page. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_019xfc9nVFCSNv3sBfesyDpL --- _subfiles/_lem-prediction-error-split.qmd | 11 ++++++----- _subfiles/_rem-irreducible-risk.qmd | 2 +- _subfiles/_rem-reducible-risk.qmd | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/_subfiles/_lem-prediction-error-split.qmd b/_subfiles/_lem-prediction-error-split.qmd index 036d8aafa..448dec682 100644 --- a/_subfiles/_lem-prediction-error-split.qmd +++ b/_subfiles/_lem-prediction-error-split.qmd @@ -2,10 +2,11 @@ #### Prediction error splits at the conditional mean Let $\truemeanf{\Predvar} \eqdef \E{\Outvar \mid \Predvar}$ be the [conditional expectation function](#def-cond-expectation-function) of $\Outvar$ given $\Predvar$. -For any [prediction function](#def-prediction) $\predfnf{\Predvar}$, -the [prediction error](#def-prediction-error) splits as: +For any [prediction function](#def-prediction-function) $\predfnf{\Predvar}$, +the [prediction error](#def-prediction-error) is the prediction error of $\truemean$ +plus the [deviation](#def-deviation) of $\predfnf{\Predvar}$ from $\truemeanf{\Predvar}$: -$$\prederrf{\predfn} = \prederrf{\truemean} + \paren{\predfnf{\Predvar} - \truemeanf{\Predvar}}$$ +$$\prederrf{\predfn} = \prederrf{\truemean} + \devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}}$$ ::: @@ -16,9 +17,9 @@ $$ \prederrf{\predfn} &= \predfnf{\Predvar} - \Outvar && \text{(definition of } \prederrf{\predfn} \text{)} \\ -&= \paren{\truemeanf{\Predvar} - \Outvar} + \paren{\predfnf{\Predvar} - \truemeanf{\Predvar}} +&= \paren{\truemeanf{\Predvar} - \Outvar} + \devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}} && \text{(add and subtract } \truemeanf{\Predvar} \text{)} \\ -&= \prederrf{\truemean} + \paren{\predfnf{\Predvar} - \truemeanf{\Predvar}} +&= \prederrf{\truemean} + \devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}} && \text{(definition of } \prederrf{\truemean} \text{)} \ea $$ diff --git a/_subfiles/_rem-irreducible-risk.qmd b/_subfiles/_rem-irreducible-risk.qmd index 821b91fd4..51281ba38 100644 --- a/_subfiles/_rem-irreducible-risk.qmd +++ b/_subfiles/_rem-irreducible-risk.qmd @@ -4,7 +4,7 @@ The [residual risk](#def-irreducible-risk) depends only on the [joint distribution](random-variables.qmd#def-joint-distribution) of $(\Predvar, \Outvar)$ and not on the prediction function $\predfn$, so no choice of $\predfn$ can achieve a smaller risk. -It is the minimum only among [prediction functions](#def-prediction) of the given $\Predvar$: +It is the minimum only among [prediction functions](#def-prediction-function) of the given $\Predvar$: the [outcome](#def-outcome) may also depend on variables that $\Predvar$ leaves out, and those variables are part of the unexplained variation $\Outvar - \E{\Outvar \mid \Predvar}$. Measuring one of them and adding it to the variables in $\Predvar$ can lower the residual risk, diff --git a/_subfiles/_rem-reducible-risk.qmd b/_subfiles/_rem-reducible-risk.qmd index 62a5ed7d9..4a792f396 100644 --- a/_subfiles/_rem-reducible-risk.qmd +++ b/_subfiles/_rem-reducible-risk.qmd @@ -1,7 +1,7 @@ ::: {#rem-reducible-risk} #### When the reducible risk is zero -The [reducible risk](#def-reducible-risk) is zero if and only if the [prediction function](#def-prediction) $\predfn$ equals the [conditional expectation function](#def-cond-expectation-function) with [probability](probability-basics.qmd#def-probability) 1. +The [reducible risk](#def-reducible-risk) is zero if and only if the [prediction function](#def-prediction-function) $\predfn$ equals the [conditional expectation function](#def-cond-expectation-function) with [probability](probability-basics.qmd#def-probability) 1. $$ \E{\sqf{\E{\Outvar \mid \Predvar} - \predfnf{\Predvar}}} = 0 From fa0ad20cbb050d7fb8244e71d013af594888bda8 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Oct 2026 22:34:29 +0000 Subject: [PATCH 2/8] Define the prediction error of a prediction, not of a prediction function The prediction error is the prediction minus the outcome, so define it for a prediction (a constant or g(X)) with only that equation. Move the example and the note about the prediction function and the reference value to their own subfiles. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_019xfc9nVFCSNv3sBfesyDpL --- _subfiles/_def-prediction-error.qmd | 21 +++------------------ _subfiles/_exm-prediction-error.qmd | 10 ++++++++++ _subfiles/_rem-prediction-error.qmd | 10 ++++++++++ expectation.qmd | 8 ++++++++ 4 files changed, 31 insertions(+), 18 deletions(-) create mode 100644 _subfiles/_exm-prediction-error.qmd create mode 100644 _subfiles/_rem-prediction-error.qmd diff --git a/_subfiles/_def-prediction-error.qmd b/_subfiles/_def-prediction-error.qmd index a75998d89..118cabef5 100644 --- a/_subfiles/_def-prediction-error.qmd +++ b/_subfiles/_def-prediction-error.qmd @@ -1,24 +1,9 @@ :::{#def-prediction-error} #### Prediction error -A [prediction function](#def-prediction-function) $\predfnf{\Predvar}$ has as its [estimand](https://morrison-lab.github.io/sds/estimation.html#def-estimand) -the observed [outcome](#def-outcome) $\Outvar$ of a [new observation](#def-new-observation) with [input](#def-input) $\Predvar$, -not the [conditional mean](#def-cond-expectation-function) of that outcome. -The **prediction error** of $\predfn$ is the prediction minus that outcome: +The **prediction error** of a [prediction](#def-prediction) $\est{\Outvar}$ of an [outcome](#def-outcome) $\Outvar$ +is the prediction minus the outcome: -$$\prederrf{\predfn} \eqdef \predfnf{\Predvar} - \Outvar$$ - -::: - -{{< slidebreak >}} - -:::{#exm-prediction-error} -#### Prediction error in the best-predictor exercise - -In @exr-best-predictor, -consider the constant [prediction](#def-prediction) $\predfn_1\paren{\Predvar} = 3$. -Its [prediction error](#def-prediction-error) is $\prederrf{\predfn_1} = 3 - \Outvar$. -This is $3$ when $\Outvar = 0$. -It is $-3$ when $\Outvar = 6$. +$$\prederrf{\est{\Outvar}} \eqdef \est{\Outvar} - \Outvar$$ ::: diff --git a/_subfiles/_exm-prediction-error.qmd b/_subfiles/_exm-prediction-error.qmd new file mode 100644 index 000000000..944ea01bf --- /dev/null +++ b/_subfiles/_exm-prediction-error.qmd @@ -0,0 +1,10 @@ +:::{#exm-prediction-error} +#### Prediction error in the best-predictor exercise + +In @exr-best-predictor, +consider the constant [prediction](#def-prediction) $\predfn_1\paren{\Predvar} = 3$. +Its [prediction error](#def-prediction-error) is $\prederrf{\predfn_1} = 3 - \Outvar$. +This is $3$ when $\Outvar = 0$. +It is $-3$ when $\Outvar = 6$. + +::: diff --git a/_subfiles/_rem-prediction-error.qmd b/_subfiles/_rem-prediction-error.qmd new file mode 100644 index 000000000..8401e5a22 --- /dev/null +++ b/_subfiles/_rem-prediction-error.qmd @@ -0,0 +1,10 @@ +:::{#rem-prediction-error} +#### The prediction error of a prediction function + +A [prediction function](#def-prediction-function) $\predfn$ makes the prediction $\predfnf{\Predvar}$ for the outcome $\Outvar$ of a [new observation](#def-new-observation) with [input](#def-input) $\Predvar$. +We write $\prederrf{\predfn}$ for the [prediction error](#def-prediction-error) of that prediction, $\prederrf{\predfn} = \predfnf{\Predvar} - \Outvar$. + +The reference value in a prediction error is the observed outcome $\Outvar$, +not the [conditional mean](#def-cond-expectation-function) of that outcome. + +::: diff --git a/expectation.qmd b/expectation.qmd index 486ccf95c..492c675d0 100644 --- a/expectation.qmd +++ b/expectation.qmd @@ -119,6 +119,14 @@ format: {{< slidebreak >}} +{{< include pds/_subfiles/_exm-prediction-error.qmd >}} + +{{< slidebreak >}} + +{{< include pds/_subfiles/_rem-prediction-error.qmd >}} + +{{< slidebreak >}} + {{< include pds/_subfiles/_def-squared-error-risk.qmd >}} {{< slidebreak >}} From 2939bf51e98c305ed1111e09458dd679ab013c17 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Oct 2026 22:34:53 +0000 Subject: [PATCH 3/8] Link prediction and outcome in the prediction-error remark Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_019xfc9nVFCSNv3sBfesyDpL --- _subfiles/_rem-prediction-error.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_subfiles/_rem-prediction-error.qmd b/_subfiles/_rem-prediction-error.qmd index 8401e5a22..073fc3a93 100644 --- a/_subfiles/_rem-prediction-error.qmd +++ b/_subfiles/_rem-prediction-error.qmd @@ -1,7 +1,7 @@ :::{#rem-prediction-error} #### The prediction error of a prediction function -A [prediction function](#def-prediction-function) $\predfn$ makes the prediction $\predfnf{\Predvar}$ for the outcome $\Outvar$ of a [new observation](#def-new-observation) with [input](#def-input) $\Predvar$. +A [prediction function](#def-prediction-function) $\predfn$ makes the [prediction](#def-prediction) $\predfnf{\Predvar}$ for the [outcome](#def-outcome) $\Outvar$ of a [new observation](#def-new-observation) with [input](#def-input) $\Predvar$. We write $\prederrf{\predfn}$ for the [prediction error](#def-prediction-error) of that prediction, $\prederrf{\predfn} = \predfnf{\Predvar} - \Outvar$. The reference value in a prediction error is the observed outcome $\Outvar$, From 1d151c8d3e7f530fcf1f85702f6bd38c0382e02c Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Oct 2026 22:40:23 +0000 Subject: [PATCH 4/8] Link deviation cross-page, bridge prediction error remark, use devof in example Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_019xfc9nVFCSNv3sBfesyDpL --- _subfiles/_exm-prediction-error-split.qmd | 2 +- _subfiles/_lem-prediction-error-split.qmd | 2 +- _subfiles/_rem-prediction-error.qmd | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/_subfiles/_exm-prediction-error-split.qmd b/_subfiles/_exm-prediction-error-split.qmd index 6e23a90c9..4c4284ea9 100644 --- a/_subfiles/_exm-prediction-error-split.qmd +++ b/_subfiles/_exm-prediction-error-split.qmd @@ -5,7 +5,7 @@ In @exr-best-predictor, when $\Predvar = 0$ and $\Outvar = 0$, the constant [prediction](#def-prediction) $\predfn_1\paren{\Predvar} = 3$ has [prediction error](#def-prediction-error) $\prederrf{\predfn_1} = 3$. The conditional mean is $\truemeanf{0} = 1$, -so $\prederrf{\truemean} = 1$ and $\predfn_1\paren{0} - \truemeanf{0} = 2$, +so $\prederrf{\truemean} = 1$ and $\devof{\predfn_1\paren{0}}{\truemeanf{0}} = 2$, and $3 = 1 + 2$. ::: diff --git a/_subfiles/_lem-prediction-error-split.qmd b/_subfiles/_lem-prediction-error-split.qmd index 3ee7ad22c..a67da0bd3 100644 --- a/_subfiles/_lem-prediction-error-split.qmd +++ b/_subfiles/_lem-prediction-error-split.qmd @@ -4,7 +4,7 @@ Let $\truemeanf{\Predvar} \eqdef \E{\Outvar \mid \Predvar}$ be the [conditional expectation function](#def-cond-expectation-function) of $\Outvar$ given $\Predvar$. For any [prediction function](#def-prediction-function) $\predfnf{\Predvar}$, the [prediction error](#def-prediction-error) is the prediction error of $\truemean$ -plus the [deviation](#def-deviation) of $\predfnf{\Predvar}$ from $\truemeanf{\Predvar}$: +plus the [deviation](variance-covariance.qmd#def-deviation) of $\predfnf{\Predvar}$ from $\truemeanf{\Predvar}$: $$\prederrf{\predfn} = \prederrf{\truemean} + \devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}}$$ diff --git a/_subfiles/_rem-prediction-error.qmd b/_subfiles/_rem-prediction-error.qmd index 073fc3a93..25cecafdb 100644 --- a/_subfiles/_rem-prediction-error.qmd +++ b/_subfiles/_rem-prediction-error.qmd @@ -1,8 +1,13 @@ :::{#rem-prediction-error} #### The prediction error of a prediction function -A [prediction function](#def-prediction-function) $\predfn$ makes the [prediction](#def-prediction) $\predfnf{\Predvar}$ for the [outcome](#def-outcome) $\Outvar$ of a [new observation](#def-new-observation) with [input](#def-input) $\Predvar$. -We write $\prederrf{\predfn}$ for the [prediction error](#def-prediction-error) of that prediction, $\prederrf{\predfn} = \predfnf{\Predvar} - \Outvar$. +A [prediction function](#def-prediction-function) $\predfn$ makes the [prediction](#def-prediction) $\predfnf{\Predvar}$ +for the [outcome](#def-outcome) $\Outvar$ of a [new observation](#def-new-observation) with [input](#def-input) $\Predvar$. +We write $\prederrf{\predfn}$ for the [prediction error](#def-prediction-error) of that prediction, +meaning $\prederrf{\predfnf{\Predvar}}$, +which is + +$$\prederrf{\predfn} = \predfnf{\Predvar} - \Outvar$$ The reference value in a prediction error is the observed outcome $\Outvar$, not the [conditional mean](#def-cond-expectation-function) of that outcome. From f8206c1cdcb54c3b5789e5fe382d328e9316e53b Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Oct 2026 22:40:53 +0000 Subject: [PATCH 5/8] Link prediction function in cor-best-predictor-unique to its definition Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_019xfc9nVFCSNv3sBfesyDpL --- .../cor-best-predictor-unique/_cor-best-predictor-unique.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_subfiles/cor-best-predictor-unique/_cor-best-predictor-unique.qmd b/_subfiles/cor-best-predictor-unique/_cor-best-predictor-unique.qmd index 1db240f65..13505364e 100644 --- a/_subfiles/cor-best-predictor-unique/_cor-best-predictor-unique.qmd +++ b/_subfiles/cor-best-predictor-unique/_cor-best-predictor-unique.qmd @@ -2,7 +2,7 @@ #### The minimizer of squared-error risk is unique up to probability-1 equality Let $\Predvar$ and $\Outvar$ be [jointly distributed](random-variables.qmd#def-jointly-distributed) random variables with $\E{\Outvar^2} < \infty$. -Every [prediction function](#def-prediction) $\predfnf{\Predvar}$ with $\E{\predfnf{\Predvar}^2} < \infty$ +Every [prediction function](#def-prediction-function) $\predfnf{\Predvar}$ with $\E{\predfnf{\Predvar}^2} < \infty$ that is a [minimizer](https://morrison-lab.github.io/mds/algebra-basics.html#def-global-minimizer) of the [squared-error risk](#def-squared-error-risk) (see @cor-best-predictor-argmin) satisfies: From e09dc84e97c211afe5227c1059aebcc95dcff4d3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 31 Oct 2026 01:14:01 +0000 Subject: [PATCH 6/8] Restore the lemma's subject and cite the remark that introduces the prediction error notation Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01FWgYrE7LQ7q9Lw5qkHaNiT --- _subfiles/_lem-prediction-error-split.qmd | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/_subfiles/_lem-prediction-error-split.qmd b/_subfiles/_lem-prediction-error-split.qmd index a67da0bd3..94f088a12 100644 --- a/_subfiles/_lem-prediction-error-split.qmd +++ b/_subfiles/_lem-prediction-error-split.qmd @@ -2,8 +2,8 @@ #### Prediction error splits at the conditional mean Let $\truemeanf{\Predvar} \eqdef \E{\Outvar \mid \Predvar}$ be the [conditional expectation function](#def-cond-expectation-function) of $\Outvar$ given $\Predvar$. -For any [prediction function](#def-prediction-function) $\predfnf{\Predvar}$, -the [prediction error](#def-prediction-error) is the prediction error of $\truemean$ +For any [prediction function](#def-prediction-function) $\predfn$, +the [prediction error](#def-prediction-error) of $\predfn$ is the prediction error of $\truemean$ plus the [deviation](variance-covariance.qmd#def-deviation) of $\predfnf{\Predvar}$ from $\truemeanf{\Predvar}$: $$\prederrf{\predfn} = \prederrf{\truemean} + \devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}}$$ @@ -12,15 +12,17 @@ $$\prederrf{\predfn} = \prederrf{\truemean} + \devof{\predfnf{\Predvar}}{\trueme ::: proof +The notation $\prederrf{\predfn}$ is introduced in @rem-prediction-error. + $$ \ba \prederrf{\predfn} &= \predfnf{\Predvar} - \Outvar -&& \text{(definition of } \prederrf{\predfn} \text{)} \\ +&& \text{(prediction error notation)} \\ &= \paren{\truemeanf{\Predvar} - \Outvar} + \devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}} && \text{(add and subtract } \truemeanf{\Predvar} \text{)} \\ &= \prederrf{\truemean} + \devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}} -&& \text{(definition of } \prederrf{\truemean} \text{)} +&& \text{(prediction error notation)} \ea $$ From 096dcf8326076d72d078a2ec08011cc6f759ddda Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 31 Oct 2026 01:25:00 +0000 Subject: [PATCH 7/8] Link prediction and conditional mean in the lemma Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01FWgYrE7LQ7q9Lw5qkHaNiT --- _subfiles/_lem-prediction-error-split.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_subfiles/_lem-prediction-error-split.qmd b/_subfiles/_lem-prediction-error-split.qmd index 6071823f7..a227cbd5d 100644 --- a/_subfiles/_lem-prediction-error-split.qmd +++ b/_subfiles/_lem-prediction-error-split.qmd @@ -4,7 +4,7 @@ Let $\truemeanf{\Predvar} \eqdef \E{\Outvar \mid \Predvar}$ be the [conditional expectation function](#def-cond-expectation-function) of $\Outvar$ given $\Predvar$. For any [prediction function](#def-prediction-function) $\predfn$, the [prediction error](#def-prediction-error) of $\predfn$ is the prediction error of $\truemean$ -plus the difference $\devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}}$ between the prediction of $\predfn$ and the conditional mean +plus the difference $\devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}}$ between the [prediction](#def-prediction) of $\predfn$ and the [conditional mean](#def-cond-expectation-function) (the [deviation](variance-covariance.qmd#def-deviation) of the former from the latter, defined in a later chapter): $$\prederrf{\predfn} = \prederrf{\truemean} + \devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}}$$ From 121785f45b4bb6cbe9c0e751ad92a60bf9b9188a Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 31 Oct 2026 01:31:03 +0000 Subject: [PATCH 8/8] State the lemma's difference plainly with one link per term; call f1 a constant prediction function Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01FWgYrE7LQ7q9Lw5qkHaNiT --- _subfiles/_exm-prediction-error-split.qmd | 2 +- _subfiles/_lem-prediction-error-split.qmd | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/_subfiles/_exm-prediction-error-split.qmd b/_subfiles/_exm-prediction-error-split.qmd index 4c4284ea9..6946f6e5e 100644 --- a/_subfiles/_exm-prediction-error-split.qmd +++ b/_subfiles/_exm-prediction-error-split.qmd @@ -3,7 +3,7 @@ In @exr-best-predictor, when $\Predvar = 0$ and $\Outvar = 0$, -the constant [prediction](#def-prediction) $\predfn_1\paren{\Predvar} = 3$ has [prediction error](#def-prediction-error) $\prederrf{\predfn_1} = 3$. +the constant [prediction function](#def-prediction-function) $\predfn_1$, with $\predfn_1\paren{\Predvar} = 3$, has [prediction error](#def-prediction-error) $\prederrf{\predfn_1} = 3$. The conditional mean is $\truemeanf{0} = 1$, so $\prederrf{\truemean} = 1$ and $\devof{\predfn_1\paren{0}}{\truemeanf{0}} = 2$, and $3 = 1 + 2$. diff --git a/_subfiles/_lem-prediction-error-split.qmd b/_subfiles/_lem-prediction-error-split.qmd index a227cbd5d..98daa71f6 100644 --- a/_subfiles/_lem-prediction-error-split.qmd +++ b/_subfiles/_lem-prediction-error-split.qmd @@ -4,8 +4,7 @@ Let $\truemeanf{\Predvar} \eqdef \E{\Outvar \mid \Predvar}$ be the [conditional expectation function](#def-cond-expectation-function) of $\Outvar$ given $\Predvar$. For any [prediction function](#def-prediction-function) $\predfn$, the [prediction error](#def-prediction-error) of $\predfn$ is the prediction error of $\truemean$ -plus the difference $\devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}}$ between the [prediction](#def-prediction) of $\predfn$ and the [conditional mean](#def-cond-expectation-function) -(the [deviation](variance-covariance.qmd#def-deviation) of the former from the latter, defined in a later chapter): +plus the difference $\devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}}$ between the [prediction](#def-prediction) $\predfnf{\Predvar}$ and $\truemeanf{\Predvar}$: $$\prederrf{\predfn} = \prederrf{\truemean} + \devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}}$$