Skip to content

[T-101b] Statistics: Kaplan–Meier curves and log-rank test for MET-03 (censored) #107

Closed

Description

@CodewithJha

Task T-101b · Milestone M4 — Baselines + metrics + experiments · Size S · Priority P1 · Epic #4

Implements FR-EXP-002

Branch feat/t-101b-statistics-kaplan-meier-curves-and — one task = one branch = one PR (doc 32 §6)

Summary

Implement KM estimator and two-sample log-rank test (~40 lines, no lifelines) in metrics/survival.py, unit-tested against a published example.

Context / motivation

Doc 19 §5 step 4: MET-03 is right-censored at B; survival analysis handles 'never found' properly.

Scope

In scope

  • kaplan_meier(times, events) -> (t, S(t)), logrank(times_a, events_a, times_b, events_b) -> (chi2, p).

Implementation guidance

  • Cite the textbook example used in the test docstring.
  • Standards: respect the layering contracts (doc 16 §2) and conventions in doc 34; no hard-coded tunables — thresholds/defaults come from typed settings (doc 27); no magic numbers (ruff PLR2004); public APIs typed (mypy strict) and documented.

Acceptance criteria

  • Reproduces a published worked example (chi-square & p within 1e-6).
  • Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
  • Docs, config reference and CHANGELOG Unreleased updated where behaviour, keys or interfaces changed.
  • Definition of Done (doc 32 §3) satisfied.

Tests required

  • tests/unit/metrics/test_survival.py.

Dependencies

Blocked by: #106 (T-101a)

Blocks: #141 (T-079)

Parallelization notes

Files / paths owned by this task — avoid editing other paths; shared files (pyproject.toml entry points, cli/main.py, api/routers/__init__.py, router.tsx, docker/compose.yaml, ci.yml) are append-only:

  • backend/src/roboprobe/metrics/survival.py

Independent.

Definition of Done

Per doc 32 §3 and AGENTS.md §5: lint, format, mypy strict and import-linter green; tests added and passing; docs updated; PR template completed with Closes #<this issue>; Conventional Commit messages referencing T-101b (doc 16 §6); commits authored only by the repository owner identity (AGENTS.md §4); CI green; reviewer checklist (doc 32 §5.1) satisfied.

References

Design docs: doc 19 §5

Requirements: FR-EXP-002 (traceability: doc 28)

External:

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:metricsEvaluation metrics MET-xxgood first issueGood for newcomersmilestone:M4M4 — Baselines + metrics + experimentspriority:P1Required for milestone exitsize:S<= 1 daytaskChild task of a milestone epictype:featureNew functionality

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions