ZIP: zero-inflated Poisson model

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/ZIP.R

Description

The function implements the MCMC algorithm with data augmentation to estimate the parameters in the zero-inflated Poisson model. The function returns the trace of the sampled parameters in each interaction. To obtain the summary estimation, use summary().

Usage

1
2
3
4
5
ZIP(Y, Covarmainphi, Covarmainmu, 
                         betaphi, betamu, 
                         priorgamma, 
                         propsigmaphi,  propsigmamu = propsigmaphi,
                         seed = 1, nmcmc = 500)

Arguments

Y

a count vector of length n specifying response in the zero-inflated Poisson model.

Covarmainphi

a n \times p_1 dimensional data.frame or matrix of data with respect to the probability component of the zero-inflated Poisson model.

Covarmainmu

a n \times p_2 dimensional data.frame or matrix of data with respect to the mean component of the zero-inflated Poisson model.

betaphi

a vector of length p_1 specifying the initial values of the parameters in the probability component of the zero-inflated Poisson model

betamu

a vector of length p_2 specifying the initial values of the parameters in the probability component of the zero-inflated Poisson model

priorgamma

a vector of length 2 specifying the two parameters of gamma prior

propsigmaphi

a vector of length p_1 specifying the standard error of the Gaussian proposal distribution for the parameters corresponds to the probability component.

propsigmamu

a vector of length p_2 specifying the standard error of the Gaussian proposal distribution for the parameters corresponds to the mean component.

seed

a numeric value specifying the seed for random generator

nmcmc

a integer specify the number of the generation of MCMC algorithm

Details

The zero-inflated Poisson model involves two components, the probability components and the mean compoenents (Zhang, 2020). Argument Covarmainphi, betaphi, propsigmaphi correspond to the probability compoenent; Covarmainmu, betamu, propsigmamu correspond to the mean compoenent.

Value

BayesResults

the list of trace of generated parameters for each component of the models. Data.frame "betaphi_trace" corresponds to the probability component of ZIP response model; "betamu_trace" refers to the mean component of the ZIP response model.

Author(s)

Qihuang Zhang and Grace Y. Yi

References

Zhang, Qihuang. "Inference Methods for Noisy Correlated Responses with Measurement Error." (2020).

See Also

glm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(datasim)
set.seed(0)
example_ZIP <- ZIP( Y = datasim$Ystar,
                         Covarmainphi = datasim[,c("intercept","X1")],
                         Covarmainmu = datasim[,c("intercept","X2")],
                         betaphi = c(-0.7,0.7), betamu = c(1,-0.5),
                         priorgamma = rep(1,1), propsigmaphi = c(0.05,0.05),
                         nmcmc = 100)

summary(example_ZIP)

ZIPBayes documentation built on Nov. 25, 2021, 9:06 a.m.