Two-stage Bayesian regression enforcing a fixed distribution (not Just Hierarchical regression)

@junpenglao Thank you for your solution. It works as intended. If I understand correctly, you created a custom sampler (e.g like Metropolis-Hastings) from the step method class https://docs.pymc.io/en/latest/_modules/pymc/step_methods/metropolis.html
but instead of taking in logp and returning samples from the logp density like normal samplers do it just samples from our specified distribution and assigns it to the specified viarable (e.g. “sigma”).“sigma” can then be used in for further hierarchical calculations (I’ve tested it on toy calculation). I think the remaining free variables are automatically assigned to the NUTS sampler, and it passes the samples sequentially (if there are two-step methods) between samplers at each step?

Yes, exactly! I think that this is what is happening the math side:

1 Like