Data and code from: Increased demographic turnover and isolation precede social fragmentation in Asian elephants
Data files
Sep 23, 2026 version files 1.44 MB
-
1_Turnover_Rates.R
2.85 KB
-
2_Compare_Community_Detection_Methods.R
7.44 KB
-
3_MajorTrack_Community_Membership.R
5.98 KB
-
4_Network_Metrics.R
7.45 KB
-
5_Rewired_Edges.R
16.48 KB
-
6_SRI_Thresholds.R
3.77 KB
-
7_Lagged_Association_Rates.R
1.99 KB
-
8_Main_Final_Figures.R
16.26 KB
-
9_Supplement_Final_Figures.R
22.80 KB
-
DataForFigures.Rdata
1.05 MB
-
fpgbi.dat
106.95 KB
-
fullpop_graphs.dat
124.31 KB
-
README.md
5.89 KB
-
res_graphs.dat
13.06 KB
-
resgbi.dat
51.08 KB
-
times.dat
3.42 KB
Abstract
Humans and other animals live in highly interconnected social communities that are essential for survival and well-being. In principle, social communities can persist despite changes to their constituent members. However, gradually accumulating changes could push systems into alternate states when passing critical thresholds, called tipping points. The robustness of social systems to such changes has rarely been quantified in non-human species. We investigated the stability of social networks for wild female Asian elephants in Udawalawe National Park, Sri Lanka over a 12-year period by tracking community membership and structure across 443 individuals. Following accumulated demographic turnover, higher-level network structure fractured into smaller and more isolated social communities. Connections were not only changed due to the gain or loss of individuals, but also rewired among remaining individuals. This provides the first empirical evidence for a social state change in a long-lived mammal following a tipping point, transitioning towards a less cohesive social structure that may be less resilient to future disturbances.
Description of the data and file structure
This file contains descriptions of the data and scripts that accompany the manuscript "Increased Demographic Turnover and Isolation Precede Social Fragmentation in Asian Elephants". The aim of this study was to evaluate changes to the social network of a wild population of female Asian elephants over 12 years. All methods for the manuscript are reproducible using the materials in this repository. Detailed background, motivation, and interpretation of results are contained in the main manuscript that this dataset accompanies. This repository contains 6 data files and 9 R scripts that are described below.
Files
File: fullpop_graphs.dat
Description: This is a list of networks created using the R package igraph. There are 12 list items, representing the female elephant social networks for the full female population in years 2007-2018.
File: res_graphs.dat
Description: This is a list of networks created using the R package igraph. There are 12 list items, representing the female elephant social networks for the residents present in all years 2007-2018.
File: fpgbi.dat
Description: This is the full female population affiliation matrix across the study period, used to conduct lagged association rates for the full female population. Rows are individual female IDs and columns are unique group observations. The times.dat file (described below) contains unique observation days that align with the columns in this matrix.
File: resgbi.dat
Description: This is the resident affiliation matrix across the study period, used to conduct lagged association rates for the residents. Rows are individual female IDs and columns are unique group observations. The times.dat file (described below) contains unique observation days that align with the columns in this matrix.
File: times.dat
Description: This is a vector file of the observation days that pairs with the affiliation matrices for the full female population and the residents (fullaffs.dat and resaffs.dat). Each value matches a column in the affiliation matrices and corresponds to the observation day of the study (from day 0 to day 4363).
File: DataForFigures.Rdata
Description: This is a list of R data.frame objects that are used for analyses in multiple scripts and are used to create figures in the scripts 8_Main_Final_Figures.R and 9_Supplement_Final_Figures.R. There are 36 R data.frames in all, 34 of which can be reproduced using the above data files and the below R scripts, but which are supplied here to run scripts independently. Two dataframes in this file contain values tabulated from the raw dataset: 1) The data.frame newdat contains the annual summaries of individuals entering the population for the first time and individuals permanently leaving the population, which were verified with unpublished data from later years (2019-2023); 2) The data.frame allobservationdays contains the number of sample days for each month over the duration of the study period.
R scripts
File: 1_Turnover_Rates.R
Description: This script contains the procedure to calculate the relative turnover rate for the population between years and from the first year of the study period, 2007. This requires the fullpop_graphs.dat and DataForFigures.RData files.
File: 2_Compare_Community_Detection_Methods.R
Description: This script contains the procedure used to compare different community detection algorithms. This requires the fullpop_graphs.dat and res_graphs.dat data files.
File: 3_MajorTrack_Community_Membership.R
Description: This script implements an algorithm to identify long-term communities across a timeseries of networks, which is applied to the Asian elephant networks from 2007-2018 for all females and residents. This requires the fullpop_graphs.dat and res_graphs.dat data files.
File: 4_Network_Metrics.R
Description: This script calculates all network statistics and implements linear regression models to test the effects of the magnitude of demographic turnover on network statistics. This requires the fullpop_graphs.dat, res_graphs.dat, and DataForFigures.Rdata data files.
File: 5_Rewired_Edges.R
Description: This script has the procedure to test the effects of edge weight on the probability of rewiring using a binomial logit-link regression model. This requires the fullpop_graphs.dat and res_graphs.dat data files.
File: 6_SRI_Thresholds.R
Description: This script has the procedure for investigating multilevel structure of the elephant social networks by removing edges with association weights (measured as the Simple Ratio Index, SRI) below thresholds at 0.01 increments from 0 to 1. This requires the fullpop_graphs.dat and res_graphs.dat data files.
File: 7_Lagged_Association_Rates.R
Description: This script has the procedure for modeling the lagged association rates among pairs of elephants over the span of the study. This requires the data files fullaffs.dat, resaffs.dat, and times.dat.
File: 8_Main_Final_Figures.R
Description: This script generates the figures for the Main Text of the associated manuscript. This requires the DataForFigures.Rdata data file.
File: 9_Supplement_Final_Figures.R
Description: This script generates the figures for the Supplemental Information of the associated manuscript. This requires the DataForFigures.Rdata data file.
Code/Software
R version 4.3.1 is required to view and run the code contained in R scripts. Package versions are also supplied in each script. We recommend that users set the R working directory to their local file directory after downloading the dataset for ease of use.
