**R code and analysis accompanying our manuscript "Biologging reveals individual variation in behavioral predictability in the wild."**
We here give a detailed account of fitting double-hierarchichal models (DHGLM) within the R environment using the R package brms (Bürkner 2017).
Specifically, we use movement and diel activity data of Scandinavian brown bears to estimate individual behavioral types (i.e. mean behavior) and individual behavioral predictability (i.e. the residual intra-individual standard deviation around the mean, rIIV).
We fit a bivariate DHGLM which inherently estimates the covariance between behavioral means (i.e. behavioral syndrome), the covariance of means and rIIV, and the covariance of rIIV's (predictability syndrome).
Overview of files:
*CODE_MultivariateDHGLM.R* gives a detailed account of the model fitting and downstream analysis presented in the manuscript. It relies on the data object *DATA_R1.rds* as input. The code produces a model output which is also provided under *CompositeModel.rds*.
*CODE_Preprocess Behavioral Types.R* extracts behvaioral types and individual predictability into the data file *AN_BT.rds* which provides the input for reproducing code in *FIGURE 2.R*, *FIGURE 3.R*, and *FIGURE 4.R*
Finally, the code LANDSCAPE EFFECTS.R reproduces analyses presented in the supplementary material. It used the data file *Data_R1_Landscape.rd*s as input.
Please contact the project contributors with any questions or comments regarding the analyses.
Bürkner, P.-C. (2017) brms: An R package for Bayesian multilevel models using Stan. Journal of Statistical Software, 80, 1-28.