Bayesian Models in Ecology
Material de Apoio
CENTRO DE MÉTODOS QUANTITATIVOS - CMQ
CENTRO DE MÉTODOS QUANTITATIVOS - CMQ
Models, data, and uncertainty Morning:
We will introduce basic concepts of ecological modelling, focusing on how models are used to learn from data. The concept of stochasticity will be introduced.
We will introduce basic concepts of ecological modelling, focusing on how models are used to learn from data. Participants will identify simple deterministic models in their individual fields to illustrate that there is a compact set of mathematical relationships that are widely used by ecologists to portray relationships among variables and the operation of processes in ecology (e.g., simple linear relationships, asymptotic functions, models of competing controls, polynomials, change-points, simple dynamic models).
Participants will learn basic theory of statistical distributions, beginning with a review of general concepts of probability density functions, and discrete density functions, cumulative distribution functions, and quantile functions. Moment matching.
Specific distributions for discrete and continuous data will be taught using a series of problems based on ecological data where participants compute probabilities and probability densities using functions in R. Problems will challenge participants to understand the relationships between shape parameters and moments of distributions and how to calculate one from another. This understanding will also be useful for our later discussions of choosing priors.
Likelihood and Bayes intro
The concepts of likelihood functions and maximum likelihood estimation will be introduced, anticipating the role of likelihood in Bayes theorem.
Participants will plot probability distributions and likelihood profiles for diverse ecological datasets to understand the difference between the probability of data (holding parameters constant) and the likelihood of the parameters (holding data constant). They will work through a spreadsheet example to clearly reveal how parameters are estimated in the likelihood framework using optimization methods.
1:30-2:30 PM Derive Bayes Theorem Bayes theorem will be derived graphically and algebraically. We will teach the component distributions of Bayes theorem applied to models and data: the posterior, the likelihood, the prior, and the marginal distribution of the data.
Simple examples will be offered to assure that participants thoroughly understand each component of Bayesian analysis applied to models and data. Anticipating work on Markov Chain Monte Carlo later in the course, we will particularly stress the role of the marginal distribution of the data as a normalizing constant for the posterior. Sensitivity to prior and data (likelihood).
Priors and MCMC intro
As background for Gibbs sampling, we will introduce conjugate prior-likelihood relationships.
Using data from one or two examples, participants will choose an appropriate likelihood function and prior will calculate a posterior distribution of parameters using conjugacy. They will then estimate prevalence using all of the components of Bayes theorem, integrating the marginal distribution of the data using numerical integration in R. These estimates will be compared with estimates obtained using conjugate prior-likelihood relationships. Throughout the day, similarities and differences between maximum likelihood estimation and Bayesian estimation will be discuss
Simple, step by step examples will illustrate how the Metropolis algorithm works, and these examples will be expanded to include Metropolis-Hastings and Gibbs sampling.
Participants will construct a Gibbs sampler to estimate parameters in a simple problem and will use this problem to understand critical concepts including initialization, burn-in, mixing, and convergence.
MCMC and JAGS
Participants will work though a tutorial on MCMC software (JAGS and relevant R packages) using Bayesian linear and non-linear models as examples. Data sets available for problems will cover a number of examples.
Hierarchical Bayes & MODEL EVALUATION AND SELECTION
Test understanding of evening exercise with an example. Use example from MH from Day 4 evening.
Hierarchical structures and the concept of hyper-parameters will be introduced. We will begin with a simple example of estimating a mean assuming only sampling variation. We will then estimate the mean incorporating variation among individuals, modeling variation in individual-level parameters around an overall or “global” mean. This example will be extended by encouraging participants to “discover” group level effects [also known as random effects, (Gelman and Hill, 2009)] in a simple linear regression, where the intercept terms differ among sites, but are drawn from a shared distribution. Discuss relationships between random and fixed effects.
Participants will work though a tutorial on MCMC software (JAGS or OpenBUGS and relevant R packages) using Bayesian linear and non-linear models as examples.
Posterior predictive checks and Bayesian p-values will be introduced as a way to check goodness-of-fit of models and to evaluate choices of model structure. We will emphasize that the problem of model selection is not as straightforward as many ecologists might believe and there is no consensus among statisticians on a single, preferred approach. (Link and Barker, 2006).
These methods will be illustrated using models fit on prior days. Methods for model selection in the Bayesian framework will be discussed including the deviance information criterion, posterior predictive loss, posterior model probabilities, and Bayes factors.
Latent states, process models, and data models
A general framework for linking ecological models to data will be presented, where unobservable latent states are portrayed by process models that are linked to observable quantities by data models (Cressie et al., 2009, equation 4), i.e., P (parameters, process , data) / P (datajprocess, data parameters) (1)_ P ( processjprocess parameters)_ P (all parameters). Reinforce buiding HB, DAG, etc.
This highly general framework will be initially illustrated with an exercise incorporates process error..
Occupancy model development as a hierarchical problem.
This highly general framework will be initially illustrated with an exercise on modeling habitat occupancy by birds. The true state of a habitat (occupied or not) will be modeled as a function of covariates describing the habitat. The observed state (detected or undetected) will be modelled to estimate the probability that the bird is observed given that it is present. The data model will then be expanded to model detection probability as a function of covariates. This scenario is an exemplar for demonstrating the utility of a hierarchical model.