Repository navigation
Closed
Labels
phaseEpic implementation phase
Description
🤖
Phase 3: Statistics Package
Summary
Create the useful EEGPrep equivalent of EEGLAB's functions/statistics package. This phase should provide stable numerical helpers that time-frequency and STUDY phases can reuse instead of reimplementing.
Can start after Phase 1 merges. Can run in parallel with Phases 2 and 4.
Scope
Prioritize useful, workflow-supporting helpers:
statcond,teststat,fdr- surrogate confidence interval and p-value helpers
- cell-array style ANOVA/correlation/t-test helpers adapted to Python/NumPy inputs
concatdataor equivalent only if used by STUDY/time-frequency paths
Do not expose stale MATLAB-only convenience wrappers unless Phase 1's matrix classifies them as needed.
Acceptance Criteria
- Add an EEGPrep statistics package in the locally appropriate source location.
- Public functions have concise docstrings and clear NumPy input contracts.
- Deterministic MATLAB parity tests cover numerical behavior with documented tolerances.
- Invalid shape/type inputs fail clearly.
- Phase 4 and Phase 6 can consume the helpers without private copy-paste implementations.
- Matrix rows touched by this phase are updated.
Verification
Run:
- focused statistics tests
- MATLAB parity tests for deterministic functions
uv run --no-sync ruff check .uv run --no-sync ruff format --check .uv run --no-sync ty check- broader non-slow tests if shared numerical helpers affect existing workflows
/goal Prompt
/goal Port the EEGLAB statistics helper package needed by EEGPrep workflows. Use EEGLAB as oracle, implement idiomatic standalone Python/NumPy equivalents, add deterministic MATLAB parity tests and edge-case tests, expose only useful public APIs without stale helper bloat, and update the parity matrix for every function classified in this phase.
Metadata
Metadata
Assignees
Labels
phaseEpic implementation phase
Activity
claude commentedon Jun 5, 2026
🤖 Plan:
Research
Epic-scale phase issue: port EEGLAB's 15-function
functions/statisticspackage, add deterministic MATLAB parity tests, and update a parity matrix. Well over the 100-line ceiling for a single agent PR, and it has unresolved upstream dependencies.Blockers:
Relevant code
NotImplementedErrorforrboot/pboot/erspboot/itcbootis the eventual consumer of these helpersProposed Approach
Do not implement in one PR. Stage the work behind Phase 1 and split by helper family. Recommended sequencing once Phase 1 merges and
src/eegprep/eeglab/functions/statistics/is populated:fdr+ parity-matrix wiring. Newsrc/eegprep/functions/statistics/__init__.py, portfdr(BH and BY, deterministic, exact MATLAB parity), classify the other 14 rows in the matrix asport/consolidated/stale_skip. Small, lands the package shape. Likely ~150-250 LOC.ttest_cell,ttest2_cell,anova1_cell,anova1rm_cell,anova2_cell,anova2rm_cell,corrcoef_cell. NumPy-vectorised, MATLAB parity tests against fixed seeds. Likely ~400-600 LOC + tests.surrogdistrib,stat_surrogate_pvals,stat_surrogate_ci,concatdata,teststat, andstatcond(dispatcher that calls the cell helpers andsurrogdistrib).statcondfieldtrip→ classifyexternal_dependency_skipunless Phase 1 disagrees. Likely ~500-800 LOC + tests.Each PR carries its own MATLAB parity tests (gated on MATLAB Engine / Octave per AGENTS.md), deterministic seed fixtures, ruff/ty/pre-commit, and matrix updates. Phase 4 (#135) consumes PR C; Phase 6 (#137) consumes PRs B and C.
Open questions for a human before I start:
feature/eeglab-core-parity-completionwith the matrix scaffold pre-filled?src/eegprep/eeglab/is empty in this checkout — is that intentional (gitignored locally) or is it expected to be present before this phase starts? It is required as the porting oracle.statcondfieldtripbe markedexternal_dependency_skip(FieldTrip is not in EEGPrep) orportwith a thin no-FT shim?surrogdistrib— full bootstrap/permutation/jackknife as in EEGLAB, or only the modes Phase 4/Phase 6 will actually call?suraj-ranganath commentedon Jun 7, 2026
🤖 Resolved by the work now included in PR #152. Closing this constituent phase/follow-up issue now; parent epic #131 remains open until the epic PR merges.