Skip to content

Fix StudentT quantile sign flip and non-monotonicity for small nu #1395

Description

@synesenom

Goal

As a user calling .q(p) on StudentT with small degrees of freedom (nu) and p very close to 0 or 1, the returned quantile should be monotonically non-decreasing in p and have the mathematically correct sign, instead of silently returning a negative value when the true quantile is a large positive number (or exhibiting a large non-monotonic jump between adjacent p values).

Scope

src/dist/student-t.js — the closed-form _q(p) implementation.

Acceptance Criteria

  • new dist.StudentT(2).q(p) is non-decreasing for p sampled densely in the extreme lower tail (e.g. p in [1e-6, 1e-5]), to within numerical tolerance.
  • new dist.StudentT(0.15615547442198802).q(0.9999876066169184) returns a large positive value consistent with the independently mpmath-verified true quantile (~6.5e28), not a negative value.
  • Round-trip |cdf(q(p)) - p| and the monotonicity hard-failure check in scripts/difftest-quantile.py's round-trip sweep pass for StudentT across the extended tail range.
  • No regression in existing StudentT precision-gate / reference values for interior p.

Out of Scope

General closed-form quantile approximation redesign for all nu ranges — only the small-nu extreme-tail regime identified by this sweep.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions