Skip to content

Preserve custom confidence levels in hypothesis-test tables - #619

Open
M-Colley wants to merge 10 commits into
easystats:mainfrom
M-Colley:codex/fix-htest-confidence
Open

M-Colley wants to merge 10 commits into
easystats:mainfrom
M-Colley:codex/fix-htest-confidence

Conversation

@M-Colley

Copy link
Copy Markdown
Contributor

report_table(t.test(..., conf.level = 0.975)) labeled the original interval bounds as 95%, while the narrative correctly reported 97.5%. Set the table's CI column and formatting metadata from the original test's confidence level.

Regression tests cover 97.5% two-sided and one-sided t-tests, full and summary table headers, original interval bounds, and a 90% correlation interval.

Fixes #408.

Validation: All hypothesis-test tests pass, including 22 new assertions; changed R files have no lint findings.

Broader verification with all seven fixes combined: installed-package tests reported 757 passing expectations, 0 test warnings, and 17 skips. The only 2 failures are lavaan snapshots also reproduced on unchanged main (622 passing expectations). R CMD check passed code, documentation, examples, and vignette-code checks; it retains the baseline snapshot error and 2 warnings because vignettes were intentionally not built. Independent review and git diff --check passed.

M-Colley and others added 8 commits October 26, 2026 22:36
Because this pull request edits tests/testthat/test-report_intercept.R,
the lint-changed-files check lints the whole file and fails on the
existing top-level `<<-` assignments (assignment_linter). They are
intentional, since insight::get_data() needs the data in the global
environment, so mark them with `# nolint` as elsewhere in the package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 18, 2026 12:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

4 open issues
1 file not reviewed
  • man/report.Rd: Generated file
What changed in this PR

Updates hypothesis-test reporting to preserve and display the original confidence level in report_table() outputs (fixing mislabeled CI headers when non-default conf.level is used), while also improving stability/diagnostic text formatting and CI workflows/testing robustness.

Changes:

  • Preserve htest confidence levels in table metadata/headers and add regression tests for custom CI levels.
  • Fix SEM fit text formatting (keep signs/integer parts) and improve Bayesian diagnostics to handle multiple ESS column conventions.
  • Rework CI GitHub Actions workflows and snapshot tests to reduce version-dependent flakiness (e.g., lavaan GFI).
File Description
vignettes/​report_ai.Rmd Wording tweak in vignette prose.
R/​report.htest.R Set CI level metadata on hypothesis-test tables based on the test’s original conf.level.
R/​report_performance.R Preserve sign/integer part when formatting fit indices (avoid truncating leading chars).
R/​report_parameters.R Support multiple ESS column names and improve “only when insufficient” filtering logic.
tests/​testthat/​test-report.htest-confidence.R New regression coverage for non-default CI levels in htest tables.
tests/​testthat/​test-report_diagnostics.R New unit tests for lavaan fit text and Bayesian diagnostic parameter text.
tests/​testthat/​test-report.lavaan.R Stabilize lavaan snapshots by normalizing version-varying GFI in printed output.
tests/​testthat/​test-report.stanreg.R Adjust snapshot to exclude diagnostics + add posterior-diagnostic consistency checks.
tests/​testthat/​test-report_intercept.R Lint suppression for intentional global assignments used by tests.
tests/​testthat/​_snaps/​windows/​report.lavaan.md Snapshot updated to reflect stabilized output (<GFI> placeholder).
tests/​testthat/​_snaps/​windows/​report.stanreg.md Snapshot updated for include_diagnostic = FALSE.
NEWS.md Changelog entry for CI header fix + diagnostic formatting fixes.
README.md Stars badge link updated to point to repo root.
README.Rmd Stars badge link updated to point to repo root.
inst/​WORDLIST Add terms to spelling whitelist.
lychee.toml Exclude Cloudflare-protected URL from link checker.
.Rbuildignore Exclude lychee.toml from package builds.
.github/​workflows/​test-coverage.yml Inline coverage workflow steps; add concurrency + Windows setup.
.github/​workflows/​check-random-test-order.yml Inline randomized test-order workflow steps; Windows runner setup.
.github/​workflows/​R-CMD-check.yml Inline full R CMD check matrix with compatibility pinning + concurrency.

Review effort: Lite

Comment on lines +76 to +84
"StanHeaders=url::https://cran.r-project.org/src/contrib/Archive/StanHeaders/StanHeaders_2.32.10.tar.gz"
)
} else {
""
}
cat("deriv=", deriv, "\n", file = Sys.getenv("GITHUB_OUTPUT"), append = TRUE, sep = "")
cat("matrix=", matrix_ref, "\n", file = Sys.getenv("GITHUB_OUTPUT"), append = TRUE, sep = "")
cat("stan=", stan, "\n", file = Sys.getenv("GITHUB_OUTPUT"), append = TRUE, sep = "")

Comment on lines +1 to +3
# Adapted from easystats/workflows at 99ee8e98a43a5741c3301bff19434a85f01bf821.
# Keep the compatibility matrix and check settings aligned with the shared workflow.
name: R-CMD-check

name: R-CMD-check
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@codecov

codecov Bot commented Nov 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.35%. Comparing base (58c7492) to head (b0a9e95).
⚠️ Report is 95 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #619       +/-   ##
===========================================
+ Coverage   72.36%   87.35%   +14.98%     
===========================================
  Files          54       55        +1     
  Lines        3684     5044     +1360     
===========================================
+ Hits         2666     4406     +1740     
+ Misses       1018      638      -380     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When using stats::t.test, the report() and report_table() function output displays "95 % CI" even if, say, conf.level = 0.975

2 participants