feat: sobol_indices() -- expose total-order Sobol indices (#120) - #121
Merged
Conversation
screen(method="sobol") only ever returned S1 (first-order), silently
discarding ST (total-order) even though the same SALib
sobol_analyze.analyze() call already computes it. S_T - S_1 is the
standard way to detect interaction effects -- a factor with small S1
but large ST is interacting with other factors rather than acting
independently -- and screen() couldn't surface that at all.
sobol_indices() is a new function (screen() itself is unchanged, so
existing callers are unaffected) returning {observable: (S1, ST)}.
Shares the Saltelli sampling/evaluation loop with _screen_sobol via a
new _sobol_sample_and_evaluate() helper rather than duplicating it.
Tests include a from-scratch interaction-detection case (a pure
product of two zero-mean-centered factors: S1~0 for both, since
E[Y|A]=A*E[B]=0 and vice versa, but ST>0 for both since the
interaction is real) confirming ST actually catches what S1 misses,
not just that the two arrays have the right shape.
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
`screen(method="sobol")` only ever returned S1 (first-order), silently discarding ST (total-order) even though the same underlying `SALib.analyze.sobol.analyze()` call already computes it for free. `ST - S1` is the standard way to detect interaction effects -- a factor with small S1 but large ST is interacting with other factors rather than acting independently -- and `screen()` couldn't surface that at all.
Design
Test plan
Closes #120