feat: variable selection priors for SSTS covariates - #1112
Open
anevolbap wants to merge 2 commits into
Open
Conversation
This was referenced Jul 31, 2026
anevolbap
force-pushed
the
issue-758-ssts-variable-selection
branch
from
July 31, 2026 02:07
853ffdf to
c58c9e3
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## issue-758-ssts-covariates #1112 +/- ##
=============================================================
+ Coverage 97.17% 97.19% +0.01%
=============================================================
Files 120 120
Lines 21002 21100 +98
Branches 1132 1140 +8
=============================================================
+ Hits 20409 20508 +99
- Misses 395 396 +1
+ Partials 198 196 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
anevolbap
force-pushed
the
issue-758-ssts-variable-selection
branch
from
July 31, 2026 13:06
c58c9e3 to
d158d16
Compare
anevolbap
force-pushed
the
issue-758-ssts-variable-selection
branch
from
July 31, 2026 17:28
d158d16 to
b9da23f
Compare
anevolbap
marked this pull request as ready for review
July 31, 2026 17:32
anevolbap
force-pushed
the
issue-758-ssts-variable-selection
branch
from
August 3, 2026 20:19
b9da23f to
031c83d
Compare
anevolbap
force-pushed
the
issue-758-ssts-variable-selection
branch
from
August 4, 2026 02:36
031c83d to
e13d969
Compare
Wire VariableSelectionPrior (spike-and-slab, horseshoe, normal) to the StateSpaceTimeSeries regression coefficients via vs_prior_type and vs_hyperparams, mirroring InstrumentalVariableRegression. The generic prior loop special-cases beta_exog when configured. Expose get_inclusion_probabilities() and get_shrinkage_factors() pass-throughs (groundwork for the inclusion plot in #758 P6). Prototype-verified: sampling is clean and inclusion probabilities rank true predictors first. beta_exog point estimates attenuate toward zero because P0 lets the regression states drift from the parameter; pinning the exog P0 entries fixes that on paper but makes NUTS pathologically slow, so the caveat is documented instead. Counterfactual forecasts use the smoothed states and are unaffected.
anevolbap
force-pushed
the
issue-758-ssts-variable-selection
branch
from
August 4, 2026 11:23
e13d969 to
e855435
Compare
Collaborator
Automated triageRecommendation: Why:
Review focus:
Confidence: high |
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.
Closes #981. Part of #758 (P0). Stacked on #1111, review that one first. Targets
pymc6_and_pymcmarketing1_migration.Adds
vs_prior_type("spike_and_slab", "horseshoe", or "normal", the same set the factory accepts) andvs_hyperparamstoStateSpaceTimeSeries, mirroringInstrumentalVariableRegressionand reusingcausalpy/variable_selection_priors.pyunchanged. When set, thebeta_exogprior is built by the factory instead of the default. Passing bothpriors={"beta_exog": ...}andvs_prior_typelets variable selection win, with a warning, same as the IV class. Setting it without covariates raises at build time.get_inclusion_probabilities()andget_shrinkage_factors()are thin pass-throughs to the factory, which prepares the P6 plotting item of #758.Known caveat, documented and accepted:
beta_exogpoint estimates shrink toward zero, becauseP0(the initial state covariance, unrelated to the P0 priority label of #758) lets the regression states drift away from the parameter. Pinning the exogP0entries fixes the statistics on paper but makes NUTS pathologically slow, 15+ minutes against about 2, so it is not done here. Counterfactual forecasts ride on the smoothed states, which do recover the truth, and selection uses the inclusion-probability ranking, which is correct.Tests assert API shape, dims and coords only. The suite mocks
pm.sample, so posterior recovery cannot be asserted there. Selection behavior was checked in a prototype and is demonstrated in the notebook in the next PR.Verified locally with pymc 6.2.0, arviz 1.2.0, pymc-extras 0.14.0: 1407 passed, 17 skipped.