Jeffreys-Zellner-Siow priors in PyMC

Dear all,
I hope whoever reads this has a great time/day/evening/night :slight_smile:
I am conducting a bayesian mediation analysis for a scientific paper and the “typically” used priors are Jeffreys-Zellner-Siow (JZS) priors. I have searched it everywhere but could not found any information regarding if JZS is implemented in PyMC. I know it is implemented in other packages like in R and JASP but I like PyMC too much to give up here :slight_smile:
Thanks a lot in advance,

@drbenvincent might be able to add something more. I didn’t know what the JZS prior was, so I am ttaking the definition from this reference:

The combination of the Jeffrey’s prior on σ2 and this Cauchy prior on μ under H2 is sometimes referred to as the Jeffrey-Zellener-Siow prior.

Zellner-Siow Cauchy prior:  mu | sigma^2 ~ C(0, 1*sigma)
improper Jeffreys prior: p(sigma^2) = 1/sigma^2

If you really want to do this you can use something like:

sigma = pm.HalfFlat("sigma")  # add a variable with "no prior" as long as it's positive
pm.Potential("jeffrey", -2*sigma)  # jeffrey's prior, potential adds the
# respective logp term to the model logp
mu = pm.Cauchy("mu", 0, sigma)

You need to be aware however that improper priors are generally hard to sample from. You might want to consider a very wide half normal (if 0 is allowed) or a lognormal (if 0 is not allowed) as priors for sigma.

I’m afraid I don’t have any experience of it. But I did find this hypothesis testing - Understanding the Jeffreys-Zellner-Siow (JZS) prior in Bayesian t-tests - Cross Validated

Thanks a lot for your answer. That reference is definitely a good one. I will try to implement that.

Yes, I came across that as well but I am a little bit foreign to mathematics and could not implement that in PyMC myself.