OxWaSP module 1 project
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
inst/doc
man
vignettes
.Rbuildignore
.gitignore
DESCRIPTION
NAMESPACE
PolyaGamma.Rproj
README.md
SAheart.data
prior_and_posterior.pdf
spambase.data
transfusion.data

README.md

PolyaGamma

An R package for Bayesian logistic regression. The posterior distribution of the parameters is obtained via Gibbs sampling using Polya-Gamma latent variables (see paper "Bayesian Inference for Logistic Models Using Pólya–Gamma Latent Variables" for details).

This package can be installed as follows:

devtools::install_github("kasparmartens/PolyaGamma")

A small example, how to use the main function gibbs_sampler

# load library
library(PolyaGamma)
# generate data from the logistic model 1 / (1 + exp(-(1 + x)))
data = generate_from_simple_logistic_model(n=100)
# obtain a sample from the posterior distribution of beta
obj = gibbs_sampler(data$y, data$X, lambda=0.001, n_iter_total=200, burn_in=50)
obj
plot(obj)