Add SAVI e-values for linear regression - #9868
Open
michaellindon wants to merge 11 commits into
Open
Conversation
Author
|
Please let me know if you have any feedback concerning the API |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for safe anytime-valid inference (SAVI) for linear regression results, based on Lindon et al. (2026), "Anytime-Valid Inference in Linear Models with Applications to Regression-Adjusted Causal Inference," Journal of the American Statistical Association
The implementation reuses statsmodels' existing
tandFstatistics, including the active covariance estimator. This keeps the implementation thin while making e-values, SAVI p-values, and confidence sequences available from fitted regression results.Motivation
This is useful from three related perspectives.
Anytime-valid inference
Classical regression p-values and confidence intervals are fixed-sample objects. They are not generally valid under continuous monitoring or optional stopping. SAVI replaces these with e-processes and confidence
sequences that remain valid over time, allowing users to monitor results as data accumulate while preserving time-uniform Type I error and coverage guarantees.
See Ramdas et al., "Game-theoretic statistics and safe anytime-valid inference".
Multiple testing
E-values are useful beyond sequential monitoring. They can be combined with multiple-testing procedures such as e-BH, which provides an e-value analogue of Benjamini-Hochberg and controls FDR under arbitrary dependence
between e-values. This makes e-values attractive for dependent regression screens, structured hypothesis tests, and exploratory workflows where many hypotheses are considered.
See Wang and Ramdas, "False discovery rate control with e-values".
Post-selection inference
Confidence intervals obtained by inverting e-values, or e-CIs, have strong post-selection properties. They can be adjusted after arbitrary data-dependent selection while controlling false coverage rate under arbitrary
dependence. This makes confidence sequences/e-CIs especially useful after model selection, variable screening, or exploratory regression analysis.
See Xu, Wang, and Ramdas, "Post-selection inference for e-value based confidence intervals".
API
This PR adds:
RegressionResults.e_values(..., g=...)for parameter-wisettests or joint linear restrictions viaFtests.RegressionResults.p_values(savi=True, g=...)for reciprocal e-values as SAVI p-values.RegressionResults.conf_int(savi=True, g=...)for parameter-wise confidence-sequences/e-CIs.RegressionResults.summary(savi=True, g=...)to display e-values and confidence sequences in the regression summary table, including replacing the model-levelProb (F-statistic)with an F-test e-value.RegressionResults.sequential_p_values(..., g=...)andRegressionResults.confidence_sequences(..., g=...)as explicit aliases for users who prefer sequential-inference terminology.Classical behavior is unchanged unless
savi=Trueis requested.Example
The example below uses the full statsmodels Longley dataset:
Testing
Tests cover:
tandFstatistics,summary(savi=True)replacing coefficient p-values, coefficient intervals, and the model-level F-test p-value,gandalpha,n.avlmCRAN package on the same input data, up to floating-point precision.