fix(longitudinal): require both marginals for lagged correlation - #441
fix(longitudinal): require both marginals for lagged correlation#441seonghobae wants to merge 10 commits into
Conversation
…ocorrelation
Name the covariance ratio (trait + e^{aΔt} p + added) / (trait + p + added)
as a scalar map distinct from unstandardised discreteDRIFT and from
discreteDRIFTstd. Form lagged covariance first, then contemporaneous
total, then addedTIPREDVAR, then the ratio. Claim-boundary tests refuse
substituting either discrete auto-effect for that named quantity.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthrough시간 지연 공분산을 두 시점의 주변 분산으로 표준화하는 공개 함수가 추가되었습니다. 정확한 binary64 공분산 경계 검사와 입력 오류가 추가되었습니다. 관련 테스트와 연구·패키지 문서가 갱신되었습니다. Changes시간 지연 연관 표준화
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: 🟡 Moderate · up to The PR replaces the one-sided ratio with a bounded lagged-correlation calculation and adds validation for extreme numeric inputs. Merge readiness remains moderate because current documentation still contains unresolved scientific terminology, verification traceability, ownership, and identifier inconsistencies that could mislead users or weaken the published contract until corrected or explicitly accepted. Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant Caller
participant recover_event_time_lagged_correlation
participant Binary64BoundCheck
participant CorrelationResult
Caller->>recover_event_time_lagged_correlation: 지연 공분산과 두 주변 분산 전달
recover_event_time_lagged_correlation->>Binary64BoundCheck: Cauchy–Schwarz 경계 검사
Binary64BoundCheck-->>recover_event_time_lagged_correlation: 경계 통과 또는 CovarianceBoundViolation
recover_event_time_lagged_correlation->>CorrelationResult: 표준화 및 [-1, 1] 제한
CorrelationResult-->>Caller: 복구된 시간 지연 상관 반환
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 93.94% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 7 files. (3 skipped: 3 unsupported.) ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Replace the unmerged psychometric_core covariance/initial-variance ratio with a Longitudinal Modeling boundary that only standardizes lagged covariance when both marginal variances are known. Preserve the invalid predecessor commit as RED lineage, remove its public autocorrelation API and docs from the final diff, and add nonstationary/covariance-bound/overflow-safe regressions.
Put the ARCHITECTURE.md and CHANGELOG.md records on the reviewed branch and remove the one-shot writer workflow that lacked Workflows permission and mixed repository-write credentials into verification.
|
Queue consolidation executed after strict ancestry verification. |
Root-cause repair
The original head
beba8ea6dd979b7355077f12110e04ea00426af0exposed a one-sided covariance/earlier-variance ratio asexpected_autocorrelation. That ratio can exceed one under nonstationary marginals and is not printed or validated as an autocorrelation by Driver, Oud, and Voelkle (2017). That predecessor remains RED/scientific-failure lineage only; its public ratio API andpsychometric_coreadditions are retired.The replacement belongs to the Longitudinal Modeling bounded context.
longitudinal_core::recover_event_time_lagged_correlationrequires lagged covariance, both occasion-specific marginal variances, and a positive event-time interval. It does not infer process noise, marginal state variance, or a psychometric response kernel. Reusable static/dependence psychometric kernels remain owned byContextualWisdomLab/fast-mlsirm; TEPP owns temporal/event composition.Numerical contract
The Cauchy–Schwarz bound is checked exactly for the represented binary64 inputs by decomposing each positive finite value into an integer significand and a power-of-two exponent and comparing
covariance^2 <= variance_t * variance_t_plus_deltawithout rounded square-root products or floating-point multiplication overflow.After that exact gate, standardization divides by the smaller marginal standard deviation first and then by the larger one. The proven covariance bound guarantees the intermediate magnitude cannot exceed the remaining scale while avoiding avoidable underflow for highly unequal marginals.
Exact-head CI-driven repair
Hosted checks on predecessor exact head
6f483224b3a03e8237c6f4f098a8b0e85e0a91f5terminated rather than remaining queued:dependency-reviewjob failed its repository-support preflight before the actual dependency-review action; OSV and Trivy jobs were GREEN;cargo fmt --checkand at the 100% production branch-coverage gate.The uploaded llvm-cov branch artifact identified six uncovered branches in
crates/longitudinal_core/src/association.rs: three untested non-finite argument positions, later-marginal non-positive validation, the reverse marginal-scale ordering, and a defensive post-division!correlation.is_finite()branch. Current commit23959d1199f84554f4a5090cea2b9e9d70b55dd8repairs those causes:cargo fmt --check;earlier_scale > later_scaleordering with symmetric recovery;This is a source/test repair, not a waiver or exclusion. New exact-head hosted checks on
23959d1199f84554f4a5090cea2b9e9d70b55dd8are the only landing evidence; predecessor successes/failures do not transfer.Recovery / capability boundary
RED/GREEN lineage covers nonstationary marginals (
cov=1.5, variances1and4->0.75), exact ±1 boundaries at ordinary/f64::MAX/minimum-subnormal scales, one-ULP over-bound rejection, gross subnormal violation before division, huge representable marginals, unequal marginal scales in both orderings, and every fail-closed input branch.docs/research/trait-state-lagged-association.mdtraces Pearson normalization, boundedness, nonstationary continuous-time semantics, and the distinction between an arithmetic standardizer and future model-specific recovery. These arithmetic tests do not promote a DSEM/ctsem estimator. A supported model-derived temporal correlation still requires explicit state equations, process-noise/marginal recovery, identification, uncertainty, RMSE/bias/coverage and leakage-safe rolling-origin recovery.Remaining merge gate
Current exact head:
23959d1199f84554f4a5090cea2b9e9d70b55dd8.Do not merge until all current-head Rust/documentation/security checks terminate GREEN, every blocking conversation remains resolved on this head, and a qualifying independent non-author APPROVE exists under live ruleset
18156473. If the dependency-review support preflight fails again on this exact head, verify whether it is repository-owned configuration or centrally owned governance before changing source; do not mislabel a support/preflight failure as a vulnerability finding. No self-approval, predecessor evidence transfer, coverage exclusion, or bypass.