Sampling from a Polya Gamma distribution?



Hello everyone.
Anybody tried to implement the Polya-Gamma distribution?
Or is there any plan for supporting the Polya-Gamma distribution?

This paper claims that sampling from PG distribution is beneficial for logistic models.
Wonder if anybody tried this on Stan.


This is quite useful for using a Gibbs sampler to estimate the coefficients of logit models using data augmentation, and in fact, it can be proven that this particular Gibbs sampler is uniformally ergodic, which is rare. But the approach isn’t that useful for Stan, which uses No U-turn Sampling and joint proposals rather than full-conditional proposals and usually samples from the posterior distribution of the coefficients of a logit model (without data augmentation) quite efficiently as well.

The Polya Gamma distribution might be useful for other purposes, although I haven’t seen any and I don’t know of anyone who has tried to implement it in Stan in part because that infinite sum with alternating signs would be challenging to do in a numerically stable way.


Thanks for the answer. I was trying to implement [1, 2] which they used PG for modeling the likelihood of stick-breaking processes. Maybe it’s not beneficial in this case too?

[1] Poddar, Lahari, Wynne Hsu, and Mong Li Lee. “Quantifying aspect bias in ordinal ratings using a bayesian approach.” arXiv preprint arXiv:1705.05098 (2017).

[2] Chen, Jianfei, et al. “Scalable inference for logistic-normal topic models.” Advances in Neural Information Processing Systems . 2013.