Skip to content

Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>#616

Open
d-morrison wants to merge 77 commits intomainfrom
copilot/define-relationships-errors-residuals
Open

Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>#616
d-morrison wants to merge 77 commits intomainfrom
copilot/define-relationships-errors-residuals

Conversation

@d-morrison
Copy link
Copy Markdown
Owner

@d-morrison d-morrison commented Apr 24, 2026

This pull request makes significant improvements to the definitions and terminology around residuals, deviations, and estimation error in the linear models overview and related documentation. The changes clarify distinctions between these concepts, update notation for consistency, and provide more precise explanations and formulas, especially for residuals in linear regression models. The documentation is also updated to reflect best practices and current conventions in notation.

Terminology and Notation Updates:

  • The term estimation error replaces the generic term "error" throughout, and the notation \erf{...} is standardized for estimation errors. The documentation now clearly distinguishes between estimation error, deviation, and residual. (estimation.qmd [1] [2] [3] [4]
  • The definition of deviation is clarified as the difference between an observation and its subpopulation mean, with explicit formulas and discussion of its relationship to estimation error. (_subfiles/Linear-models-overview/_def-residual-deviation.qmd _subfiles/Linear-models-overview/_def-residual-deviation.qmdL1-R51)
  • The key macros documentation is updated to deprecate the use of \err in favor of \devn(...) for deviations, and to clarify usage of \erf{...} for estimation errors. (.github/copilot-instructions.md [1] [2]

Residuals and Linear Model Diagnostics:

  • The section on residuals is reorganized and expanded. Residuals are now defined in a shared include file, and the relationship between residuals, deviations, and estimation error is made explicit. (_subfiles/shared/_def-residual-observed-minus-fitted.qmd [1] _subfiles/Linear-models-overview/_sec_linreg_diagnostics.qmd [2]
  • The formulas for the mean and variance of residuals in linear models are corrected and clarified, including the effect of leverage and the hat matrix. Standardized residuals are now defined with the correct variance formula, and the documentation explains their distribution and covariance structure. (_subfiles/Linear-models-overview/_sec_linreg_diagnostics.qmd [1] [2] [3]
  • The explanation of QQ plots and diagnostic plots is updated to use the new notation and terminology, and R code examples are adjusted accordingly. (_subfiles/Linear-models-overview/_sec_linreg_diagnostics.qmd [1] [2] [3] [4] [5]

New and Improved Definitions:

  • A new definition for "signal" in the statistical sense is added. (_subfiles/Linear-models-overview/_def-signal.qmd _subfiles/Linear-models-overview/_def-signal.qmdR1-R9)
  • The documentation now consistently uses indexed notation for observations and fitted values, improving clarity in formulas and explanations. (_subfiles/Linear-models-overview/_def-residual-deviation.qmd [1] _subfiles/shared/_def-residual-observed-minus-fitted.qmd [2]

Overall, these changes bring the documentation in line with modern statistical terminology, correct some technical inaccuracies, and make the explanations more accessible and precise for students and readers.

Copilot AI and others added 30 commits April 16, 2026 00:04
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ity chapters

Agent-Logs-Url: https://github.com/d-morrison/rme/sessions/d70c07dd-b06c-4360-ada3-9db26633fda8

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
… diagnostics

Agent-Logs-Url: https://github.com/d-morrison/rme/sessions/68d0b09d-31b1-48fd-b6d7-605b356270c3

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…idual, and estimation error

Agent-Logs-Url: https://github.com/d-morrison/rme/sessions/012f4b05-70d4-4920-8004-45fc1778381b

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/d-morrison/rme/sessions/b88d88a9-fa8b-423a-bf21-a788968d4116

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Agent-Logs-Url: https://github.com/d-morrison/rme/sessions/8afe4ead-9513-4b7e-b7e3-bb0e1227be39

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…l notation

Agent-Logs-Url: https://github.com/d-morrison/rme/sessions/ff58fa0f-43cc-483d-b49f-af1fd5b22fb2

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 25, 2026 01:25
@d-morrison d-morrison review requested due to automatic review settings April 25, 2026 01:25
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 25, 2026

@copilot fix https://github.com/d-morrison/rme/actions/runs/24918259840/job/72974626817?pr=616

Pushed 9eac88c to address the actionable CI issues: fixed the three open lint-thread items in the edited .qmd files and reverted renv/activate.R back to origin/main so lint-changed-files no longer lints that generated file. The exact run you linked failed in setup-renv due an Rcpp download failure (transient network/dependency fetch issue), and new workflows for 9eac88c are now running.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • canonical-bos01.cdn.snapcraftcontent.com
    • Triggering command: /usr/lib/snapd/snapd /usr/lib/snapd/snapd /tmp/ccjrprrF.s /usr/bin/readelf sh -c -- uname -a ache/pandoc/3.1.11/x64/as rce/repository/hgpg-connect-agent tu-noble/R-4.6/x--homedir b097a as -I ./include --64 as src/fn_lists.o /tmp/ccqGa6Ex.s /opt/R/4.6.0/lib--readonly as (dns block)
  • dl.google.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https tu-noble/R-4.6/x/usr/bin/tar (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@d-morrison
Copy link
Copy Markdown
Owner Author

Agent-Logs-Url: https://github.com/d-morrison/rme/sessions/1f49032e-53c4-4771-abef-03478f145221

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 27, 2026 07:00
@d-morrison d-morrison review requested due to automatic review settings April 27, 2026 07:00
Copilot AI review requested due to automatic review settings April 27, 2026 07:07
@d-morrison d-morrison review requested due to automatic review settings April 27, 2026 07:07
Copilot AI review requested due to automatic review settings April 27, 2026 07:12
@d-morrison d-morrison review requested due to automatic review settings April 27, 2026 07:12
Agent-Logs-Url: https://github.com/d-morrison/rme/sessions/1f49032e-53c4-4771-abef-03478f145221

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 27, 2026 07:16
@d-morrison d-morrison review requested due to automatic review settings April 27, 2026 07:16
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 27, 2026

@copilot fix https://github.com/d-morrison/rme/actions/runs/24919228108/job/72977410363?pr=616

Addressed in 072647d (with prior CI hardening in 75d2703 and 802d356). I investigated the failing job logs and applied workflow-side fixes in .github/workflows/preview.yml: pinned R to 4.5.2, passed GITHUB_PAT into setup-renv, and disabled pak for setup-renv. New preview runs were triggered after each change, but the same setup-renv restore dependency-failure set still reproduces, so this appears to be an existing lockfile/restore issue beyond the original lint-thread edits.

@d-morrison
Copy link
Copy Markdown
Owner Author

@copilot fix workflow issues

Agent-Logs-Url: https://github.com/d-morrison/rme/sessions/b37b1663-cb59-47f5-bb01-3dc5eab6f5ab

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 27, 2026 09:09
@d-morrison d-morrison review requested due to automatic review settings April 27, 2026 09:09
…sum drift

Agent-Logs-Url: https://github.com/d-morrison/rme/sessions/b37b1663-cb59-47f5-bb01-3dc5eab6f5ab

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 27, 2026 09:19
@d-morrison d-morrison review requested due to automatic review settings April 27, 2026 09:19
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 27, 2026

@copilot fix workflow issues

Implemented in 47eac42: fixed workflow issues by pinning r-lib/actions/setup-r to stable @v2, removing forced RENV_CONFIG_PAK_ENABLED: FALSE from preview setup-renv, and reverting unintended renv/activate.R checksum drift. New preview workflow run is now in progress on this commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants