Abstract
Randomization testing is a fundamental method in statistics, enabling inferential tasks such as testing for (conditional) independence of random variables, constructing confidence intervals in semiparametric location models, and constructing (by inverting a permutation test) model-free prediction intervals via conformal inference. Randomization tests are exactly valid for any sample size, but their use is generally confined to exchangeable data. Yet in many applications, data is routinely collected adaptively via, e.g., (contextual) bandit and reinforcement learning algorithms or adaptive experimental designs. In this paper we present a general framework for randomization testing on adaptively collected data (despite its non-exchangeability) that uses a novel weighted randomization test, for which we also present novel computationally tractable resampling algorithms for various popular adaptive assignment algorithms, data-generating environments, and types of inferential tasks. Finally, we demonstrate via a range of simulations the efficacy of our framework for both testing and confidence/prediction interval construction.
Introduction
Randomization tests, such as permutation tests, are cornerstones of non-parametric statistics due to their "distribution-free" nature and exact validity at any sample size. However, their validity traditionally hinges on the assumption of exchangeability: the notion that any permutation of the observed data sequence is equally likely under the null hypothesis.
In modern data science, this assumption is frequently violated. In fields like clinical trials, mobile health, and online advertising, data is often collected adaptively. For instance, in a multi-armed bandit setting, the treatment assigned to the next patient depends on the outcomes of previous patients. This adaptive nature introduces complex temporal dependencies that destroy exchangeability. Applying standard permutation tests to such data leads to invalid p-values and unreliable confidence intervals. This paper addresses this gap by proposing a framework for randomization testing that remains valid even when data is collected adaptively.
The Weighted Randomization Test Framework
The core innovation is a weighted Monte Carlo (MC) randomization test. Instead of treating every resampled version of the data as equally likely, the framework assigns a weight to each resampled data sequence. These weights are derived from the known probabilities of the adaptive assignment algorithm (the "policy").
As shown in Algorithm 1, the process involves sampling $m$ resampled sequences $\tilde{D}^{(i)}$ from a resampling distribution $q$. The key is the computation of weights $w_{\mathfrak{D}}^q(\tilde{D}^{(i)})$ based on a likelihood ratio. If a specific "proportionality condition" is satisfied, the resulting p-value is guaranteed to be exactly valid, regardless of the underlying environment's distribution.
Resampling Strategies and Test Inversion
To ensure high statistical power, the resampled sequences should closely resemble the original data-generating process. The authors introduce three "imitation" strategies:
- imitation$\pi$: Sequentially samples timesteps from the original data to mimic the original algorithm's behavior.
- re-imitation$\pi$: Rerandomizes the internal "noise" of the assignment algorithm during resampling.
- cond-imitation$\pi$: Conditions on the original algorithm's noise to stabilize weights and improve efficiency.
Furthermore, these tests can be "inverted" to construct valid confidence regions for model parameters and prediction intervals for future outcomes, extending the reach of conformal inference to non-exchangeable, adaptive settings.
Experimental Evaluation
The framework was evaluated using simulated environments where ground truth is accessible, including:
- Contextual and Contextless Bandits: Employing algorithms like $\epsilon$-greedy, UCB, and LinUCB.
- Markov Decision Processes (MDPs): Testing for non-stationarity in state-transition environments.
- Non-stationary Environments: Assessing the framework's ability to detect changes in response distributions over time.
Key Results and Insights
- Exact Validity: Simulations confirmed that the framework maintains the nominal Type-I error rate (e.g., 5% for a 95% confidence level) across various sample sizes and algorithms.
- Superior Power: The weighted MC test demonstrated significantly higher power than previous unweighted methods, particularly in stationary environments.
- Handling Determinism: A major breakthrough is the framework's effectiveness with deterministic algorithms (like UCB). While prior methods often struggled or lacked power in these cases, the weighted approach remains robust.
- Computational Efficiency: The resampling algorithms scale linearly with the number of timesteps ($T$). A "sample sharing" technique further accelerates the construction of prediction intervals by over 5x.
Limitations and Future Work
While powerful, the framework faces challenges in "low-regret" scenarios (e.g., LinUCB) where the policy quickly converges to a single action, reducing the effective sample size for alternative treatments. In large-state MDPs, finding enough valid permutations to maintain power can also be difficult. Future research will focus on identifying optimal resampling distributions to maximize power across diverse algorithmic and environmental contexts.
Summary updated