MCMChierEI {MCMCpack}R Documentation

Markov chain Monte Carlo for Wakefield's Hierarchial Ecological Inference Model

Description

`MCMChierEI' is used to fit Wakefield's hierarchical ecological inference model for partially observed 2 x 2 contingency tables.

Usage

MCMChierEI(r0, r1, c0, c1, burnin=1000, mcmc=50000, thin=1,
           m0=0, M0=10, m1=0, M1=10, nu0=1, delta0=0.5, nu1=1,
           delta1=0.5, verbose=FALSE, tune=2.65316, seed=0, ...)
   

Arguments

r0 (ntables * 1) vector of row sums from row 0.
r1 (ntables * 1) vector of row sums from row 1.
c0 (ntables * 1) vector of column sums from column 0.
c1 (ntables * 1) vector of column sums from column 1.
burnin The number of burn-in scans for the sampler.
mcmc The number of mcmc scans to be saved.
thin The thinning interval used in the simulation. The number of mcmc iterations must be divisible by this value.
tune Tuning parameter for the Metropolis-Hasting sampling.
verbose A switch which determines whether or not the progress of the sampler is printed to the screen. Information is printed if TRUE.
seed The seed for the random number generator. The code uses the Mersenne Twister, which requires an integer as an input. If nothing is provided, the Scythe default seed is used.
m0 Prior mean of the mu0 parameter.
M0 Prior variance of the mu0 parameter.
m1 Prior mean of the mu1 parameter.
M1 Prior variance of the mu1 parameter.
nu0 Shape parameter for the inverse-gamma prior on the sigma^2_0 parameter.
delta0 Scale parameter for the inverse-gamma prior on the sigma^2_0 parameter.
nu1 Shape parameter for the inverse-gamma prior on the sigma^2_1 parameter.
delta1 Scale parameter for the inverse-gamma prior on the sigma^2_1 parameter.
... further arguments to be passed

Details

Consider the following partially observed 2 by 2 contingency table for unit t where t=1,...,ntables:

| Y=0 | Y=1 |
- - - - - - - - - - - - - - - - - - - -
X=0 | Y0[t] | |r0[t]
- - - - - - - - - - - - - - - - - - - -
X=1 | Y1[t] | | r1[t]
- - - - - - - - - - - - - - - - - - - -
| c0[t] | c1[t] | N[t]

Where r0[t], r1[t], c0[t], c1[t], and N[t] are non-negative integers that are observed. The interior cell entries are not observed. It is assumed that Y0[t]|r0[t] ~ Binomial(r0[t], p0[t]) and Y1[t]|r1[t] ~ Binomial(r1[t],p1[t]). Let theta0[t] = log(p0[t]/(1-p0[t])), and theta1[t] = log(p1[t]/(1-p1[t])).

The following prior distributions are assumed: theta0[t] ~ Normal(mu0, sigma^2_0), theta1[t] ~ Normal(mu1, sigma^2_1). theta0[t] is assumed to be a priori independent of theta1[t] for all t. In addition, we assume the following hyperpriors: mu0 ~ Normal(m0, M0), mu1 ~ Normal(m1, M1), σ^2_0 ~ InvGamma(nu0/2, delta0/2), and σ^2_1 ~ InvGamma(nu1/2, delta1/2).

Inference centers on p0, p1, mu0, mu1, sigma^2_0, and sigma^2_1. The Metropolis-Hastings algorithm is used to sample from the posterior density.

Value

An mcmc object that contains the posterior density sample. This object can be summarized by functions provided by the coda package.

References

Jonathan Wakefield. 2001. ``Ecological Inference for 2 x 2 Tables." Center for Statistics and the Social Sciences Working Paper no. 12. University of Washington.

Andrew D. Martin, Kevin M. Quinn, and Daniel Pemstein. 2003. Scythe Statistical Library 0.4. http://scythe.wustl.edu.

Martyn Plummer, Nicky Best, Kate Cowles, and Karen Vines. 2002. Output Analysis and Diagnostics for MCMC (CODA). http://www-fis.iarc.fr/coda/.

See Also

MCMCbaselineEI, MCMCdynamicEI, plot.mcmc,summary.mcmc

Examples

   ## Not run: 
   c0 <- rpois(5, 500)
   c1 <- c(200, 140, 250, 190, 75)
   r0 <- rpois(5, 400)
   r1 <- (c0 + c1) - r0
   posterior <- MCMChierEI(r0,r1,c0,c1, mcmc=200000, thin=50)
   plot(posterior)
   summary(posterior) 
   
## End(Not run)

[Package Contents]