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
owls = read_csv('data/owls.csv', trim_ws=TRUE)
## Parsed with column specification:
## cols(
## Nest = col_character(),
## FoodTreatment = col_character(),
## SexParent = col_character(),
## ArrivalTime = col_double(),
## SiblingNegotiation = col_integer(),
## BroodSize = col_integer(),
## NegPerChick = col_double()
## )
glimpse(owls)
## Observations: 599
## Variables: 7
## $ Nest <chr> "AutavauxTV", "AutavauxTV", "AutavauxTV", "...
## $ FoodTreatment <chr> "Deprived", "Satiated", "Deprived", "Depriv...
## $ SexParent <chr> "Male", "Male", "Male", "Male", "Male", "Ma...
## $ ArrivalTime <dbl> 22.25, 22.38, 22.53, 22.56, 22.61, 22.65, 2...
## $ SiblingNegotiation <int> 4, 0, 2, 2, 2, 2, 18, 4, 18, 0, 0, 3, 0, 3,...
## $ BroodSize <int> 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5...
## $ NegPerChick <dbl> 0.8, 0.0, 0.4, 0.4, 0.4, 0.4, 3.6, 0.8, 3.6...
Model formula: \[ y_i \sim{} \mathcal{Pois}(\lambda_i)\\ ln(\lambda_i) =\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 food treatment, sex of parent, arrival time (and various interactions) on the number of sibling negotiations. Brood size was also incorporated as an offset. \(\bf{Z}\) represents a cell means model matrix for the random intercepts associated with individual nests.