Add Bayesian experimentation triptych#883
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
Update the examples to run with PyMC > 6 and ArviZ > 1 |
|
Thanks @aloctavodia will do. Want to rework the writing a bit. Will work on it over the weekend and update the environment too. |
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
| @@ -0,0 +1,1380 @@ | |||
| { | |||
There was a problem hiding this comment.
make it clear these are just examples. Maybe something like
The engine is the same whether the response is continuous (like revenue per visitor) or binary (like conversion);
Or expand the sentence.
Reply via ReviewNB
| @@ -0,0 +1,1380 @@ | |||
| { | |||
There was a problem hiding this comment.
| @@ -0,0 +1,1380 @@ | |||
| { | |||
There was a problem hiding this comment.
pc = az.plot_dist(idata_gauss_demo,
var_names=["delta"],
visuals={"title": {"text": r"Posterior on
)
az.add_lines(pc,
values=0.0,
visuals={"ref_line": {"color": "C1", "label": "ref = 0.0"}},
);
pc.get_viz("plot").legend()
Reply via ReviewNB
| @@ -0,0 +1,1380 @@ | |||
| { | |||
There was a problem hiding this comment.
This also works (just wanted to mention, no need to change it)
mcmc_mu = az.mean(idata_gauss_demo)["delta"].item()
mcmc_sd = az.std(idata_gauss_demo)["delta"].item()
Reply via ReviewNB
| @@ -0,0 +1,1380 @@ | |||
| { | |||
There was a problem hiding this comment.
|
View / edit / reply to this conversation on ReviewNB aloctavodia commented on 2026-06-09T10:24:51Z similar to my comment for the first notebook |
|
View / edit / reply to this conversation on ReviewNB aloctavodia commented on 2026-06-09T10:24:52Z you can do something like this
dt = az.from_dict( {"posterior": { "theta_new": theta_new_samples, "d_hat_new": d_hat_new_samples, }}, sample_dims=["sample"], )
pc = az.plot_dist( dt, kind="hist", sample_dims=["sample"], cols=[], aes={"color": ["__variable__"]}, visuals={"point_estimate":False, "point_estimate_text":False, "credible_interval":False, }, ) pc.add_legend("__variable__") |
|
Thanks for these comments @aloctavodia i'll try and address these later this week! |
|
@aloctavodia I think this should be ready now. |
Experimentation Workflow and Cycle: Assurance, Sensitivity and Meta-Analysis.
PyMC examples covers a lot of ground in hierarchical modelling and causal inference, but the experimentation workflow is underspecified. We have scattered A/B testing notebooks but nothing that treats planning, interpretation, and synthesis as a connected sequence — the kind of end-to-end picture a practitioner actually needs when running repeated experiments across markets, time periods, or populations. This PR is an attempt to fill that gap.
The addition is a triptych of notebooks under
causal_inference/:The notebooks cross-reference each other and are meant to be read as a loop: each notebook's posterior becomes the next one's prior. The framing is product experimentation but the machinery maps directly to clinical trials — close enough that the FDA's January 2026 draft guidance on Bayesian methodology names the same tools: assurance as "Bayesian power averaged over a design prior," hierarchical models as the recommended mechanism for subgroup borrowing and cross-trial synthesis, sensitivity analysis as building uncertainty about assumptions into the prior itself.
Related to #884
Helpful links