zic {zic} | R Documentation |
zic
fits zero-inflated count models via Markov chain Monte Carlo methods.
zic(formula, data, bbar, dbar, ebar, fbar, n.burnin, n.mcmc, n.thin)
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 . |
bbar |
The diagonal elements of the prior variance matrix of beta, a vector of length equal to the number of covariates. |
dbar |
The diagonal elements of the prior variance matrix of delta, a vector of length equal to the number of covariates. |
ebar |
The shape parameter for the inverse gamma prior on sigma^2. |
fbar |
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. |
The considered zero-inflated count model is given by
y*_i ~ Poisson[exp(eta*_i)],
eta*_i = x_i' * beta + epsilon_i, epsilon_i ~ N( 0, sigma^2 ),
d*_i = x_i' * delta + nu_i, nu_i ~ N( 0, 1 ),
y_i = 1(d*_i>0) y*_i,
where y_i and x_i are observed. The assumed prior distributions are
beta ~ N(0,Bbar) with Bbar = diag(bbar1,...,bbark),
delta ~ N(0,Dbar) with Dbar = diag(dbar1,...,dbark),
sigma^2 ~ Inv-Gamma(ebar,fbar).
The sampling algorithm developed by Jochmann (2009) is used.
A list containing the following elements:
beta |
The posterior draws for beta. |
delta |
The posterior draws for delta. |
sigma2 |
The posterior draws for sigma^2. |
Jochmann, M. (2009). ``What Belongs Where? Variable Selection for Zero-Inflated Count Models with an Application to the Demand for Health Care''. Available at: http://personal.strath.ac.uk/markus.jochmann.
# library( zic ) # data( docvisits ) # prior parameters and formula # bbar <- rep( 10.0, 16 ) # dbar <- rep( 10.0, 16 ) # ebar <- 3.0 # fbar <- 2.0 # formula <- docvisits ~ age + agesq + health + handicap + hdegree + # married + schooling + hhincome + children + self + # civil + bluec + employed + public + addon # set seed and run MCMC sampler # set.seed(1) # results <- zic( formula, docvisits, bbar, dbar, ebar, fbar, 10000, 100000, 10 ) # print posterior means for beta # apply( results$beta, 2, mean )