| Type: | Package | 
| Title: | Bayesian Zero-Inflated Bernoulli Regression Model | 
| Version: | 0.0.5 | 
| Date: | 2023-09-09 | 
| Encoding: | UTF-8 | 
| Maintainer: | David Moriña Soler <dmorina@ub.edu> | 
| Description: | Fits a Bayesian zero-inflated Bernoulli regression model handling (potentially) different covariates for the zero-inflated and non zero-inflated parts. See Moriña D, Puig P, Navarro A. (2021) <doi:10.1186/s12874-021-01427-2>. | 
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] | 
| Biarch: | true | 
| Depends: | R (≥ 3.4.0) | 
| Imports: | methods, Rcpp (≥ 0.12.0), rstan (≥ 2.26.0), ggplot2, rstantools | 
| LinkingTo: | BH (≥ 1.66.0), Rcpp (≥ 0.12.0), RcppEigen (≥ 0.3.3.3.0), rstan (≥ 2.26.0), StanHeaders (≥ 2.26.0) | 
| RoxygenNote: | 7.0.2 | 
| NeedsCompilation: | yes | 
| SystemRequirements: | GNU make | 
| Packaged: | 2023-09-09 06:14:44 UTC; dmorina | 
| Author: | David Moriña Soler | 
| Repository: | CRAN | 
| Date/Publication: | 2023-09-12 09:00:02 UTC | 
Bayesian zero-inflated Bernoulli regression model
Description
This package fits a Bayesian Bernoulli zero-inflated regression model handling different covariates for the zero-inflated and non zero-inflated parts.
Details
| Package: | bayesZIB | 
| Type: | Package | 
| Version: | 0.0.5 | 
| Date: | 2023-09-09 | 
| License: | GPL version 2 or newer | 
| LazyLoad: | yes | 
The package implements a new Bayesian Bernoulli zero-inflated. This model is able to distinguish between two sources of zeroes (structural and non-structural) on the basis of a Bayesian framework, using rstan. All the convergence and goodness-of-fit tests from rstan are available.
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
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"))
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  | 
| priors | 
 | 
| 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  | 
| 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 | 
 | 
| 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  | 
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  | 
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
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"))
Internal bayesZIB functions and classes
Description
Internal bayesZIB functions and classes
Usage
rstantools_model_model()
stanmodels()
Details
These functions are not to be called by the user