Posterior SBC Support#54
Merged
aloctavodia merged 23 commits intoJun 1, 2026
Merged
Conversation
…ation of rank statistics of another quantity via compute_rank_statistics
68263df to
3189ee0
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #54 +/- ##
==========================================
+ Coverage 96.30% 96.69% +0.39%
==========================================
Files 3 4 +1
Lines 352 545 +193
==========================================
+ Hits 339 527 +188
- Misses 13 18 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
aloctavodia
reviewed
May 29, 2026
aloctavodia
reviewed
May 29, 2026
aloctavodia
reviewed
May 29, 2026
Contributor
|
Docs seem to be too heavy for RTD, we should run them locally so RTD only handles rendering the results. |
… sbc, and other doc related changes
Updated bambi and arviz_base to newer versions.
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 #12 and referenced #49
Depends on #53 and #52
This PR introduces support for Posterior SBC using PyMC Models. Given original posterior samples, generate posterior predictive samples, augment them with the original observed data, sample from posterior conditioned on the augmented data, and compute rank statistics comparing the original posterior samples and the augmented posterior samples.
Constraint of Implmentation
Posterior SBC augments the observed data (concatenating original + replicated), which changes its size. For this to work, store observed data in
pm.Datacontainers, and specify size using thedimsparameter instead of setting a static shape.If your model uses
dimsandcoords, you are also responsible for resizing them to the correct size corresponding to the new augmented dataset via theupdate_datacallback. Similarly, if your model has covariates, store them inpm.Dataso they can be resized in the same callback.New Parameters for SBC Class
method="posterior": You can now pass an originaltrace(containing posterior distributions) alongsidemethod="posterior"to execute Posterior SBC.augment_observed: Custom logic for how to augment the posterior predictive sample and the observed data, the default behavior is to concatenate on the first axis.update_data: Called before conditioning on the augmented dataset. custom logic to update the covariates, coords to conform to the new augmented data. There is no default behavior, but if user does not modify variable that are of typepm.Datathat are used for observed data, the code will update according to the augmented data.Misc