Learn R Programming

zic (version 0.9)

zic: Bayesian Inference for Zero-Inflated Count Models

Description

zic fits zero-inflated count models via Markov chain Monte Carlo methods.

Usage

zic(formula, data, a0, b0, c0, d0, e0, f0, 
    n.burnin, n.mcmc, n.thin, tune = 1.0, scale = TRUE)

Arguments

formula

A symbolic description of the model to be fit specifying the response variable and covariates.

data

A data frame in which to interpret the variables in formula.

a0

The prior variance of \(\alpha\).

b0

The prior variance of \(\beta_j\).

c0

The prior variance of \(\gamma\).

d0

The prior variance of \(\delta_j\).

e0

The shape parameter for the inverse gamma prior on \(\sigma^2\).

f0

The inverse scale parameter the inverse gamma prior on \(\sigma^2\).

n.burnin

Number of burn-in iterations of the sampler.

n.mcmc

Number of iterations of the sampler.

n.thin

Thinning interval.

tune

Tuning parameter of Metropolis-Hastings step.

scale

If true, all covariates (except binary variables) are rescaled by dividing by their respective standard errors.

Value

A list containing the following elements:

alpha

Posterior draws of \(\alpha\) (coda mcmc object).

beta

Posterior draws of \(\beta\) (coda mcmc object) .

gamma

Posterior draws of \(\gamma\) (coda mcmc object).

delta

Posterior draws of \(\delta\) (coda mcmc object).

sigma2

Posterior draws of \(\sigma^2\) (coda mcmc object).

acc

Acceptance rate of the Metropolis-Hastings step.

Details

The considered zero-inflated count model is given by $$y_i^* \sim \mathrm{Poisson}[\exp(\eta_i^*)],$$ $$\eta^*_i = \alpha + x_i'\beta + \varepsilon_i,\; \varepsilon_i \sim \mathrm{N}(0,\sigma^2),$$ $$d_i^* = \gamma + x_i'\delta + \nu_i,\; \nu_i \sim \mathrm{N}(0,1),$$ $$y_i = 1(d_i^*>0)y_i^*,$$ where \(y_i\) and \(x_i\) are observed. The assumed prior distributions are $$\alpha \sim \mathrm{N}(0,a_0),$$ $$\beta_k \sim \mathrm{N}(0,b_0), \quad k=1,\ldots,K,$$ $$\gamma \sim \mathrm{N}(0,c_0),$$ $$\delta_k \sim \mathrm{N}(0,d_0), \quad k=1,\ldots,K,$$ $$\sigma^2 \sim \textrm{Inv-Gamma}\left(e_0,f_0\right).$$

The sampling algorithm described in Jochmann (2013) is used.

References

Jochmann, M. (2013). ``What Belongs Where? Variable Selection for Zero-Inflated Count Models with an Application to the Demand for Health Care'', Computational Statistics, 28, 1947--1964.

Examples

Run this code
# NOT RUN {
data( docvisits )
mdl <- docvisits ~ age + agesq + health + handicap + hdegree + married + schooling +
                    hhincome + children + self + civil + bluec + employed + public + addon
post <- zic( f, docvisits, 10.0, 10.0, 10.0, 10.0, 1.0, 1.0, 1000, 10000, 10, 1.0, TRUE )
# }

Run the code above in your browser using DataLab