Lab 9: Badgered by Badgers

Multilevel and hierarchical models

Due: 11:59pm, Sunday, October 31



You MUST submit both your .Rmd and .pdf files to the course site on Gradescope here: Do NOT create a zipped folder with the two documents but instead, upload them as two separate documents. Also, be sure to knit to pdf and NOT html; ask the TA about knitting to pdf if you cannot figure it out. Be sure to submit under the right assignment entry. Finally, when submitting your files, please select the corresponding pages for each exercise.


For this lab, you will work within your pre-assigned teams. Each team should submit ONLY ONE report for this exercise. You must write the names of all team members at the top of the report containing your responses. Gradescope will let you select your team mates when submitting, so make sure to do so. Only one person needs to submit the sheet on Gradescope.

The Data

Management of badgers on Welsh and British farms is a controversial topic. While some argue that culling badger populations is necessary to control the spread of bovine tuberculosis, others argue that badgers are not the major cause of the spread of disease and that culling is inhumane, especially when badger vaccination strategies are an option.

We consider data from observational surveys of 36 farms over a period of three years. The data are available on Sakai under Resources, in the BadgersFarmSurveysNoNA.txt file. Each farm (identified by the variable farm_code_numeric) was observed up to eight times (once per season for a two year period). The primary outcome, Signs_in_yard, is whether badger activity (e.g., carcasses of their prey, badger feces, indications of digging) was present in the farmyard.


Your job is to evaluate factors related to presence of badger activity in the farmyard as well as to estimate the correlation over time in badger activity and farm-specific heterogeneity in the tendency to have badger activity.

Predictors to consider include year, season, number of active badger homes in nearby fields (no_active_setts_in_fields), the number of cattle on the farm (no_cattle_in_buildings_yard), whether farm feed can be accessed by badgers (accessible_feed_store_present), and indicators of whether various types of crops were present on the farm (including grass silage, cereal silage, hay, cereal for grain, sugar beets, vegetables, and molasses).

Prepare a written report (maximum of 5 pages) that answers the questions of interest. Your report should include the following.

DO NOT INCLUDE R CODE OR OUTPUT IN YOUR REPORTS. All R outputs should be converted to nicely formatted tables. Feel free to use R packages such as kable, xtable, stargazer, etc.