Skip to content

Test that duplicated rows sharing an id keep their standard errors - #73

Merged
ck37 merged 1 commit into
masterfrom
claude/loving-brahmagupta-xdc7g1
Oct 12, 2026
Merged

ck37 merged 1 commit into
masterfrom
claude/loving-brahmagupta-xdc7g1

Conversation

@ck37

@ck37 ck37 commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Adds the check proposed in #18 for the id argument merged in #71 and #72: two copies of each row, sharing an id, carry no more information than one, so the standard errors should match the original data's. Tests only; no package code changes.

  • test-cluster-var.R: copying every row within its cluster doubles cv_cluster_var() exactly, so the standard error sqrt(variance / n) is unchanged. Checked one-way (site) and two-way (site and school, crossed).
  • test-varimpact-cluster.R: end to end on 200 independent rows, each duplicated. With id, the interval half-widths stay within 30% of the original data's; without id they are at least 30% narrower than with it. Across five data seeds the ratios were 0.92-1.21 with id and 1.39-1.8 without, against the √2 ≈ 1.41 shrinkage the issue expected. The test takes about 13 seconds.

Point estimates are not compared: with id the folds differ, and so can each variable's data-adaptive low and high levels.

Both changed test files pass locally (91 and 68 expectations).

Closes #18

🤖 Generated with Claude Code

https://claude.ai/code/session_01UcpuhTnMKP8W19CLUUyU2T


Generated by Claude Code

Two copies of each row under a shared id carry no more information than
one, so the intervals should match the original data's (issue #18).
A unit test checks that cv_cluster_var() doubles exactly when n doubles,
one- and two-way, and an end-to-end test checks that varimpact() keeps
the interval widths with id and narrows them by about sqrt(2) without.

Closes #18

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UcpuhTnMKP8W19CLUUyU2T
@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (c21b4bb) to head (b4fd1b4).

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #73   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           32        32           
  Lines         2618      2618           
=========================================
  Hits          2618      2618           

☔ 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.

@ck37
ck37 merged commit 837ac16 into master Oct 12, 2026
8 checks passed
ck37 pushed a commit that referenced this pull request Oct 12, 2026
Release version with today's date, and the NEWS heading for everything
since 1.2.4, including cluster-robust standard errors (#71, #72, #73).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UcpuhTnMKP8W19CLUUyU2T
ck37 pushed a commit that referenced this pull request Oct 12, 2026
Release version with today's date, and the NEWS heading for the changes
recorded since NEWS.md was started in 2025, including cluster-robust
standard errors (#71, #72, #73).

The old "1.2.4" NEWS heading never matched a DESCRIPTION version, which
went from 1.2 to 1.3 in January 2017 and has been a 1.3.0 development
version since, so it now reads 1.3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UcpuhTnMKP8W19CLUUyU2T
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.

Add Repeated Measures functionality

2 participants