Statistical Testing Framework for Clustering Pipelines by Selective Inference

Yugo Miyata, Tomohiro Shiraishi, Shuichi Nishino, Ichiro TakeuchiarXiv 2026

TL;DR

Data analysis pipelines that combine outlier removal, feature selection, and clustering suffer from severe selection bias, causing standard statistical tests to produce false positives. This paper introduces a novel selective inference framework that models these multi-step pipelines as Directed Acyclic Graphs (DAGs). By using an efficient parametric line-search method, the framework computes mathematically valid $p$-values that strictly control the false positive rate while maintaining high statistical power.

What Problem Does This Paper Address?

In real-world data science, we rarely just throw raw data straight into a clustering algorithm. Instead, we build pipelines: we filter out outliers, select the most informative features, and then run a clustering algorithm like $k$-means or DBSCAN.

The catch? Every single one of these preprocessing steps is data-dependent. When we test whether the resulting clusters are statistically significant, standard statistical tests (like a classical $z$-test) completely break down. They assume your hypothesis was chosen before looking at the data. Choosing the hypothesis based on the data—a phenomenon known as "double-dipping" or selection bias—inflates the Type I error rate, frequently leading researchers to find "significant" clusters in completely random noise.

Figure 1: Two examples of clustering pipelines composed of outlier detection

While data-splitting or resampling can sometimes mitigate this, they drastically reduce statistical power and are often invalid for unsupervised learning tasks where the data structure itself dictates the hypothesis.

Methods

The authors tackle this challenge using Selective Inference (SI). The core idea of SI is to perform statistical testing by conditioning the probability distribution of the test statistic on the exact sequence of choices made by the pipeline.

To make this universal and scalable, the authors introduce two key innovations:

  1. Pipeline-as-a-DAG Abstraction: The entire pipeline is represented as a Directed Acyclic Graph (DAG), where nodes are algorithms (e.g., $k$-NN outlier removal, variance-based feature selection) and edges represent data flow. Because DAGs admit a topological ordering, the selection intervals can be updated sequentially.
  2. Parametric-Programming Line Search: Instead of manually deriving a complex conditional test for every unique pipeline configuration, the framework uses a line-search strategy. It perturbs the data along a single dimension (the direction of the test statistic) and tracks how the pipeline's decisions change. This allows it to efficiently compute the exact "truncation region"—the exact set of data configurations that would yield the same outliers, features, and clusters.

Datasets

The framework was evaluated on both synthetic and real-world datasets:

  • Synthetic Data: Generated under null conditions (no true clusters) and alternative conditions (three true clusters) with varying sample sizes ($n \in [100, 250]$) and feature dimensions ($d \in [5, 20]$).
  • PBMC 3k: A real-world single-cell RNA-sequencing dataset containing ~3,000 cells and 32,000 gene expression features. It was split into clustered data (mixing distinct T-cells and B-cells) and non-clustered data (homogenous T-cells only).
  • Marketing Campaign Dataset: A customer segmentation dataset containing 2,240 customers and 15 features, similarly split into clustered and non-clustered subsets based on income homogeneity.

Key Insights and Ideas

  • Preprocessing is Part of the Inference: Outlier detection and feature selection contribute just as much to selection bias as the clustering algorithm itself. Valid inference requires accounting for the entire pipeline.
  • Overcoming Over-Conditioning: Previous naive attempts at selective inference conditioned on too much information (e.g., treating the pipeline as a single rigid interval), which killed statistical power. By identifying the full union of valid intervals via parametric programming, this method recovers significant power.
  • The Power of Modularity: By framing the pipeline as a DAG with standardized update rules for each node type (Union, Intersection, Selection), the framework allows users to mix and match components without rewriting the underlying statistical proofs.

Key Results

  • Perfect Type I Error Control: In all null-hypothesis experiments (synthetic and non-clustered real data), the proposed method strictly controlled the Type I error rate at the nominal $\alpha = 0.05$ level. Meanwhile, the naive test completely failed, routinely returning $p = 0.000$ for random noise.
  • Superior Statistical Power: In power experiments, the proposed line-search method consistently outperformed both the Bonferroni correction (which is overly conservative due to the massive combinatorial explosion of possible pipeline paths) and the over-conditioned baseline (w/o-pp).
  • Real-World Sanity Checks: On the non-clustered PBMC 3k data (pure CD4 T-cells), the naive test incorrectly claimed a significant cluster structure across all genes. The proposed framework correctly suppressed these false positives for most features, while still identifying known biological marker genes (like JUNB and S100A4) in the true clustered data.

Limitations and Future Work

While a major step forward, the framework currently only supports a specific class of predefined components (such as $k$-NN for outliers, variance/correlation for features, and $k$-means/DBSCAN for clustering). If a researcher wants to use a novel algorithm within the pipeline, they must first derive its specific parametric update rule.

Additionally, the authors note that future work will focus on expanding this framework to support more complex model selection steps, such as hyperparameter tuning via cross-validation.

Summary updated

BibTeX
@misc{miyata2026statistical,
  author = {Yugo Miyata and Tomohiro Shiraishi and Shuichi Nishino and Ichiro Takeuchi},
  title = {{Statistical Testing Framework for Clustering Pipelines by Selective Inference}},
  year = {2026},
  eprint = {2603.18413},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.18413},
}
Figure