ei.MD.bayes(formula, covariate = NULL, total = NULL, data,
lambda1 = 4, lambda2 = 2, covariate.prior.list = NULL,
tune.list = NULL, start.list = NULL, sample = 1000, thin = 1,
burnin = 1000, verbose = 0, ret.beta = 'r',
ret.mcmc = TRUE, usrfun = NULL)cbind(col1, col2, ...) ~
cbind(row1, row2, ...). Column and row marginals must have the
same totals.~ covariate. The
default is covariate = NULL, which fits the model without a covariate.total identifies the name of the variable in data containing the
total number of individuals in each unitformula and totaltuneMD. The
default is NULLstart.list = NULL, which generates appropriate random starting values.sample*thin + burnin.verbose is greater than 0, the
iteration number is printed to the screen every verboseth
iteration.r'eturn as an R object, `s'ave as .txt.gz
files, `d'iscard (defaults to r).TRUE (default), samples are returned as
coda mcmc objects. If FALSE, samples are returned as arrays.NULL).Drret.mcmc = TRUE, Dr is an mcmc object.}
Betaret.beta = TRUE. If ret.mcmc =
TRUE, a (R * C * units) $\times$ sample matrix saved as an mcmc
object. Otherwise, a R $\times$ C $\times$ units
$\times$ sample array}
Gammaret.mcmc =
TRUE, a (R * (C - 1)) $\times$ sample matrix saved as an mcmc
object. Otherwise, a R $\times$ (C - 1) $\times$ sample array}
Deltaret.mcmc =
TRUE, a (R * (C - 1)) $\times$ sample matrix saved as an mcmc
object. Otherwise, a R $\times$(C - 1) $\times$ sample array}
Cell.countret.mcmc =
TRUE, a (R * C) $\times$ sample matrix saved as an mcmc object.
Otherwise, a R $\times$ C $\times$ sample array}Alpharet.mcmc =
TRUE, a (R * C) $\times$ sample matrix saved as an mcmc object.
Otherwise, a R $\times$ C $\times$ sample array}Betaret.mcmc =
TRUE, a (R * C * units) $\times$ sample matrix saved as
an mcmc object.
Otherwise, a R $\times$ C $\times$ units
$\times$ sample arrayCell.countret.mcmc =
TRUE, a (R * C) $\times$ sample matrix saved as anmcmc object.
Otherwise, a R $\times$ C $\times$ sample arraybeta.accgamma.accbeta.accstart.betasstart.gammastart.deltastart.betastune.betatune.gammatune.deltatune.betatune.alphaei.MD.bayesei.MD.bayes implements a version of the hierarchical
Multinomial-Dirichlet model for ecological inference in $R
\times C$ tables suggested by Rosen et al. (2001).Let $r = 1, \ldots, R$ index rows, $C = 1, \ldots, C$ index columns, and $i = 1, \ldots, n$ index units. Let $N_{\cdot ci}$ be the marginal count for column $c$ in unit $i$ and $X_{ri}$ be the marginal proportion for row $r$ in unit $i$. Finally, let $\beta_{rci}$ be the proportion of row $r$ in column $c$ for unit $i$.
The first stage of the model assumes that the vector of column marginal counts in unit $i$ follows a Multinomial distribution of the form:
$$(N_{\cdot 1i}, \ldots, N_{\cdot Ci}) {\sim} {\rm Multinomial}(N_i,\sum_{r=1}^R \beta_{r1i}X_{ri}, \dots, \sum_{r=1}^R \beta_{rCi}X_{ri})$$
The second stage of the model assumes that the vector of $\beta$ for row $r$ in unit $i$ follows a Dirichlet distribution with $C$ parameters. The model may be fit with or without a covariate.
If the model is fit without a covariate, the distribution of the vector $\beta_{ri}$ is : $$(\beta_{r1i}, \dots, \beta_{rCi}) {\sim} {\rm Dirichlet}(\alpha_{r1}, \dots, \alpha_{rC})$$
In this case, the prior on each $\alpha_{rc}$ is assumed to be:
$$\alpha_{rc} \sim {\rm Gamma}(\lambda_1, \lambda_2)$$
If the model is fit with a covariate, the distribution of the vector $\beta_{ri}$ is : $$(\beta_{r1i}, \dots, \beta_{rCi}) {\sim} {\rm Dirichlet}(d_r\exp(\gamma_{r1} + \delta_{r1}Z_i), d_r\exp(\gamma_{r(C-1)} + \delta_{r(C-1)}Z_i), d_r)$$
The parameters $\gamma_{rC}$ and $\delta_{rC}$ are constrained to be zero for identification. (In this function, the last column entered in the formula is so constrained.)
Finally, the prior for $d_r$ is:
$$d_r \sim {\rm Gamma}(\lambda_1, \lambda_2)$$
while $\gamma_{rC}$ and $\delta_{rC}$ are
given improper uniform priors if covariate.prior.list = NULL or
have independent normal priors of the form:
$$\delta_{rC} \sim {\rm N}(\mu_{\delta_{rC}}, \sigma_{\delta_{rC}}^2)$$
$$\gamma_{rC} \sim {\rm N}(\mu_{\gamma_{rC}}, \sigma_{\gamma_{rC}}^2)$$
If the user wishes to estimate the model with proper normal priors on
$\gamma_{rC}$ and $\delta_{rC}$, a list
with four elements must be provided for covariate.prior.list:
mu.deltasigma.deltamu.gammasigma.gammaOri Rosen, Wenxin Jiang, Gary King, and Martin A. Tanner. 2001. ``Bayesian and Frequentist Inference for Ecological Inference: The $R \times (C-1)$ Case.'' Statistica Neerlandica 55: 134-156.
lambda.MD, cover.plot,
density.plot, tuneMD,
mergeMD