Preparations

Load the necessary libraries

library(tidyverse)
## Loading tidyverse: ggplot2
## Loading tidyverse: tibble
## Loading tidyverse: tidyr
## Loading tidyverse: readr
## Loading tidyverse: purrr
## Loading tidyverse: dplyr
## Conflicts with tidy packages ----------------------------------------------
## filter(): dplyr, stats
## lag():    dplyr, stats

Scenario

Read in the data

mckeon = read_csv('data/mckeon.csv', trim_ws=TRUE)
## Parsed with column specification:
## cols(
##   BLOCK = col_integer(),
##   PREDATION = col_integer(),
##   SYMBIONT = col_character()
## )
glimpse(mckeon)
## Observations: 80
## Variables: 3
## $ BLOCK     <int> 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9...
## $ PREDATION <int> 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
## $ SYMBIONT  <chr> "none", "none", "none", "none", "none", "none", "non...

Exploratory data analysis

Model formula: \[ y_i \sim{} \mathcal{N}(n, p_i)\\ ln\left(\frac{p_i}{1-p_1}\right) =\boldsymbol{\beta} \bf{X_i} + \boldsymbol{\gamma} \bf{Z_i} \]

where \(\boldsymbol{\beta}\) and \(\boldsymbol{\gamma}\) are vectors of the fixed and random effects parameters respectively and \(\bf{X}\) is the model matrix representing the overall intercept and effects of symbionts on the probability of the colony experiencing predation. \(\bf{Z}\) represents a cell means model matrix for the random intercepts associated with individual coral colonies.

Fit the model

Model validation

Model investigation / hypothesis testing

Predictions

Summary figures

References