-
Notifications
You must be signed in to change notification settings - Fork 14
Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> #616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
d-morrison
merged 94 commits into
main
from
copilot/define-relationships-errors-residuals
Apr 28, 2026
Merged
Changes from all commits
Commits
Show all changes
94 commits
Select commit
Hold shift + click to select a range
5078c8f
Initial plan
Copilot 704f50d
Clarify deviation, error/noise, and residual terminology
Copilot bad929d
Refine terminology links and consistency for error vs residual defini…
Copilot 70dfc40
Apply suggestions from code review
d-morrison 7d348a1
Apply erf vs devn notation distinction across estimation and probabil…
Copilot 17ea9a8
Define statistical signal and refine residual wording in linear-model…
Copilot 2b246e5
Address review thread on error terminology and residual notation cons…
Copilot e239721
Apply suggestions from code review
d-morrison 9482d8f
Merge branch 'main' into copilot/define-relationships-errors-residuals
d-morrison 2f3c412
Use resid notation and consolidate residual definitions into shared s…
Copilot f43bdf4
Clarify and align terminology for signal, deviation, error/noise, res…
Copilot 881dd5c
Merge branch 'main' into copilot/define-relationships-errors-residuals
d-morrison 6b715c4
Merge branch 'main' into copilot/define-relationships-errors-residuals
d-morrison 7a57d6c
Refine deviation terminology and Gaussian diagnostics assumptions
Copilot aad3a7f
Merge branch 'main' into copilot/define-relationships-errors-residuals
d-morrison 2667982
Refine deviation note to reserve term error for estimation deviations
Copilot d1f152c
Merge branch 'main' into copilot/define-relationships-errors-residuals
d-morrison f1cb563
Remove local macro includes and rely on shared macro source
Copilot 41b644d
Merge branch 'main' into copilot/define-relationships-errors-residuals
d-morrison 515bd7b
Rewrite residual-noise estimate using deviation notation
Copilot 679eff9
Apply suggestions from code review
d-morrison 79e5047
Refine estimation terminology list for deviation and residual definit…
Copilot c90ae78
Use cf abbreviation in deviation terminology note
Copilot 246298f
Merge branch 'main' into copilot/define-relationships-errors-residuals
d-morrison d60b3f8
Align deviation anchors and residual/deviation wording across chapters
Copilot 6b42698
Use expectation macro in residual deviation equation
Copilot 22d7346
Apply suggestions from code review
d-morrison a9181c3
Clarify residual section wording and standardize standardized-residua…
Copilot 4d764b6
Merge branch 'main' into copilot/define-relationships-errors-residuals
d-morrison 2258ffe
Align deviation terminology with subpopulation means and retire err g…
Copilot 79ddb2f
Refine standardized residual SD notation and expectation macro usage
Copilot 5cf6e53
Merge branch 'main' into copilot/define-relationships-errors-residuals
d-morrison c12152f
Apply suggestions from code review
d-morrison f9e9f89
Align diagnostics notation and split signal definition into dedicated…
Copilot a7ff67b
Clarify deviation/residual terminology and align cross-chapter notati…
Copilot 4412de6
Merge branch 'main' into copilot/define-relationships-errors-residuals
d-morrison bbda477
Merge branch 'main' into copilot/define-relationships-errors-residuals
d-morrison 2edd288
Plan follow-up fixes from latest review thread
Copilot f6f4b20
Fix standardized residual distribution wording and fitted-value notation
Copilot a122997
Apply suggestions from code review
d-morrison ed6c40b
Quantify residual covariance and standardized residual covariance
Copilot 746d344
Apply suggestions from code review
d-morrison f91bed2
Merge branch 'main' into copilot/define-relationships-errors-residuals
d-morrison fc77219
Update _subfiles/Linear-models-overview/_sec_linreg_diagnostics.qmd
d-morrison c233284
Align conditional mean notation in diagnostics section
Copilot 55ae1b2
Address diagnostics review thread notation and residual details
Copilot d08a982
Agent-Logs-Url: https://github.com/d-morrison/rme/sessions/d783ca6b-3…
Copilot 0ee141f
Merge origin/main into copilot branch and resolve diagnostics conflict
Copilot 322a513
Refine QQ-plot notes after merge conflict resolution
Copilot d227a69
Update _def-residual-deviation.qmd
d-morrison a1d5576
Merge branch 'main' into copilot/define-relationships-errors-residuals
d-morrison 0d9f514
Update _def-residual-deviation.qmd
d-morrison 252ac75
Update probability.qmd
d-morrison 28fef06
Apply suggestions from code review
d-morrison b9630dc
docs: resolve unresolved review comments on residual terminology and …
Copilot de1e48d
Clarify terminology and update residuals section
d-morrison 4d7a551
Update _def-residual-deviation.qmd
d-morrison 7739649
Update definition and references for 'residual'
d-morrison b653153
Apply suggestions from code review
d-morrison cfec148
Apply suggestions from code review
d-morrison 0613c1a
Apply suggestions from code review
d-morrison f20e889
docs: apply latest review-thread fixes for residual notation and stan…
Copilot 2ad4927
Resolve residual-notation review comments in linear-model diagnostics
Copilot 3a30d21
Merge branch 'main' into copilot/define-relationships-errors-residuals
d-morrison 83480ff
docs: define hat matrix before residual covariance use and update ren…
Copilot ae4a367
Apply suggestions from code review
d-morrison 97394fa
docs: address open residual diagnostics review comments
Copilot c81a59c
docs: fix notation consistency in residual variance proof
Copilot b8ce628
update renv
d-morrison b94de35
Fix dprodf macro usage in residual theorem
Copilot 9eac88c
Fix lint-thread notation and formatting; revert renv/activate drift
Copilot 261ad9d
Plan: investigate failing CI run 24919228108
Copilot 75d2703
CI: pin preview workflow R version to 4.5.2 and revert renv drift
Copilot 802d356
CI: provide GITHUB_PAT to setup-renv in preview workflow
Copilot 072647d
CI: disable pak in preview workflow setup-renv step
Copilot a46be49
chore: plan workflow issue investigation
Copilot 47eac42
ci: stabilize preview workflow setup and revert unintended renv check…
Copilot 4309aaa
chore: plan merge from update-book-for-r-4-6-0
Copilot a1f15af
Merge remote-tracking branch 'origin/copilot/update-book-for-r-4-6-0'…
Copilot f76bcdf
Merge branch 'main' into copilot/define-relationships-errors-residuals
d-morrison 83d1d29
Update .github/workflows/preview.yml
d-morrison 22ff560
update renv
d-morrison a5385c1
try to fix
d-morrison 5b09b88
Apply suggestions from code review
d-morrison 4e46d48
add broom.helpers
d-morrison 7a2c299
Clarify residual theorem with indexed/vector fitted-value notation
Copilot c87ac2f
Merge branch 'copilot/define-relationships-errors-residuals' of githu…
d-morrison 0676119
Address review thread feedback and CI libnode issue
Copilot 2f051d5
Use design-matrix conditioning in Gaussian residual statement
Copilot fcacfd6
Use explicit residual-vector notation and document macro policy
Copilot 87768e8
Apply suggestion from @Copilot
d-morrison 47bc855
Apply suggestions from code review
d-morrison c1cbd65
Apply latest PR thread feedback on deps and notation
Copilot 799d425
Align residual-unbiased theorem assumptions with conditional proof
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,3 +13,5 @@ _freeze/ | |
| ^\.github$ | ||
| ^README\.Rmd$ | ||
| ^data-raw$ | ||
| ^\.positai$ | ||
| ^\.claude$ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,3 +43,5 @@ renv/lock/ | |
| renv/python/ | ||
| renv/sandbox/ | ||
| renv/staging/ | ||
| .positai | ||
| .claude | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,6 +53,7 @@ Suggests: | |
| plotly, | ||
| rjags, | ||
| runjags, | ||
| datawizard (>= 1.3.1), | ||
| survminer, | ||
| tidyr, | ||
| spelling, | ||
|
|
||
65 changes: 49 additions & 16 deletions
65
_subfiles/Linear-models-overview/_def-residual-deviation.qmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,59 @@ | ||
| :::{#def-resid-noise} | ||
| #### Residual noise/deviation from the population mean | ||
| :::{#def-deviation-subpop-mean} | ||
| #### Deviation of an observation from its subpopulation mean | ||
|
|
||
| The **residual noise** in a probabilistic model $p(Y)$, | ||
| also known as the | ||
| **residual deviation of an observation from its population mean** | ||
| or **residual** for short, | ||
| is the difference between an observed value $y$ and its population mean: | ||
| The **deviation of an observation from its subpopulation mean** | ||
| in a probabilistic model $p(Y \mid X)$, | ||
| is the difference between an observed value | ||
| and its model-implied mean given covariates: | ||
|
|
||
| $$\devn(y) \eqdef y - \Expf{Y}$$ {#eq-def-resid} | ||
| $$\devn(y_i) \eqdef y_i - \E{Y_i \mid X_i}$$ {#eq-def-deviation-subpop-mean} | ||
| ::: | ||
|
|
||
| :::{.notes} | ||
| We use the same notation for residual noise that we used for [errors](estimation.qmd#def-error). | ||
| Many sources call deviations "error" or "noise." | ||
| The model-implied mean | ||
| can be viewed as an estimate of $Y_i$, | ||
| before $y_i$ is observed. | ||
| However, an estimation error is defined as an estimate minus its estimand | ||
| (see [estimation error](estimation.qmd#def-estimation-error)), | ||
| and deviation is the observed value minus its estimand, | ||
| so the deviation is actually the *negative* of the estimation error of the mean $\E{Y_i \mid X_i}$ | ||
| with respect to its estimand $Y_i$: | ||
|
d-morrison marked this conversation as resolved.
|
||
|
|
||
| $\Expf{Y}$ can be viewed as an estimate of $Y$, before $y$ is observed. | ||
| Conversely, each observation $y$ can be viewed as an estimate of $\Expf{Y}$ | ||
| (albeit an imprecise one, individually, since $n=1$). | ||
| $$\devn(y_i) = -\paren{\E{Y_i \mid X_i} - y_i}$$ | ||
|
|
||
|
d-morrison marked this conversation as resolved.
|
||
| On the other hand, | ||
| each observation $y_i$ can be viewed | ||
| as a nonparametric estimate of $\mu_i = \E{Y_i \mid X_i}$ | ||
| (albeit an imprecise one, individually, since $n=1$): | ||
|
|
||
| $$y_i = \hmu_i^{(NP)}$$ | ||
|
|
||
| where $\hmu_i^{(NP)}$ denotes | ||
| the nonparametric estimate from a single observed value $y_i$. | ||
|
|
||
| Thus, | ||
| the deviation can be interpreted as the estimation error of $y_i$ | ||
| with respect to $\E{Y_i \mid X_i}$: | ||
|
d-morrison marked this conversation as resolved.
|
||
|
|
||
| $$ | ||
| \ba | ||
| \devn(y_i) | ||
| &= y_i - \mu_i | ||
| \\ | ||
| &= \hmu_i^{(NP)} - \mu_i | ||
| \\ | ||
| &= \erf{\hmu_i^{(NP)}} | ||
| \ea | ||
| $$ | ||
|
|
||
| ::: | ||
|
|
||
| We can rearrange @eq-def-resid | ||
| to view $y$ as | ||
| the sum of its mean plus the residual noise: | ||
| --- | ||
|
|
||
| We can rearrange @eq-def-deviation-subpop-mean | ||
| to view $y_i$ as | ||
| the sum of its mean plus the deviation | ||
| (often called error/noise): | ||
|
|
||
| $$y = \Exp{Y} + \epsf{y}$$ | ||
| $$y_i = \E{Y_i \mid X_i} + \devn(y_i)$$ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| :::{#def-signal} | ||
| #### Signal (statistical sense) | ||
|
|
||
| In statistical modeling, | ||
| the **signal** is the deterministic part of the model. | ||
| For mean-based models, | ||
| the signal is the model-implied mean function, | ||
| for example $\E{Y \mid X}$ (or $\E{Y}$ when there are no covariates). | ||
| ::: |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.