mcmc.norm.hier {asbio} | R Documentation |
These functions are designed for Gibbs sampling comparison of groups with normal hierarchical models (see Gelman 2003), and for providing appropriate summaries.
mcmc.norm.hier(data, length = 1000, n.chains = 5) norm.hier.summary(M, burn.in = 0.5, cred = 0.95, conv.log = TRUE)
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 σ and τ should be considered on a log scale. |
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
θ[j], j = (1,...,J), and a common variance, σ^2. We also assume that group means,
are normally distributed with an unknown mean, μ, and an unknown variance , τ^2.
A uniform prior distribution is assumed for μ, logσ and τ; σ is
logged to facilitate conjugacy. The function mcmc.norm.hier
provides posterior distributions
of θ[j]'s, μ, σ and τ. 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}.
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}.
Ken Aho
Gelman, A., Carlin, J. B., Stern, H. S., and D. B. Rubin (2003) Bayesian Data Analysis, 2nd edition. Chapman and Hall/CRC.
## Not run: data(cuckoo) mcmc.norm.hier(cuckoo,10,2) ## End(Not run)