Package 'zic'

Title: Bayesian Inference for Zero-Inflated Count Models
Description: Provides MCMC algorithms for the analysis of zero-inflated count models. The case of stochastic search variable selection (SVS) is also considered. All MCMC samplers are coded in C++ for improved efficiency. A data set considering the demand for health care is provided.
Authors: Markus Jochmann <[email protected]>
Maintainer: Markus Jochmann <[email protected]>
License: GPL (>= 2)
Version: 0.9.1
Built: 2024-11-09 06:13:18 UTC
Source: CRAN

Help Index


Demand for Health Care Data

Description

This data set gives the number of doctor visits in the last three months for a sample of German male individuals in 1994. The data set is taken from Riphahn et al. (2003) and is a subsample of the German Socioeconomic Panel (SOEP). In contrast to Riphahn et al. (2003) only male individuals from the last wave are considered. See Jochmann (2013) for further details.

Usage

data(docvisits)

Format

This data frame contains 1812 observations on the following 22 variables:

docvisits

number of doctor visits in last 3 months

age

age

agesq

age squared / 1000

age30

1 if age >= 30

age35

1 if age >= 35

age40

1 if age >= 40

age45

1 if age >= 45

age50

1 if age >= 50

age55

1 if age >= 55

age60

1 if age >= 60

health

health satisfaction, 0 (low) - 10 (high)

handicap

1 if handicapped, 0 otherwise

hdegree

degree of handicap in percentage points

married

1 if married, 0 otherwise

schooling

years of schooling

hhincome

household monthly net income, in German marks / 1000

children

1 if children under 16 in the household, 0 otherwise

self

1 if self employed, 0 otherwise

civil

1 if civil servant, 0 otherwise

bluec

1 if blue collar employee, 0 otherwise

employed

1 if employed, 0 otherwise

public

1 if public health insurance, 0 otherwise

addon

1 if add-on insurance, 0 otherwise

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.

Riphahn, R. T., Wambach, A., Million, A. (2003). “Incentive Effects in the Demand for Health Care: A Bivariate Panel Count Data Estimation”, Journal of Applied Econometrics, 18, 387–405.

Wagner, G. G., Frick, J. R., Schupp, J. (2007). “The German Socio-Economic Panel Study (SOEP) – Scope, Evolution and Enhancements”, Schmollers Jahrbuch, 127, 139–169.


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 βj\beta_j.

c0

The prior variance of γ\gamma.

d0

The prior variance of δj\delta_j.

e0

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

f0

The inverse scale parameter the inverse gamma prior on σ2\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.

Details

The considered zero-inflated count model is given by

yiPoisson[exp(ηi)],y_i^* \sim \mathrm{Poisson}[\exp(\eta_i^*)],

ηi=α+xiβ+εi,  εiN(0,σ2),\eta^*_i = \alpha + x_i'\beta + \varepsilon_i,\; \varepsilon_i \sim \mathrm{N}(0,\sigma^2),

di=γ+xiδ+νi,  νiN(0,1),d_i^* = \gamma + x_i'\delta + \nu_i,\; \nu_i \sim \mathrm{N}(0,1),

yi=1(di>0)yi,y_i = 1(d_i^*>0)y_i^*,

where yiy_i and xix_i are observed. The assumed prior distributions are

αN(0,a0),\alpha \sim \mathrm{N}(0,a_0),

βkN(0,b0),k=1,,K,\beta_k \sim \mathrm{N}(0,b_0), \quad k=1,\ldots,K,

γN(0,c0),\gamma \sim \mathrm{N}(0,c_0),

δkN(0,d0),k=1,,K,\delta_k \sim \mathrm{N}(0,d_0), \quad k=1,\ldots,K,

σ2Inv-Gamma(e0,f0).\sigma^2 \sim \textrm{Inv-Gamma}\left(e_0,f_0\right).

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

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 σ2\sigma^2 (coda mcmc object).

acc

Acceptance rate of the Metropolis-Hastings step.

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

## 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 )
## End(Not run)

SVS for Zero-Inflated Count Models

Description

zic.svs applies SVS to zero-inflated count models

Usage

zic.svs(formula, data,
        a0, g0.beta, h0.beta, nu0.beta, r0.beta, s0.beta, e0, f0, 
        c0, g0.delta, h0.delta, nu0.delta, r0.delta, s0.delta, 
        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.

g0.beta

The shape parameter for the inverse gamma prior on κkβ\kappa_k^\beta.

h0.beta

The inverse scale parameter for the inverse gamma prior on κkβ\kappa_k^\beta.

nu0.beta

Prior parameter for the spike of the hypervariances for the βk\beta_k.

r0.beta

Prior parameter of ωβ\omega^\beta.

s0.beta

Prior parameter of ωβ\omega^\beta.

e0

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

f0

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

c0

The prior variance of γ\gamma.

g0.delta

The shape parameter for the inverse gamma prior on κkδ\kappa_k^\delta.

h0.delta

The inverse scale parameter for the inverse gamma prior on κkδ\kappa_k^\delta.

nu0.delta

Prior parameter for the spike of the hypervariances for the δk\delta_k.

r0.delta

Prior parameter of ωδ\omega^\delta.

s0.delta

Prior parameter of ωδ\omega^\delta.

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.

Details

The considered zero-inflated count model is given by

yiPoisson[exp(ηi)],y_i^* \sim \mathrm{Poisson}[\exp(\eta^*_i)],

ηi=α+xiβ+εi,  εiN(0,σ2),\eta^*_i = \alpha + x_i'\beta + \varepsilon_i,\; \varepsilon_i \sim \mathrm{N}(0,\sigma^2),

di=γ+xiδ+νi,  νiN(0,1),d_i^* = \gamma + x_i'\delta + \nu_i,\; \nu_i \sim \mathrm{N}(0,1),

yi=1(di>0)yi,y_i = 1(d_i^*>0)y_i^*,

where yiy_i and xix_i are observed. The assumed prior distributions are

αN(0,a0),\alpha \sim \mathrm{N}(0,a_0),

βkN(0,τkβκkβ),,k=1,,K,\beta_k\sim \mathrm{N}(0,\tau^\beta_k\kappa^\beta_k),, \quad k=1,\ldots,K,

κjβInv-Gamma(g0β,h0β),\kappa^\beta_j\sim\textrm{Inv-Gamma}(g_0^\beta,h_0^\beta),

τkβ(1ωβ)δν0β+ωβδ1,\tau_k^\beta \sim (1-\omega^\beta)\delta_{\nu^\beta_0}+\omega^\beta\delta_1,

ωβBeta(r0β,s0β),\omega^\beta\sim\mathrm{Beta}(r_0^\beta,s_0^\beta),

γN(0,c0),\gamma \sim \mathrm{N}(0,c_0),

δkN(0,τkδκkδ),k=1,,K,\delta_k\sim \mathrm{N}(0,\tau^\delta_k\kappa^\delta_k), \quad k=1,\ldots,K,

κkδInv-Gamma(g0δ,h0δ),\kappa^\delta_k\sim\textrm{Inv-Gamma}(g_0^\delta,h_0^\delta),

τkδ(1ωδ)δν0δ+ωδδ1,\tau_k^\delta \sim (1-\omega^\delta)\delta_{\nu^\delta_0}+\omega^\delta\delta_1,

ωδBeta(r0δ,s0δ),\omega^\delta\sim\mathrm{Beta}(r_0^\delta,s_0^\delta),

σ2Inv-Gamma(e0,f0).\sigma^2 \sim \textrm{Inv-Gamma}\left(e_0,f_0\right).

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

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 σ2\sigma^2 (coda mcmc object).

I.beta

Posterior draws of indicator whether τjβ\tau_j^\beta is one (coda mcmc object).

I.delta

Posterior draws of indicator whether τjδ\tau_j^\delta is one (coda mcmc object).

omega.beta

Posterior draws of ωβ\omega^\beta (coda mcmc object).

omega.delta

Posterior draws of ωδ\omega^\delta (coda mcmc object).

acc

Acceptance rate of the Metropolis-Hastings step.

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

## Not run: 
data( docvisits )
mdl <- docvisits ~ age + agesq + health + handicap + hdegree + married + schooling +
                    hhincome + children + self + civil + bluec + employed + public + addon
post <- zic.ssvs( mdl, docvisits,
                  10.0, 5.0, 5.0, 1.0e-04, 2.0, 2.0, 1.0, 1.0,
                  10.0, 5.0, 5.0, 1.0e-04, 2.0, 2.0,
                  1000, 10000, 10, 1.0, TRUE )
## End(Not run)