Behavioural syndromes in repeated traits
A route from a biological question to interpreting multivariate behaviour
When two behaviours vary together, do individuals that score higher on one also tend to score higher on the other? And when one individual scores higher than usual on one behaviour, does it also score higher than usual on the other? Explore both questions with Arctic charr and dogs.
Follow the examples
- Start with Arctic charr. Follow two trials from one fish through a checked model, an interval and a biological conclusion.
- Try Dogs to see how study year changes the question. Use Framework and Prepare data when you want the model or data conventions in more detail.
- Try the same steps with your own data. Use Diagnostics and Uncertainty when you need more detail.
Find the manuscript figures, data and scripts under Figures and code, and the commands for reproducing results under Report and reproduce.
Try Red knots to see how physiology and behaviour vary together when traits have different sample sizes. The random-slopes extension shows how individual responses can change across a temperature gradient.
Data and models
The examples use the original charr workbook and dog records with randomized IDs. The data notes give sources, acknowledgments and checksums. The lessons use glmmTMB (Brooks et al. 2017; McGillycuddy et al. 2025) and gllvmTMB (Nakagawa 2026) with the same observations and mean model.
Before you start
You should be comfortable with R data frames, a univariate mixed model, and the distinction between a variance and a correlation. Saved outputs record the versions used, but do not provide a locked software environment. The reproduction page distinguishes saved results from a fresh refit.
Install the software
To prepare the datasets, run this in R once:
install.packages(c("readxl", "digest"))To redraw Figures 2–4 from the saved results, install the plotting packages:
install.packages(c("ggplot2", "patchwork", "ggrepel"))For fresh fits, install glmmTMB and the development build of gllvmTMB:
install.packages(c("glmmTMB", "pak"))
pak::pak("itchyshin/gllvmTMB")Check the installed versions with packageVersion("glmmTMB") and packageVersion("gllvmTMB"). The development build can differ from the version in the software record and may need R compilation tools. If you also want to build the website, install Quarto, knitr and rmarkdown. The random-slopes scripts list their dependencies in the lesson.
Report and reproduce gives the commands to run from the extracted folder.
Empirical numerical results and figures come from saved analysis outputs. To render the saved-result site without running its code chunks, use quarto render tutorial --no-execute. A plain quarto render tutorial runs enabled chunks, including diagnostic summaries. It does not rerun the empirical model fits; those require the analysis scripts listed in Report and reproduce. Examples marked Guidance only, not run in this render show a workflow without claiming that this site produced its result.