| mcmc.norm.hier {asbio} | R Documentation |
Gibbs sampling of normal hierarchical models
Description
These functions are designed for Gibbs sampling comparison of groups with normal hierarchical models (see Gelman 2003), and for providing appropriate summaries.
Usage
mcmc.norm.hier(data, length = 1000, n.chains = 5)
norm.hier.summary(M, burn.in = 0.5, cred = 0.95, conv.log = TRUE)
Arguments
data |
A numerical matrix with groups in columns and observations in rows. |
length |
An integer specifying the length of MCMC chains. |
n.chains |
The number of chains to be computed for each parameter |
M |
An output array from |
burn.in |
The burn in period for the chains. The default value, 0.5, indicates that only the latter half of chains should be used for calculating summaries. |
cred |
Credibility interval width. |
conv.log |
A logical argument indicating whether convergence for |
Details
An important Bayesian application is the comparison of groups within a normal hierarchical model.
We assume that the data from each group are independent and from normal populations with means
\theta[j], j = (1,...,J), and a common variance, \sigma^2. We also assume that group means,
are normally distributed with an unknown mean, \mu, and an unknown variance , \tau^2.
A uniform prior distribution is assumed for \mu, log\sigma and \tau; \sigma is
logged to facilitate conjugacy. The function mcmc.norm.hier provides posterior distributions
of \theta[j]'s, \mu, \sigma and \tau. The distributions are derived from univariate
conditional distributions from the multivariate likelihood function. These conditional distributions
provide a situation conducive to MCMC Gibbs sampling. Gelman et al. (2003) provide excellent summaries of these sorts of models.
The function mcmc.summary provides statistical summaries for the output array from mcmc.norm.hier including credible intervals (empirically derived directly from chains) and the Gelman/Rubin convergence criterion, \hat{R}.
Value
The function mcmc.norm.hier returns a three dimensional (step x variable x chain) array. The function mcmc.summary returns a summary table containing credible intervals and the Gelman/Rubin convergence criterion, \hat{R}.
Author(s)
Ken Aho
References
Gelman, A., Carlin, J. B., Stern, H. S., and D. B. Rubin (2003) Bayesian Data Analysis, 2nd edition. Chapman and Hall/CRC.
See Also
Examples
## Not run:
data(cuckoo)
mcmc.norm.hier(cuckoo,10,2)
## End(Not run)