Skip to content

Varying slopes: multiple slopes per factor (V≥2) + full rank-drop contract (#60)#80

Merged
schroedk merged 2 commits into
feature/slopesfrom
slopes/60-multi-slope
Jul 8, 2026
Merged

Varying slopes: multiple slopes per factor (V≥2) + full rank-drop contract (#60)#80
schroedk merged 2 commits into
feature/slopesfrom
slopes/60-multi-slope

Conversation

@schroedk

@schroedk schroedk commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Closes #60.

Generalizes the within-level reparametrization to any slope count on the sole factor: one-pass multivariate Welford moments per level, pivoted Gram–Schmidt on the centered slope Gram (raw for slope-only terms) taking the largest-remaining-variance direction each step, and a whitening map whose transpose back-transforms coefficients — dropped directions come back as exact zeros with a data-independent layout.

  • Rank-drop contract: within-level collinear slopes drop exactly one direction (the pivot picks the survivor). The relative tolerance is crate-internal (1e-10, per-column so it is scale-invariant); a zero tolerance keeps near-degenerate directions, tested at the unit seam.
  • Pivots are tracked through original column indices with no physical swapping, structurally excluding the prototype's ≥3-slope pivot-bookkeeping cliff; a property test forces a non-monotonic pivot order and asserts W·G·Wᵀ = I.
  • The gate now rejects only slope terms alongside other terms (Varying slopes: cross-factor signed routing — balance + scale + Schur (balanced/scalable) #61). V=1 behavior is unchanged.
  • Tests (bare-minimum set): the two whitening-seam unit tests above, one consolidated V=3 integration test (bounded iterations, exact rank-drop reporting, residual-orthogonality + fitted-reconstruction oracle), and weighted V=3 pyfixest parity.

@schroedk schroedk force-pushed the slopes/60-multi-slope branch from 32c14a3 to 77bb48c Compare July 7, 2026 22:03
…pivoted Cholesky (#60)

Generalizes the within-level reparametrization to any slope count:
one-pass multivariate Welford moments per level, pivoted Cholesky on the
centered slope Gram (raw for slope-only terms) taking the
largest-remaining-variance direction each step, and a whitening map whose
transpose back-transforms coefficients — dropped directions come back as
exact zeros with a data-independent layout.

Completes the rank-drop contract: within-level collinear slopes drop
exactly one direction (the pivot picks the survivor); a crate-internal
relative rank tolerance (1e-10, per-column so it is scale-invariant)
governs the threshold, with zero keeping near-degenerate directions.

The multi-term gate stays (#61); only the V>=2 restriction lifts.
@schroedk schroedk force-pushed the slopes/60-multi-slope branch from 77bb48c to a755b02 Compare July 7, 2026 22:15
@schroedk schroedk merged commit efde816 into feature/slopes Jul 8, 2026
3 checks passed
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.

1 participant