This repository is for open access to source codes and data for the manuscript "Cooperation and lateral forces: moving beyond bottom-up and top-down drivers of animal population dynamics".
individual_based_model.cpp
: The code for the individual-based model. All the code is written in C++. g++ GNU C++ Compiler is used to compile C++ programs.population_final_state_analysis.ipynb
: The code for analyzing the relationships among population state (e.g., proportion of cooperators, the average degree of cooperation, and population size), environmental resource availability, and cooperation efficiency. All the code for population state data processing and visualization is written in Python.reproductive_output_analysis.R
: The code for analyzing the relationships between total reproductive output and cooperation benefit of groups. All the code for reproductive data processing and visualization is written in R.time_series_analysis.R
: The code for analyzing population dynamics and relative variability in population size. All the code for time series data processing, fast Fourier transformation, and visualization is written in R.\simulated_data
: All simulated data are generated by the individual-based model. Population state data (pfs_.txt files) was used to generate Figs. 2, 3, 5, S1. Reproductive data (repro_.txt files) was used to generate Fig. 4. Time series data (ts_*.txt files) was used to generate Figs. 6, S2. We only upload sample data with less simulation replications for time series data because the whole data used in the study are too large to upload. For the complete time series data, please contact the authors.