Description Usage Arguments Details Value Note References Examples
Zero-inflated Poisson data are count data with an excess number
of zeros. The ZIP model involves the Poisson parameter lambda and the
prevalence parameter pi.
1 2 3 4 |
data |
Matrix, data frame or data set with positive integers, including zeros and of the minimal length 10. |
prior.lambda |
Numeric vector containing minimum and maximum of a uniform
distribution used as prior for the Poisson parameter |
prior.pi |
Numeric vector containing parameters of a beta distribution
describing prior knowledge about prevalence (proportion of contaminated
samples), e.g., |
simulation |
Not used any longer. |
chains |
Positive single numeric value, number of independent MCMC chains (default 3). |
burn |
Positive single numeric value, length of the burn-in period (default 4000). |
thin |
Positive single numeric value (default 1). The samples from every
k-th iteration will be used for inference, where k is the value of thin.
Setting |
update |
Positive single numeric value, length of update iterations for estimation (default 5000). |
max.time |
Maximum time for which the function is allowed to extend the chains. Acceptable units include 'seconds', 'minutes', 'hours', 'days', 'weeks' (default "15minutes") (see autorun.jags). |
plots |
Logical, if |
The ZIP model applies to count data and can be interpreted as a mixture
distribution with one component comprising the 'true' zeros and another component
of Poisson distributed values with density parameter lambda. The prevalence
parameter pi refers to the proportion of the second, true non-zero
component.
The Bayesian model for estimation prevalence and lambda parameter has
in rjags/JAGS (originally BRugs/Winbugs) syntax following form
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
The function rrisk.BayesZIP returns an instance of the
bayesmodelClass
class containing following information:
|
Logical, whether the model has converged (assessed by the user). |
|
Data frame containing statitsics of the posterior distribution. |
|
Data frame giving the joint posterior probability distribution. |
|
Names of the parameters jointly estimated by the Bayes model. |
|
Model in rjags/JAGS syntax as a character string. |
|
Number of independent MCMC chains. |
|
Length of burn-in period. |
|
Length of update iterations for estimation. |
The convergence of the model should be checked using the diagnostic plots.
Bohning, D., Dietz, E., Schlattman, P., Mendonca, L. and Kirchner, U. (1999). The zero-inflated Poisson model and the decayed, missing and filled teeth index in dental epidemiology. Journal of the Royal Statistical Society, Series A 162:195-209.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #------------------------------------------
# Example of ZIP model
#------------------------------------------
# generate ZIP data
pi <- 0.01
n <- 200
lambda <- 3.5
zip.data <- rep(0,n)
zip.data[sample(1:n,n*pi,replace=FALSE)]<-rpois(n*pi,lambda=lambda)
# estimate using Bayes model for zero inflated data
resZIP <- rrisk.BayesZIP(data = zip.data,
prior.lambda = c(0,100),
prior.pi = c(1,1),
burn = 4000,
max.time = '40seconds',
update = 4000)
resZIP
# compare with naive results ignoring ZIP model
pi.crude <- sum(zip.data>0)/n
lambda.crude <- mean(zip.data)
print(pi.crude)
print(lambda.crude)
resZIP@results
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.