Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions _subfiles/_def-prediction-error.qmd
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
:::{#def-prediction-error}
#### Prediction error

A [prediction function](#def-prediction-function) $\predfn$ 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$$
$$\prederrf{\est{\Outvar}} \eqdef \est{\Outvar} - \Outvar$$

:::
11 changes: 11 additions & 0 deletions _subfiles/_exm-prediction-error-split.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
:::{#exm-prediction-error-split}

Check warning on line 1 in _subfiles/_exm-prediction-error-split.qmd

View workflow job for this annotation

GitHub Actions / check / check-exm-figures

Example #exm-prediction-error-split has no figure. Fix: add a figure of the example's data, model or results, or add <!-- no-figure: reason --> inside the div
#### The split in the best-predictor exercise

In @exr-best-predictor,
when $\Predvar = 0$ and $\Outvar = 0$,
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$.

:::
31 changes: 10 additions & 21 deletions _subfiles/_lem-prediction-error-split.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,28 @@
#### 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) $\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) $\predfnf{\Predvar}$ and $\truemeanf{\Predvar}$:

$$\prederrf{\predfn} = \prederrf{\truemean} + \paren{\predfnf{\Predvar} - \truemeanf{\Predvar}}$$
$$\prederrf{\predfn} = \prederrf{\truemean} + \devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}}$$

:::

::: proof

The notation $\prederrf{\predfn}$ is introduced in @rem-prediction-error.

$$
\ba
\prederrf{\predfn}
&= \predfnf{\Predvar} - \Outvar
&& \text{(definition of } \prederrf{\predfn} \text{)} \\
&= \paren{\truemeanf{\Predvar} - \Outvar} + \paren{\predfnf{\Predvar} - \truemeanf{\Predvar}}
&& \text{(prediction error notation)} \\
&= \paren{\truemeanf{\Predvar} - \Outvar} + \devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}}
&& \text{(add and subtract } \truemeanf{\Predvar} \text{)} \\
&= \prederrf{\truemean} + \paren{\predfnf{\Predvar} - \truemeanf{\Predvar}}
&& \text{(definition of } \prederrf{\truemean} \text{)}
&= \prederrf{\truemean} + \devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}}
&& \text{(prediction error notation)}
\ea
$$

:::

{{< slidebreak >}}

:::{#exm-prediction-error-split}
#### The split in the best-predictor exercise

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$,
and $3 = 1 + 2$.

:::
2 changes: 1 addition & 1 deletion _subfiles/_rem-irreducible-risk.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
15 changes: 15 additions & 0 deletions _subfiles/_rem-prediction-error.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
:::{#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,
meaning $\prederrf{\predfnf{\Predvar}}$.
It 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.

:::
2 changes: 1 addition & 1 deletion _subfiles/_rem-reducible-risk.qmd
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 8 additions & 0 deletions expectation.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ format:

{{< slidebreak >}}

{{< include pds/_subfiles/_rem-prediction-error.qmd >}}

{{< slidebreak >}}

{{< include pds/_subfiles/_def-squared-error-risk.qmd >}}

{{< slidebreak >}}
Expand All @@ -139,6 +143,10 @@ format:

{{< slidebreak >}}

{{< include pds/_subfiles/_exm-prediction-error-split.qmd >}}

{{< slidebreak >}}

{{< include pds/_subfiles/_lem-cross-term-zero.qmd >}}

{{< slidebreak >}}
Expand Down
Loading