gibbs_sampler: Gibbs two-step sampling procedure for parameter vector beta...

Description Usage Arguments Value Examples

View source: R/sampler.R

Description

Gibbs two-step sampling procedure for parameter vector beta and the latent Polya-Gamma variables

Usage

1
2
3
gibbs_sampler(y, X, lambda = 1e-04, b = rep(0, ncol(X)), B = lambda *
  diag(ncol(X)), n_iter_total = 200, burn_in = 100, naive = FALSE,
  naive_n_terms = 100, t = 0.64)

Arguments

y

binary vector of observations

X

design matrix of covariates

lambda

The diagonal element of the precision matrix of the prior distribution (see also parameter B)

b

The prior mean of the prior distribution. Defaults to a vector of zeros.

B

The prior precision of the prior distribution. Defaults to lambda * identity.

naive

Should the naive approximation be used to generate the Polya-Gamma distribution

naive_n_terms

If the naive approximation is used, then this specifies number of terms in the finite sum.

t

The parameter in the accept-reject algorithm for sampling from Polya-Gamma distribution (see paper for details).

n_iter

The total number of iterations in the MCMC chain

Value

list containing the MCMC samples from the posterior distribution of beta

Examples

1
2
3
data = generate_from_simple_logistic_model(n=100)
obj = gibbs_sampler(data$y, data$X, lambda=0.001, n_iter_total=100, burn_in=50)
plot(obj)

kasparmartens/PolyaGamma documentation built on May 20, 2019, 7:23 a.m.