Ecological Archives E084-031-A1

James S. Clark. 2003. Uncertainty and variability in demography and population growth: a hierarchical approach. Ecology 84:1370–1381.

Appendix. A Gibbs sampler for the hierarchical model. This appendix is also available as a pdf file.

A full description of Bayesian computation is beyond the scope of this paper, but is the subject of several recent overviews (Gelman et al. 1995, Carlin and Louis 2000).  Markov chain Monte Carlo (MCMC) methods simulate a posterior distribution by executing a random walk (Markov process) having a stationary density that is equivalent to the target (joint posterior) distribution.  For example, the joint posterior for fecundity parameters is

.
A.1

This joint posterior contains parameters bi, i= 1, …, n, ab, and b and is determined by the likelihood f( ), parameter density ( ), and priors u( ) and v( ). 

The Gibbs sampler (Gelfand and Smith 1990) is a MCMC algorithm that makes use of the fact that a joint distribution of Q random variables is uniquely determined by the Q conditional distributions.  The algorithm proceeds by alternately sampling from each of the full conditional distributions.  One iteration of the algorithm consists of sequential sampling from each conditional posterior, updating each parameter value before proceeding to the next. The Gibbs sampler is described here. 

Fecundity

The three levels for the fecundity model in Eq. A.1 include the Poisson likelihood, , a gamma distribution ("prior") for the Poisson parameters , and hyperpriors  and .  From Eq. A.1 we have the joint posterior

For the parameters bj  j = 1, 2, …, n, ab, and b,  the ith step of the algorithm is as follows:

1.    The Gibbs step begins with draws from the conditional posteriors for fecundity parameters

.

 

2.    The gamma hyperprior on b allows for direct sampling from the conjugate conditional posterior .

 
3.    A Metropolis-Hastings step was used for ab in a manner similar to that described for survival (see below).  A Gamma proposal distribution was used to generate candidate values a* with acceptance probabilities determined from the conditional posterior .

Prior parameter estimates used in figures were taken to be noninformative (Table 3).

Survival

Assuming a binomial likelihood with beta distributed probability s and gamma distributed priors we have three stages:

(likelihood)
   
(prior)
   
and
(hyperpriors)

For individual variation, we have  and indicator variable y, assuming values of zero or 1.  From Eq. A.1, the joint posterior is .

1.    The si are each drawn from the conditional beta posteriors .

2.     The hyperparameters are not conjugate.  I used a Metropolis-Hastings step.  Sampling was accomplished in the same way for both survival parameters.  The conditional posterior for as is .

A Gamma proposal distribution with a shape parameter of 5 and mean equal to the current parameter value aj was used to draw candidate values .  The importance ratio

determines acceptance of the candidate value with probability min(r,1). The Gibbs sampler was run for 5000 iterations.  The first 1000 iterations were discarded.  Posterior quantiles and kernel estimates were determined on the remainder.

Literature cited

Carlin, B. P., and T. A. Louis. 2000. Bayes and empirical Bayes methods for data analysis. Chapman and Hall, Boca Raton, Florida, USA.

Gelfand, A. E., and A. F. M. Smith. 1990. Sampling-based approaches to calculating marginal densities. Journal of the American Statistical Association 85:398–409.

Gelman, A., J. B. Carlin, H. S. Stern, and D. B. Rubin. 1995. Bayesian data analysis. Chapman Hall, London, UK.


[Back to E084-031]