My model gives some nice results. Now I would like to investigate what would happen if the value of some RVs were to be changed, e.g. by an outside intervention. In particular I would like a function that is much like sample_posterior_predictive()
, but has an additional parameter, something like this:
sample_posterior_intervention(
trace, var_names=['results'],
intervention={'mu': lambda x: x+1, 'sigma': lambda x: x * 0.5}
)
meaning run the posterior intervention, but instead of using the value of mu
in the trace, use mu + 1
, and instead of using the value of sigma
, use sigma * 0.5
.
I appreciate that pymc3.sampling
has nothing like my imagined sample_posterior_intervention()
already. How could I implement this behavior using the existing pymc3.sampling
functions?
Or is this a nonsensical thing to do?