bayesZIB {bayesZIB}R Documentation

Bayesian Bernoulli zero-inflated regression model.

Description

Fit Bernoulli zero-inflated regression models in a Bayesian framework.

Usage

bayesZIB(formula, data, priors=NULL, chains=3, iter=2000, 
         adapt_delta=0.8, max_treedepth=10, verbose=FALSE, 
         cores=getOption("mc.cores", 1L))

Arguments

formula

symbolic description of the model, see details.

data

arguments controlling formula processing via model.frame.

priors

list with two elements specifying the limits of the uniform priors for w and p respectively. It is NULL by default but should be defined if there are no covariates.

chains

a positive integer specifying the number of Markov chains. The default is 3.

iter

a positive integer specifying the number of iterations for each chain (including warmup). The default is 2000.

adapt_delta

for the No-U-Turn Sampler (NUTS), the variant of Hamiltonian Monte Carlo used used by rstan, adapt_delta is the target average proposal acceptance probability for adaptation. double, between 0 and 1, defaults to 0.8.

max_treedepth

maximum depth parameter. Positive integer, defaults to 10. When the maximum allowed tree depth is reached it indicates that NUTS is terminating prematurely to avoid excessively long execution time.

verbose

TRUE or FALSE: flag indicating whether to print intermediate output from Stan on the console, which might be helpful for model debugging.

cores

number of cores to use when executing the chains in parallel, which defaults to 1 but according to the Stan documentation it is recommended to set the mc.cores option to be as many processors as the hardware and RAM allow (up to the number of chains).

Details

Zero-inflated models are two-component mixture models combining a point mass at zero with a proper count distribution. Thus, there are two sources of zeros: zeros may come from both the point mass and from the Bernoulli component. For modeling the unobserved state (zero vs. Bernoulli), a binary model is used that captures the probability of zero inflation. in the simplest case only with an intercept but potentially containing regressors. For this zero-inflation model, a binomial model with an appropriate link function is used.

The formula can be used to specify both components of the model: If a formula of type y ~ x1 + x2 is supplied, then the same regressors are employed in both components. This is equivalent to y ~ x1 + x2 | x1 + x2. Of course, a different set of regressors could be specified for the Bernoulli and zero-inflation component, e.g., y ~ x1 + x2 | z1 + z2 + z3 giving the logistic regression model y ~ x1 + x2 conditional on (|) the zero-inflation model y ~ z1 + z2 + z3. A simple inflation model where all zero counts have the same probability of belonging to the zero component can by specified by the formula y ~ x1 + x2 | 1.

Value

An object of class "bayesZIB", i.e., a list with components including

Call

text string with the original call to the function

x

design matrix for the zero-inflated part

z

design matrix for the non zero-inflated part

fit

an object of S4 class stanfit if there are covariates or a named list with iter draws from the posterior distribution of w and p.

Author(s)

David Moriña (Universitat de Barcelona), Pedro Puig (Universitat Autònoma de Barcelona) and Albert Navarro (Universitat Autònoma de Barcelona)

Mantainer: David Moriña Soler <dmorina@ub.edu>

See Also

bayesZIB-package

Examples

set.seed(1234)
x <- rbinom(20, 1, 0.4)   # Structural zeroes 
y <- rbinom(20, 1, 0.7*x) # Non-structural zeroes
fit <- bayesZIB(y~1|1, priors=list(c(0, 0.5), c(0.5, 1)))
print(fit$fit, pars=c("theta", "beta"))

[Package bayesZIB version 0.0.5 Index]