DOI: 10.5061/dryad.g79cnp5zw
title: Quantifying animal social behaviour with ecological field methods

description: Field studies of social behaviour are challenging due to the need to
 record or infer interactions between multiple individuals, often under
 suboptimal environmental conditions or with potential disturbance by
 observers. Due to the limited field techniques available, we present a
 novel method to quantify social behaviours in the field by comparing the
 counts of individuals caught in traps across multiple locations sampled
 simultaneously. The distribution of individuals between traps gives the
 extent of aggregation, and phenotypic data allow for inference of
 non-random assortment. As a case study, we applied this method to
 populations of three-spined sticklebacks (Gasterosteus aculeatus) in
 freshwater ponds, using minnow traps. As expected, we observed a strong
 trend for aggregation. We were able to describe the ecological drivers of
 aggregation, comparing environmental and phenotypic conditions across
 sites. Aggregation was not related to environmental parameters, but was
 negatively associated with the proportion of breeding males caught during
 the breeding season. No evidence for phenotypic assortment based on body
 size was found. These results demonstrate that widely-available ecological
 equipment can address questions related to social behaviour. This
 cost-effective approach, avoiding the tagging of individuals and
 minimising extended observer disturbance, can be applied across various
 habitats and species.
description: # Quantifying animal social behaviour with ecological field methods
 [https://doi.org/10.5061/dryad.g79cnp5zw](https://doi.org/10.5061/dryad.g79cnp5zw) ## Description of the data and file structure ### Overview This project introduces a novel method to quantify animal social behaviour by comparing counts of individuals caught in traps across multiple locations sampled simultaneously. The method was applied to three-spined sticklebacks (*Gasterosteus aculeatus*) in freshwater ponds using minnow traps. ### Dataset The dataset includes the number of fish caught per trap location including the number of males in breeding condition (red males), aggregation scores calculated using the index of dispersion, measurements of fish body length, and various environmental parameters. Data was collected from 4 pond sites over 13 weeks from May to November 2021. The associated script performs statistical analyses to explore the relationships between these variables. ### Key Analyses 1. **Aggregation of Fish**: This method assesses the distribution of individuals between traps to determine the extent of aggregation. This provides insights into social clustering and spatial distribution. 2. **Impact of Environmental Variables**: Investigates how environmental factors, including turbidity, temperature, light intensity, and dissolved oxygen, influence the number of fish caught. 3. **Proportion of Adults to Juveniles**: Analyses the ratio of adult fish to juvenile fish caught per trap and how environmental factors influence the proportion of adults to juveniles. 4. **Phenotypic Assortment**: Examines whether there is a non-random assortment of fish based on body length. ### Significance This cost-effective approach utilizes widely-available ecological equipment to address social behaviour questions without the need for individual tagging or extended observer disturbance. It is applicable across various habitats and species, offering a practical solution for studying social dynamics in natural settings. ### Files and variables #### File: data1\_perSiteVisit.csv **Description:**  ##### Variables * Date: date sampling occurred * Week: week of data collection * Site: pond site that was sampled * AMorPM: whether fish were caught in the morning (AM) or afternoon (PM) * Temp: temperature (degrees celsius) of the water at each trap location, recorded every minute and averaged over the two-hour sampling period, and averaged again per sampling session * Light: light intensity (lum/ft2) at each trap location, recorded every minute and averaged over the two-hour sampling period, and averaged again per sampling session * DO: dissolved oxygen (mg/L) at each trap location, recorded prior and post sampling and averaged between the two samples, and averaged again per sampling session * Turbidity: turbidity (NTU) at each trap location, recorded prior and post sampling and averaged between the two samples, and averaged again per sampling session * fishPerSite: the number of fish caught per sampling session (i.e. the number of fish caught in one sampling session, the catch of all traps added together) * Mean: the mean for the number of fish caught per trap location * Variance: the variance (sample) for the number of fish caught per trap location * aggregation_score: the index of dispersion (variance divided by the mean) for the number of fish caught per trap location * Minutes_from_sunrise: the number of minutes from sunrise sampling started * Time_in: the time of day traps were deployed in the pond site * minutes_since_midnight: the number of minutes from midnight that sampling started * red_males: the number of breeding condition (red) males caught, per site location * COV_Med: the median coefficient of variance (the siteCOV; standard deviation divided by the mean) of bodylength for a sampling session * Quantile: the quantile of the siteCOV (calculated as the proportion of expected values that were less than or equal to the observed siteCOV) #### File: data2\_allPerTrap.csv **Description:**  Any null variables represent data that was not able to be collected during data collection. E.g. sites were not accessible on that day with funnel traps or equipment problems prevented recording of environmental variables. This is not the same as data with the value 0 where data was collected and this was the value.  ##### Variables * Week: week of data collection * Site: pond site that was sampled * Trap : trap location within the pond site (1 - 5) * AMorPM: whether fish were caught in the morning (AM) or afternoon (PM) * Temp: temperature (degrees celsius) of the water at each trap location, recorded every minute and averaged over the two-hour sampling period * Light: light intensity (lum/ft2) at each trap location, recorded every minute and averaged over the two-hour sampling period * DO: dissolved oxygen (mg/L) at each trap location, recorded prior and post sampling and averaged between the two samples * Turbidity: turbidity (NTU) at each trap location, recorded prior and post sampling and averaged between the two samples * fishPerTrap: the number of fish caught in each trap * fishPerSite: the number of fish caught per sampling session (i.e. the number of fish caught in one sampling session, the catch of all traps added together) * aggregation_score: the index of dispersion (variance divided by the mean) for the number of fish caught per trap location * red_males: red_males: the number of breeding condition (red) males caught, per site location * total_adult: the number of adults caught per trap * total_juvenile: the number of juveniles caught per trap #### File: data3\_bodylengths.csv **Description:**  ##### Variables * Week: week of data collection * Site: pond site that was sampled * Trap : trap location within the pond site (1 - 5) * bodylength: the bodylength (mm) iof each fish caught within a trap  #### File: data4\_COVtable.csv **Description:**  Null variables are found where COV values could not be calculated due to the number of fish caught in that trap being too low to calculate variance or mean e.g. 1 or 0 fish were caught. In some cases, where no fish were caught across all traps during a sampling session, the median COV for the site visit is null.  ##### Variables * Week: week of data collection * Site: pond site that was sampled * Trap: Trap : trap location within the pond site (1 - 5) * fishPerSite: the number of fish caught per sampling session (i.e. the number of fish caught in one sampling session, the catch of all traps added together) * COV: the coefficient of variance (siteCOV) of bodylength for each trap location * COV_Med: the median coefficient of variance (the siteCOV; standard deviation divided by the mean) of bodylength for a sampling session * P_Value: the p-value for the quantile generated from each COV Med ## Code\Software and Tools Required ### Software The analysis presented in this project was conducted using R, a free and open-source programming language and environment for statistical computing and graphics. R Version: 4.1.2 ### Required Packages The following R packages were used for data analysis and visualization. You need to install these packages if they are not already available in your R environment: * **`psych`**: For psychological and psychometric analysis. * **`bbmle`**: For maximum likelihood estimation and model fitting. * **`lme4`**: For fitting linear and generalized linear mixed-effects models. * **`glmmTMB`**: For fitting generalized linear mixed models with various families. * **`DHARMa`**: For residual diagnostics of generalized linear mixed models. * **`MASS`**: For various statistical functions, including negative binomial models. * **`ggplot2`**: For creating plots and visualizations. * **`tidyr`**: For tidying and reshaping data. * **`dplyr`**: For data manipulation and transformation. * **`gatepoints`**: For spatial and geographical data analysis. * **`sp`**: For handling and analyzing spatial data. You can install these packages using the following R command: ```r install.packages(c("psych", "bbmle", "lme4", "glmmTMB", "DHARMa", "MASS", "ggplot2", "tidyr", "dplyr", "gatepoints", "sp")) Copy code install.packages(c("glmmTMB", "dplyr", "tidyr", "ggplot2", "MASS", "DHARMa", "broom")) Workflow Data Preparation: The data files are prepared and cleaned as needed before analysis. The data1X and data2X datasets are used in the analysis. ``` ### Workflow #### Data Preparation The datasets (`data1X` and `data2X`) are prepared and cleaned as needed before analysis. #### Analysis Script A single R script provided with this project includes all the analysis steps. This script contains: 1. Loading the necessary R packages. 2. Data preprocessing and cleaning. 3. Running statistical models, including generalized linear mixed models (GLMMs) using `glmmTMB`. 4. Generating predictions and creating plots. To run the script, load it into your R environment and execute it. The script is designed to handle the datasets provided and produce all necessary outputs, including model results and visualizations. #### Viewing Results The analysis script produces statistical summaries and visual plots. Results are presented in the form of tables and graphs, which can be reviewed within the R environment. For further assistance with running the script or interpreting the results, refer to the comments and instructions included within the script.