`lowess` returns 0 for points of an exact fit after robustness iterations
Maintainers usually reply within 1 day
@aviralgarg05 is already working on this.
Since Nov 17, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
Research direction
Start at stats.py lines 116-121, where the robustness iteration decides whether a median absolute residual of exactly 0 means an exact fit; that threshold is the fix. Run the reproduction snippet to confirm iter=1 passes while iter=5 returns 0 at points 44-49, then vary the slope and intercept to check the tolerance is not over-broad. ds.py:480 shows the caller in independent filtering, but the issue says the padj effect is unverified, so aim at lowess tests. Done means both iteration counts stay within 1e-6 of the line and existing stats tests pass.
Written by the indexing model from the issue text.
Description
After a robustness iteration, stats.lowess weights points by their residual over six times the median absolute residual; on an exact fit the residuals are rounding noise, so some points get weight 0, and where a whole neighbourhood does, lstsq returns beta = 0 and the fitted value is 0, as at points 46 to 49 of the line y = 3 - 7.5x with frac=0.1, iter=5; a local linear regression of points on a line should return the line, as the same call does with iter=1. stats.py:116-121 treats only a median of exactly 0 as an exact fit; treating a median below a small multiple of the targets' scale as zero would fix it.
lowess smooths the rejection counts of independent filtering (ds.py:480), whose plateaus are locally exact fits; we have not looked for a dataset where this changes padj.
Source line numbers refer to commit 2ca3b74.
Reproduction
import numpy as np
from pydeseq2.stats import lowess
x = np.linspace(0.1, 0.95, 50)
y = 3 - 7.5 * x
for iterations in [1, 5]:
fit = lowess(x, y, frac=0.1, iter=iterations)
off = np.flatnonzero(np.abs(fit - y) > 1e-6)
print(f"iter={iterations}: points off the line {off.tolist()}")
if len(off):
print("fitted:", fit[off].round(4).tolist())
print("line:", y[off].round(4).tolist())
Expected: no points off the line for either number of iterations.
Actual, with PyDESeq2 0.6.0:
iter=1: points off the line []
iter=5: points off the line [44, 45, 46, 47, 48, 49]
fitted: [-3.373, -3.4016, 0.0, 0.0, 0.0, 0.0]
line: [-3.4745, -3.6046, -3.7347, -3.8648, -3.9949, -4.125]
Split out from #491.
- Dominant language
- Python
- Stars
- 770
- Forks
- 98
- Avg merge
- 19h 55m
- Merged PRs (30d)
- 45
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from scverse/PyDESeq2
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
`irls_solver` does not enforce `min_beta` when IRLS converges, and documents `max_beta`'s default as -30May be free again @aviralgarg05 claimed this 15 days ago, and no pull request is open. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
scverse/PyDESeq2#521 · 1 comment ·
Maintainers usually reply within 1 day
-
`MAP_dispersions` of refitted genes keep the value from before outlier replacementMay be free again @aviralgarg05 claimed this 15 days ago, and no pull request is open. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
scverse/PyDESeq2#519 · 1 comment ·
Maintainers usually reply within 1 day
-
`prior_LFC_var` is squared in the Wald test's ridgeMay be free again A pull request for this issue was closed without being merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
All issues in scverse/PyDESeq2
Similar issues
-
Make the "%" unit spacing the same in the web and in A10Possibly taken @kragent66-glitch claimed this today. Openbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
maiychrus25/OpenTea-DX-OS#226 · 1 comment ·
-
ci severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
TMHSDigital/Spackle#205 ·
Maintainers usually reply within 1 day
-
pkg:lgm type:chore upstream-gaussx
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
jejjohnson/pyrox#610 ·
Maintainers usually reply within 1 day
-
changelog investigate
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ramnes/notion-sdk-py#523 ·
-
feature-request
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
open-telemetry/opentelemetry-python#5994 ·
Maintainers usually reply within 2 days