Open
Conversation
The within-hypothesis across-analysis loop only filled entries relative to analysis 1 and used incorrect event counts for non-adjacent analysis pairs (e.g., A1-A3 used events at A2 instead of A1). This produced correlation values > 1 and missing entries (0) for k > 2. Replace the loop to iterate over all analysis pairs and use events at min(s, t) for D[Hi_As, Hi_At], matching the canonical group sequential correlation structure. Add test for 2 hypotheses with 3 analyses verifying the matrix is valid (entries in [-1, 1], positive definite) and spot-checking specific correlation entries. Fixes #48 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
generate_corr()that produced invalid correlation matrices (entries > 1, incorrect zeros) for designs with more than 2 analysesFixes #48
Details
The bug was in the loop that fills
D[Hi_As, Hi_At]for the same hypothesis across different analyses. The original code:Analysis == j - 1which gave events at analysis 2 for the A1↔A3 entry (should be events at analysis 1)The fix iterates over all
(s, t)analysis pairs and uses events atmin(s, t).Test plan
🤖 Generated with Claude Code