For this exercise, you will use the birddiv (in vu_advstats_students/data/birddiv.csv) dataset; you can load it directly from github using data.table::fread(). Bird diversity was measured in 1-km^2 plots in multiple countries of Europe, investigating the effects of habitat fragmentation and productivity on diversity. We will consider a subset of the data. Specificially, we will ask how various covariates are associated with the diversity of birds specializing on different habitat types. The data have the following potential predictors:

All of the above variables are standardized to a 0-100 scale. Consider this when choosing priors.

Your response variable will be richness, the bird species richness in the plot. Additionally, you have an indicator variable hab_type. This is not telling you what habitat type was sampled (plots included multiple habitats). Rather, this is telling you what type of bird species were counted for the richness measurement: so hab_type == "forest" & richness == 7 indicates that 7 forest specialists were observed in that plot.

Build one or more generalised linear models for bird richness. Your task should be to describe two things: (1) how does richness vary with climate, productivity, fragmentation, or habitat diversity, and (2) do these relationships vary depending on what habitat bird species specialize on. Some suggestions for your approach:

  1. Explore the data visually.
  2. Choose an appropriate liklihood distribution and link function (or, if unsure, try several and compare)
  3. Decide on appropriate predictors, then write out the model equations, and draw a graph of the model.
  4. Write Stan code for your model. If you want to visualise the log posterior, you could also try writing a log posterior function in R.
  5. Sample from the model using MCMC.
  6. Interpret the results using the tools we’ve covered so far. Some possibilities:
    1. Credible intervals for parameters
    2. Posterior predictive intervals
    3. Response curves (How does E(y) respond to the change in a parameter conditional on other parameters)

Note: it is not necessary to do a model selection procedure to choose your predictors (we will cover this later). Choose predictors based on what sub-questions interest you most or what you think will have the greatest effect on richness.

Data source:

Koivula, Matti J. et al. (2017), Data from: Breeding bird species diversity across gradients of land use from forest to agriculture in Europe, Dryad, Dataset, https://doi.org/10.5061/dryad.ts57v