A multilevel statistical toolkit to study animal social networks: the Animal Network Toolkit Software (ANTs) R package

Sebastiàn Sosa, Ivan Puga‐Gonzalez, Fenghe Hu, Jérôme Pansanel, Xiaohua Xie, Cédric SueurScientific 2020 · DOI

Abstract

The interaction between animals and the development of social relationships are central to animal ecology and evolutionary biology. Social Network Analysis (SNA) is an ideal tool for these studies, yet researchers often struggle with fragmented software. The Animal Network Toolkit Software (ANTs) R package provides a comprehensive, high-performance environment for animal SNA. It enables users to compute global, polyadic, and nodal measures; perform data stream and network permutations; and carry out statistical tests for static or temporal analyses. ANTs facilitates multilevel network analysis without the need to switch between multiple R packages, significantly advancing the study of animal behavior with superior computation speeds.

Introduction: Addressing the Fragmentation in SNA

Social Network Analysis is a powerful tool for understanding animal ecology, but the software landscape has historically been fragmented. Researchers have typically had to choose between specialized GUI software like SOCPROG—which is tailored for animal behavior but lacks programming flexibility—and generalist R packages like igraph or sna, which do not natively handle behavioral data collection biases (like focal sampling) or the specific permuted statistical tests required for non-independent social data.

This fragmentation forces researchers to switch between multiple platforms, increasing the risk of data formatting errors and making complex temporal or multilevel analyses unnecessarily difficult. The ANTs package was developed to bridge this gap, offering a "one-stop-shop" for raw data processing, multilevel permutations, and advanced statistical modeling.

Methods: A Unified Analytical Workflow

ANTs introduces a unified workflow that handles data at three organizational levels: Nodal (individual centrality), Polyadic (interaction patterns between pairs), and Global (overall network structure).

The ANTs analytical protocols workflow, illustrating the path from data frames to permuted statistical tests.

The package implements two primary permutation families to create null models:

  1. Data Stream Permutations: Randomizing observations before the network is built to control for spatial or temporal biases.
  2. Node/Link Permutations: Randomizing the resulting network labels.

Crucially, ANTs includes a stat family of functions (e.g., stat.glmm, stat.cor) specifically designed to run on permuted data, providing posterior distributions and permuted p-values. It also includes robustness testing via bootstrapping and observation-deletion simulations to ensure dataset stability.

Key Features and Results

The most significant contribution of ANTs is its "all-in-one" philosophy, which reduces tool-switching and improves reproducibility. The package is optimized for speed, outperforming existing alternatives in calculating network measures and running permutations—a critical advantage when 10,000+ iterations are required.

Summary of nodal, polyadic, and global network measures implemented in the ANTs package.

Key technical highlights include:

  • Time Heterogeneity Control: Indices like the Generalized Affiliation Index account for the fact that not all animals are observed for the same amount of time.
  • Multilevel Integration: Users can easily analyze how individual attributes (e.g., age, sex) impact global network properties (e.g., density, efficiency) without manual data merging.
  • Advanced Visualization: Integration of layouts like Force Atlas 2 and Barnes Hut repulsion allows for high-quality, publication-ready network visualizations directly from analysis objects.

Limitations and Future Directions

While ANTs efficiently handles networks up to 1,000 nodes, extremely large colonies (e.g., thousands of individuals) may still face computational bottlenecks. The authors view ANTs as a collaborative, upgradeable project and invite the community to implement new indices and analytical perspectives as the field of SNA continues to evolve.

Summary updated

Abstract

The possible role played by individual attributes, sociodemographic characteristics and/or ecological pressures in the interaction between animals and the development of social relationships between them is of great interest in animal ecology and evolutionary biology. Social Network Analysis is an ideal tool to study these types of questions. The Animal Network Toolkit Software (ANTs) R package was specifically developed to provide all the different social network analysis techniques currently used in the study of animal social networks. This global package enables users to (1) compute global, polyadic and nodal network measures; (2) perform data randomisation: data stream and network (node and link) permutations; (3) perform statistical permutation tests for static or temporal network analyses, and (4) visualise networks. ANTs allows researchers to perform multilevel network analyses ranging from individual network measures to interaction patterns and the analysis of the overall network structure, and carry out static or temporal network analyses without switching between different R packages, thus making a substantial contribution to advances in the study of animal behaviour. ANTs outperforms existing R packages for the computation speed of network measures and permutations.
BibTeX
@inproceedings{sosa2020multilevel,
  author = {Sebastiàn Sosa and Ivan Puga‐Gonzalez and Fenghe Hu and Jérôme Pansanel and Xiaohua Xie and Cédric Sueur},
  title = {{A multilevel statistical toolkit to study animal social networks: the Animal Network Toolkit Software (ANTs) R package}},
  booktitle = {Scientific},
  year = {2020},
  doi = {10.1038/s41598-020-69265-8},
}
Figure