Skip to content

feat(longitudinal): consolidate lagged correlation and discreteDRIFTstd - #310

Draft
seonghobae wants to merge 192 commits into
mainfrom
agent/psychometric-discrete-drift-std-clean
Draft

feat(longitudinal): consolidate lagged correlation and discreteDRIFTstd#310
seonghobae wants to merge 192 commits into
mainfrom
agent/psychometric-discrete-drift-std-clean

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Longitudinal Modeling landing vehicle

This Draft is the coherent Longitudinal Modeling vehicle for event-time lagged Pearson association, stationary/discrete drift-diffusion standardization, within/between decomposition, CWC and irregular-residual composition, occasion-mean event-time composition, known-truth recovery, and the DDD boundary that keeps temporal composition out of psychometric_core authority.

Current exact head: c6680450152b1e0a2c9abb553772d74a23923335 against protected main@1bc02f580cf48e1d39da239f0e818453437c31c3.

Temporal/state composition is owned by Longitudinal Modeling and implemented in longitudinal_core, with typed EventTimeInterval retained end-to-end. Reusable static/generalized-mixed/dependence psychometric arithmetic remains fast-mlsirm-owned and may be consumed only through an immutable released contract.

Current RED → causal repair: stable Between identity cannot acquire occasion aliases

Fresh review of the GAP-043/GAP-044 recovery-identity repair found that the generic tuple (unit_index, occasion_index, level) was too permissive for ComponentLevel::Between. Longitudinal decomposition defines that component as stable/unit-level and emits exactly one Between component per unit using canonical occasion_index = 0. The predecessor RMSE admission nevertheless accepted the same unit-level Between component again under another occasion index, which changed the recovery denominator without adding a new scientific target.

Public RED 0a03041c5c1c2152fe90f86204edf2c957cebbfe adds component_rmse_stable_between_identity_contract.rs: one unit supplies two stable Between rows under occasion indices 0 and 2, while a separate Within row carries error. The predecessor accepts both Between aliases as distinct tuple identities and lets the alias weight the RMSE denominator.

Review also found that the earlier cross-slice permutation regression itself had encoded nonzero occasion indices on stable Between fixtures. Commit 53563e975dd10e4f18218880cca2bb4cd79d0e73 corrects that fixture to canonical Between occasion 0 while preserving the original transport-permutation test.

Causal repair ec2c1219127e834d89051415f1de8e1cb48507aa validates bounded-context component identity before either truth or recovered map insertion. Stable Between requires canonical occasion index 0; Within retains its actual (unit, occasion) identity. Thus an occasion alias cannot become a second stable target or an implicit weight. Residual arithmetic, deterministic canonical accumulation, overflow-safe scaling, nonzero-RMSE underflow refusal, and exact perfect-recovery zero are unchanged.

Research trace c9cb68d30ea81bf15ec1326e74e94679f80287d5 distinguishes the scientific level boundary from TEPP's storage encoding: Curran & Bauer (2011) and Hamaker et al. (2015) support separation of stable between-person information from occasion-specific within-person process; occasion_index = 0 is TEPP's canonical carrier for the stable component, not substantive event time. Release fragment c6680450152b1e0a2c9abb553772d74a23923335 records the new admission rule.

This remains Longitudinal Modeling / Validation Evidence identity and projection policy, not reusable static psychometric arithmetic. A separately weighted recovery metric needs an explicit weight contract; duplicate rows and Between occasion aliases are never implicit weights. No fast-mlsirm source copy or mutable sibling dependency was introduced.

Retained scientific lineage

  • Duplicate known-truth identities cannot silently reweight the RMSE denominator (698f12f5...2fae4cb2...), and a mathematically nonzero component RMSE cannot underflow into false perfect recovery (496583c6...a82b383b...).
  • Truth/recovered rows align by scientific identity and residuals accumulate in canonical identity order, so serialization/query order cannot change admission or the deterministic CPU f64 result (8ad72ac9...2dd9537e...; 5fb93c40...025dce7f...; edge 976ce7d7...).
  • Adjacent-float irregular residual growth no longer forms a rounded quotient before ln; RED 766ddc7a... and repair 16f21d9a... use exact represented difference/ln_1p within the factor-two neighborhood while retaining direct-ratio/log-domain fallbacks at extreme scales.
  • Nonzero one-sign irregular-rate means fail closed if their final real mean is below binary64 range; exact all-zero input and exact mixed-sign cancellation remain zero (96f1c334...ae5081d8...).
  • Exact-zero CWC, occasion-mean, decomposition residuals and exact no-association correlation use a single public +0.0 identity only where zero has no directional scientific meaning; private numerical intermediates are not blanket-canonicalized.
  • Exact represented Cauchy–Schwarz boundary returns exact signed ±1; strict-interior covariance cannot round into a false perfect endpoint, and nonzero covariance cannot round into false zero.
  • CWC/occasion/decomposition and irregular-rate means share one Longitudinal-local deterministic overflow-safe compensated-mean authority. Same-sign minimum-subnormal ties-to-even, full-range mixed-sign cancellation, retained-count weighting and one-sign false-zero refusal are public-contract regressions.
  • Actual stationary variance fails closed when a strictly positive real estimand is unrepresentable; standardized maps that algebraically cancel that intermediate do not materialize it. discreteDRIFTstd and discreteDIFFUSIONstd retain their endpoint/subnormal refusal contracts.

#486 verified-successor consolidation

Commit db335d904ccc43dd0af7982c34df83008c968ef6 preserves #486's valid operational release delta as CHANGELOG.d/longitudinal-occasion-mean-event-time.md under the correct longitudinal_core owner. The survivor also carries Hamaker Eq. 1a scientific evidence, signed-zero-normalized numeric occasion identity, duplicate/sparse refusal, the shared stable mean, typed finite-positive event intervals, exact irregular-residual log-rate reuse, and explicit refusal to reinterpret the result as a within-person/RI-CLPM lag. Wrong-owner temporal source, raw-bit signed-zero identity, naive sum/count, mixed timezone provenance, and unsupported operational claims were intentionally not inherited.

Curran, P. J., & Bauer, D. J. (2011). The disaggregation of within-person and between-person effects in longitudinal models of change. Annual Review of Psychology, 62, 583–619. https://doi.org/10.1146/annurev.psych.093008.100356

Hamaker, E. L., Kuiper, R. M., & Grasman, R. P. P. P. (2015). A critique of the cross-lagged panel model. Psychological Methods, 20(1), 102–116. https://doi.org/10.1037/a0038889

Exact-head merge bar

Exact head c6680450152b1e0a2c9abb553772d74a23923335 remains Draft. No predecessor check or review evidence transfers after the RED/fixture-repair/source-repair/trace/changelog commits. Fresh exact-head Rust/documentation/security workflows and a qualifying independent current-head APPROVED submission are required. Live branch/ruleset requirements remain authoritative. Do not self-approve, force-push, destructively rebase, weaken coverage/security gates, or use admin bypass as routine delivery evidence. Merge only after every required exact-head gate is satisfied.

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

longitudinal_core에 typed event-time 값 객체와 지연 상관 표준화가 추가되었습니다. 표준화 diffusion, discrete DRIFT, CWC 후 불규칙 잔차 로그율 복구 함수도 추가되었습니다. 오류 계약, 수치 경계 검사, 공개 연결, 테스트 및 소유권 문서를 갱신했습니다.

Changes

종단 시간 표준화와 잔차 로그율 계약

Layer / File(s) Summary
경계 타입과 오류 계약
crates/longitudinal_core/src/event_time.rs, crates/longitudinal_core/src/error.rs, crates/longitudinal_core/src/lib.rs, crates/longitudinal_core/src/temporal_association.rs, crates/longitudinal_core/Cargo.toml
EventTimeInterval을 추가했습니다. 표준화 복구와 CWC 잔차 로그율 오류를 추가했습니다. typed event-time을 공개 경계와 내부 구현에 연결했습니다.
지연 상관 표준화
crates/longitudinal_core/src/association.rs, crates/longitudinal_core/src/temporal_association.rs, docs/research/trait-state-lagged-association.md
두 주변 분산과 지연 공분산을 요구합니다. 정확한 binary64 Cauchy–Schwarz 경계를 검사합니다. 제한된 나눗셈 순서로 상관관계를 계산합니다.
표준화 diffusion과 discrete DRIFT 복구
crates/longitudinal_core/src/stationary.rs, crates/longitudinal_core/src/diffusion.rs, crates/longitudinal_core/src/discrete_drift.rs, crates/longitudinal_core/tests/standardised_diffusion_contract.rs, crates/longitudinal_core/tests/standardised_discrete_drift_contract.rs, docs/research/standardised-discrete-drift.md
정상상태 within-person 분산을 복구합니다. 연속·이산 표준화 diffusion과 discrete DRIFT를 계산합니다. signed-zero underflow와 잘못된 추정량 해석을 거부합니다.
CWC 후 불규칙 잔차 로그율
crates/longitudinal_core/src/irregular_residual.rs, crates/longitudinal_core/tests/cwc_irregular_residual_contract.rs, docs/research/cwc-irregular-residual-log-rate.md, docs/research/longitudinal-within-between.md, docs/research/multilevel-event-time-recovery.md, docs/adr/longitudinal-modeling-ownership-addendum.md, docs/product/prd-v0.4-amendment-longitudinal-time-ownership.md
단위별 CWC 잔차쌍을 생성합니다. 동일 부호의 비영 잔차에 Driver Eq. 3 역 로그율의 안정적 쌍별 평균을 적용합니다. CWC 로그율을 raw-process drift로 해석하는 경로를 항상 거부합니다.
설계 기록과 변경 기록
ARCHITECTURE.md, CHANGELOG.md, CLAUDE.md, docs/research/standards-and-literature.md
시간 소유권, 수치 계약, 범위 제한, 연구 근거 및 변경 내용을 문서화했습니다.

Estimated code review effort: 4 (Complex) | ~60 minutes

Merge Risk: 🔵 Low · up to 6ee41

The change is mergeable with owner follow-up for a few bounded issues: clarify that the ln(0.5) example assumes a unit interval, correct the source-access dates, and make mean calculation deterministic with respect to input order. No high-impact merge-blocking risk is identified.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant irregular_residual
  participant EventTimeInterval
  participant LongitudinalError
  Caller->>irregular_residual: EventTimedObservation 전달
  irregular_residual->>irregular_residual: 단위별 CWC 및 이벤트 시간 정렬
  irregular_residual->>EventTimeInterval: 연속 이벤트 간격 생성
  EventTimeInterval-->>irregular_residual: 승인된 typed interval 반환
  irregular_residual-->>Caller: pairwise-mean log-rate 또는 LongitudinalError 반환
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning 직접 연결된 [#441]은 지연 상관관계 수정에 관한 이슈입니다. 그러나 PR에는 표준화 확산·드리프트, stationary variance, CWC 불규칙 잔차 로그율 및 관련 문서와 테스트가 함께 포함되어 [#441]의 범위를 벗어날 수 있습니다. 지연 상관관계 변경만 유지하거나, 확산·드리프트 및 CWC 불규칙 잔차 로그율 변경에 대한 별도 이슈를 연결하고 해당 범위를 PR 설명에 명시하십시오.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed recover_event_time_lagged_correlation은 [#441]의 요구사항을 충족합니다. 두 주변 분산, 지연 공분산, EventTimeInterval을 사용하고, 정확한 Cauchy–Schwarz 경계 검사와 비대칭 스케일의 안전한 표준화를 수행하며, 잘못된 입력을 실패-폐쇄합니다.
Docstring Coverage ✅ Passed Docstring coverage is 89.62% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 106 functions across 16 files. (10 skipped:…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 지연 상관관계와 discreteDRIFTstd 통합이라는 PR의 주요 변경을 정확히 요약합니다. 간결하고 구체적이며 변경 내용과 직접 관련됩니다.
Full details: Docstring Coverage

Explanation

Docstring coverage is 89.62% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 106 functions across 16 files. (10 skipped: 10 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/psychometric-discrete-drift-std-clean

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Note

This report is out of date. Scroll down for Devin Review's latest report on this PR.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

coderabbitai[bot]

This comment was marked as resolved.

CodeRabbit on #310 @ 93dc530: CHANGELOG and research notes said the
map was on current main; it lives on this PR until protected-main
integration. ADR 0005 keeps a single Implementation maturity line.
devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae
seonghobae marked this pull request as draft August 30, 2026 16:34
@seonghobae
seonghobae marked this pull request as ready for review August 30, 2026 17:03
Record the public +0.0 CWC lag contract, IEEE Std 754-2019 authority,
and the Curran/Bauer refusal that this identity repair is not raw-process
drift. Meredith (1993) and Mislevy (1991) remain unread.

Copy link
Copy Markdown
Contributor Author

Exact head is now 5c8fbd7c76e42679ea570beed859b0b4e065c049.

Public CWC lag residuals now use one canonical +0.0 for exact zero person-mean deviation (f98ee093f6f7fd318ad6623ab44313385195f956), matching the decomposition contract. Already-centered caller pairs are unchanged. The existing unstandardised stationary within-person variance is crate-public so all-targets builds do not treat that production path as dead. This is not DSEM and not raw-process drift (Curran & Bauer, 2011, Eq. 36).

No self-approval. Independent review is requested on this exact head. Queued/pending/skipped/cancelled/stale/predecessor-head checks are non-passing. Meredith (1993) and Mislevy (1991) remain unread.

Hamaker Eq. 1a occasion-mean residuals that are exact zero now use one
public +0.0 encoding, matching CWC and within/between decomposition.
Record the public +0.0 Hamaker Eq. 1a residual contract, IEEE Std
754-2019 authority, and the refusal that this identity repair is not a
within-person or RI-CLPM lag. Meredith (1993) and Mislevy (1991) remain
unread.

Copy link
Copy Markdown
Contributor Author

Exact head is now 884030d96eff62392517bbb53b02fea0b19f517e.

Public Hamaker Eq. 1a occasion-mean lag residuals now use one canonical +0.0 for exact zero occasion-mean deviation (238c4def7a5a5f19963d2e5cc936dd750d55c5a1), matching the CWC and decomposition contracts. Already-centered caller pairs are unchanged. These residuals still retain between-person differences and are not within-person, RI-CLPM, or DSEM lags (Hamaker, Kuiper, & Grasman, 2015, Eq. 1a).

No self-approval. Independent review is requested on this exact head. Queued/pending/skipped/cancelled/stale/predecessor-head checks are non-passing. Meredith (1993) and Mislevy (1991) remain unread.

Copy link
Copy Markdown
Contributor Author

@opencode-agent review | Independent exact-current-head formal review requested for 884030d96eff62392517bbb53b02fea0b19f517e (Hamaker Eq. 1a canonical exact-zero occasion-mean residual). Copilot REST reviewer request is not a collaborator path; MCP Copilot review is unavailable this cycle. Devin/CodeRabbit/author COMMENTED is not independent APPROVE. Do not self-approve. Do not merge while Draft and exact-head required checks are queued.

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.

1 participant