Crate polya_gamma

Source
Expand description

§Polya-Gamma Sampler and Bayesian Logistic Regression

This crate provides an efficient sampler for Polya-Gamma (PG) random variates, along with a Gibbs sampler for Bayesian logistic regression using PG data augmentation.

§Features

  • Polya-Gamma Sampler:

    • Draws samples from the PG(b, c) distribution using different strategies depending on the value of b.
    • High-performance, high-accuracy sampling.
  • Bayesian Logistic Regression:

    • Implements a Gibbs sampler using PG augmentation for fully-conjugate updates of regression coefficients.
    • See [logistic::GibbsLogReg] for details.

§Mathematical Background

The Polya-Gamma distribution PG(b, c) is used for data augmentation in models with logistic link functions, enabling efficient Bayesian inference. See:

  • Polson, N.G., Scott, J.G., & Windle, J. (2013). Bayesian Inference for Logistic Models Using Polya-Gamma Latent Variables. JASA, 108(504): 1339–1349.
  • Windle, J., Polson, N.G., & Scott, J.G. (2014). Sampling Pólya-Gamma random variates: alternate and approximate techniques. arXiv:1405.0506.

§Usage Example

use polya_gamma::PolyaGamma;
let pg = PolyaGamma::new(1.0);
let sample = pg.draw(&mut StdRng::seed_from_u64(0), 1.0);

For Bayesian logistic regression, see [logistic::GibbsLogReg] and the examples folder.

§License

See LICENSE for details.

Structs§

PolyaGamma
Polya-Gamma sampler.