Intra- versus intergroup variance in collective behavior

See allHide authors and affiliations

Science Advances  02 Jan 2019:
Vol. 5, no. 1, eaav0695
DOI: 10.1126/sciadv.aav0695


Animal collective motion arises from the intricate interactions between the natural variability among individuals, and the homogenizing effect of the group, working to generate synchronization and maintain coherence. Here, these interactions were studied using marching locust nymphs under controlled laboratory settings. A novel experimental approach compared single animals, small groups, and virtual groups composed of randomly shuffled real members. We found that the locust groups developed unique, group-specific behavioral characteristics, reflected in large intergroup and small intragroup variance (compared with the shuffled groups). Behavioral features that differed between single animals and groups, but not between group types, were classified as essential for swarm formation. Comparison with Markov chain models showed that individual tendencies and the interaction network among animals dictate the group characteristics. Deciphering the bidirectional interactions between individual and group properties is essential for understanding the swarm phenomenon and predicting large-scale swarm behaviors.


Cooperative group activity requires a degree of consensus and synchronization. In other words, it is expected that collectivity will result in some homogenization among the individuals forming the group. At the same time, the properties of a coordinated group should somehow be a function of the different traits of the individuals composing it. These general statements bring about ample open questions in biology (14), even for simple organisms such as insects in a swarm (5, 6): How do the characteristics of the individual’s behavior differ when alone or when in a group? Which traits of the individual are adjusted for it to become part of the synchronized group, which are retained unchanged, and how are they manifested within the swarm? Do the traits of the individual support or interfere with collectivity?

In response to these questions, much research has been devoted to understanding the effect of variability among individuals on the group’s collective behavior, both experimentally—ranging from bacteria to primates (716)—and theoretically (1723). See (2426) for recent reviews and (27, 28) for investigation of heterogeneity in the context of swarm robotics. Part of the interindividual variability has been explained in terms of animal personality—the consistent or context-independent variations in animal behavior [e.g., (2931)]. Recently, it has been suggested that the inherent differences among members of the group can translate into distinctive group characters (9, 31). Namely, different groups composed of individuals with distinctive features may adopt different collective behaviors. However, the interactions between variability in specific aspects of the individuals’ behavior and group-level processes are complex and, moreover, bidirectional, where each level affects and amplifies the other. This leads to a practical difficulty in distinguishing between the inherent variability of the individuals’ features and the results of their interaction with the crowd. Accordingly, one of the main goals of the present study was to develop a general methodology for addressing these issues and its application to experiments.

Locusts offer a quintessential example of animal coordinated collective behavior and are therefore exceptionally suited for study of the above questions: Swarms of marching locusts can comprise millions of individuals, aligning or synchronizing their movement across hundreds of square kilometers. Moreover, marching locusts will also demonstrate their distinctive collective behavior under controlled laboratory conditions (4, 6, 3234) that can partially be reproduced in computer simulations. Although much studied, our knowledge of the complex dynamics and the mechanisms underlying the different aspects of locust collective behavior is far from complete [e.g., (6, 35)]. Moreover, locusts constitute a major threat to human agriculture, which adds to this model organism’s particular practical importance.

Here, we used marching locusts under controlled laboratory conditions to study the interdependency between the behavior of individuals and that of the group. To this end, we studied small groups of hoppers, individually tagged with special barcodes, enabling their consistent identification and tracking. The statistics of the behavior of the groups were compared with those of individual locusts introduced singly into the experimental arena and with those of noninteracting, shuffled swarms. The latter were generated by superimposing the trajectories of computer-shuffled real locusts from the experimental groups. These comparisons indicated those behavioral aspects of the individuals that are conserved among groups and necessary for the formation of collective motion. Other individual features, on the other hand, undergo a homogenizing effect by the group but significantly differ between groups, thus generating distinct group characteristics.

Last, using computer simulations, we established that individual differences in social behavioral tendencies can explain the observed variability among groups. In other words, the observed individual heterogeneity leads to the empirical intergroup variance. We applied a simple Markov chain model, which demonstrated that our findings can indeed be explained as resulting from groups composed of unique combinations of locusts that are differing only in their social-behavioral tendencies.


Locusts were individually tagged with barcodes, introduced into a ring-shaped arena (Fig. 1A), either singly (n = 20) or in groups of 10 (n = 20), and monitored by a video camera for 110 min. After retrieving the position coordinates of each locust in each frame throughout the experiments, a range of kinematic movement parameters and collectivity measures was computed for each group (see Materials and methods for details). Additionally, 20 fictive, shuffled groups were created from the experimental groups by shuffling the locusts’ trajectories across the experiments, such that each locust appeared in one shuffled group only (Fig. 1B). This enabled the same parameters and measures to be calculated also for the shuffled groups, serving as control.

Fig. 1 Experimental procedure.

(A) A single locust or a group of 10 locusts was introduced into a ring-shaped arena, with a barcode tag attached to each animal’s pronotum. Video monitoring and offline analysis enabled following the position of all locusts accurately and consistently throughout the experiment. Photo credit: Daniel Knebel, Tel Aviv University. (B) Data comprised three types: single animals in the arena (singles), groups of 10 animals in the arena (real groups), and fictive groups constructed by shuffling the data of the real groups (shuffled groups).

Quantifying collective motion

We first wanted to confirm that the small groups of 10 locusts were moving collectively under our experimental conditions. Collective motion is commonly quantified by measuring the order parameter (36). Here, we define the order parameter as the average direction of moving animals, where the direction is taken as +1 for counterclockwise (CCW) movement, −1 for the clockwise (CW) movement, and 0 for standing. Averaging over all frames in a single experiment (after taking the absolute value), the order parameter could vary between 0 (no preferred direction) and 1 (all moving animals advance in the same direction).

To be precise, denote by wi(t) the direction in which animal i moves at time tEmbedded Imagewhere N is the number of walking animals.

As expected for coordinated groups, the order parameter of the real groups was significantly higher than that of the shuffled groups (Fig. 2A; Wilcoxon signed-rank test, P < 0.001).

Fig. 2 Collective behavior in groups of 10 locusts.

Comparison of collectivity measures between the real and the shuffled groups throughout the experiments. (A) Average order parameter. (B) Collectivity parameter. (C) Spread measure. Each point represents data from a single experiment (n = 20). ***P < 0.001.

The order parameter is insufficient for differentiating true collectivity from that of a common response of independent individuals to an external stimulus [see also (37)]. To this end, we introduced a new parameter of collectivity, which calculates the mean (over all experiments) of the variance in individual directions in each frame, scaled by the variance expected for independent animalsEmbedded Imagewhere V(t) is the variance in wi(t) at frame t (among moving animals) and p is the empirical probability to walk in a CCW direction throughout the experiments (0.46). Therefore, 4p(1 − p) is the variance of a Bernulli random variable with mean p. The average scaled variance in the direction of walking animals is subtracted from 1, and the absolute value is taken. Thus, we obtain a new scalar parameter, termed the collectivity parameter, which varies from 0 (independent animals) to 1 (a collective swarm). This measure is invariant with respect to a possible bias in the CW/CCW directions (in our experiments, the probability of walking in a CCW direction was found to be p = 0.46). Our real groups were found to have a significantly higher collectivity parameter than the shuffled ones (Fig. 2B; Wilcoxon signed-rank test, P < 0.001). Another benefit of estimating the collectivity parameter is its insensitivity to fluctuations, which may cause some low, temporary order that is not due to interactions between animals. This is perhaps best emphasized by the almost perfect correlation shown by the collectivity and order parameters in the real groups (r = 0.91, Spearman’s correlation, P < 0.001), compared with the non-significant correlation in the shuffled groups (fig. S1A). Hence, the collectivity parameter is instrumental in distinguishing between the real animal-animal interactions and statistical fluctuations.

Finally, we measured the spatial distribution or the average distance among all animals in each frame, termed the spread measure. The spread measure (for standing and walking insects together) was significantly smaller for the real groups than for the shuffled ones (Fig. 2C; Wilcoxon signed-rank test, P < 0.001 for each), indicating the insects’ tendency to aggregate (see fig. S2 for results separating standing and walking animals).

Together, the three parameters tested (order, collectivity, and spread; Fig. 2) confirm that 10 locusts in the arena are sufficient for the formation of true collective behavior, which is manifested in collective and ordered marching, as well as in a tendency to aggregate.

The effect of the group on the individual

After establishing that our groups indeed moved collectively, we sought to understand in what respect the social context influences the dynamics of the individuals. We began with relatively simple kinematic measures and compared the small experimental groups with single animals in the same arena.

The fraction of time spent walking, the speed while walking, and the average duration of walking bouts did not significantly differ between the single and the grouped animals (Fig. 3, A to C, respectively). The average pause duration, however, was significantly shorter in the grouped animals (Fig. 3D; Wilcoxon signed-rank test, P < 0.05). No significant differences were found in the variances of these parameters between the two experimental conditions: i.e., while in most aspects locust walking was similar whether alone or in a group, among the examined parameters, pause duration was the only feature found to be critical to the formation of collective motion (this does not exclude possible effects of interactions among other measured or unmeasured parameters).

Fig. 3 Kinematic parameters of single locusts versus locusts in real groups.

(A) The average fraction of time spent walking, (B) the average walking speed, (C) the average duration of a walking bout, and (D) the average pause duration of locusts in real groups and of single locusts. Significant differences are noted between the averages, but not the width of the distributions. *P < 0.05.

Individual differences within the group

We were interested to learn whether individuals in groups adapt their behavior to others (i.e., retaining the overall statistics of their kinematics). Figure 4A presents the average kinematic measurements in each experiment. As expected, there was no difference in the means of the real and shuffled groups, because, overall, they comprised the exact same individuals and hence the same kinematic measurements, only shuffled. Nonetheless, the variance within the real groups (intragroup variance) was significantly smaller than that within the shuffled ones: the interquartile range (IQR) measured within the real groups across the animals was significantly smaller than that of the shuffled groups, in all kinematic parameters examined (Fig. 4B; fraction of time spent walking, walking speed, walking bout duration, and pause duration; Wilcoxon signed-rank test, P < 0.01, P < 0.001, P < 0.05, and P < 0.05, respectively). This indicates that in real interacting groups, there is a homogenizing effect on the group members.

Fig. 4 Kinematics of real versus shuffled groups of locusts.

(Aa to Ad) Comparisons between the average fraction of walking, average walking speed, average walking bout, and average pause duration of the real and shuffled groups, respectively. (Ba to Bd) Comparisons between the within groups’ IQR of the fraction of walking, average walking speed, average walking bout, and average pause duration of the real and shuffled groups, respectively. *P < 0.05, **P < 0.01, ***P < 0.001.

Intergroup variance

The demonstrated homogenizing effect of the group does not necessarily dictate that different groups behave similarly. To examine this, we compared the variance in the kinematics of the real and shuffled groups: If all the groups of locusts were similar, then the differences should not be significant. We found that the variance in the fraction of time spent walking, the walking speed, and the average walking duration was significantly greater for the real groups compared with the shuffled ones (intergroup variance; Fig. 4, Aa to Ac; Brown-Forsythe test, P < 0.05, P < 0.01, and P < 0.05, respectively). Namely, differences between groups were averaged out in the shuffled groups. These findings thus indicate that each real group adopts its own unique characteristics. The average pause duration was again an exception, as there was no significant difference between the variance of the real and the shuffled groups (Fig. 4B). Therefore, while some kinematic quantities can endow each group with unique, distinguishable characteristics, others (i.e., pause duration and the collectivity parameters) were found to be consistent among groups.

The effect of the individual’s traits on the group character

Since each group of locusts adopted a unique character, the individual differences among its members, even after the group homogenizing effect (Fig. 4, Ba to Bd), should somewhat determine its nature. To demonstrate a possible interdependency of the group’s unique character and the traits of the individuals composing it, we sought to quantify an individual feature or tendency related to the social context that is consistent throughout each experiment.

On the basis of our previous work (4, 34), we hypothesized that the number of individuals walking in the arena is a key stimulus, promoting marching. Accordingly, we calculated the conditional probability of each locust to walk as a function of the number of other walking locusts in the arena (see the example in Fig. 5A). We found that the probability of a locust to walk when five or more other locusts were walking was rather consistent (Fig. 5B), with a correlation of 0.79 between the two halves of the experiment (Spearman’s correlation, P < 0.001; compare with the non-significant correlation obtained with less than five other walkers, as shown in fig. S3C). This probability (averaged for each experiment) was found to have a high correlation with both the order and the collectivity parameters, reaching 0.71 and 0.7, respectively (Fig. 5C; Spearman’s correlation, P < 0.001 and P < 0.001, respectively). Similar correlations calculated for the shuffled groups were not significant. These correlations thus demonstrate the interdependency between the characteristics of individuals and the group dynamics.

Fig. 5 Kinematics of real versus shuffled groups of locusts.

(A) Probability of walking as a function of the number of other walkers for a single experiment. Each colored line represents the probability of a specific animal to walk conditioned on the number of other walking animals (0 to 9). The thick gray line shows the experimental average. The shaded area marks the probability of the locusts to walk when five or more others walk (termed P2W5). (B) The correlation between the average value of P2W5 obtained using only the first and only the second halves of the experiments. The high correlation suggests that this observable is a consistent individual behavioral characteristic. (C) Correlation between the order and the collectivity parameters with P2W5.

Mathematical model of individual and group behavior

The correlations described above do not, however, indicate whether the observed intra- and intergroup variances are indeed caused by the heterogeneity in the probability of animals to walk, or vice versa. Therefore, we designed a mathematical model that incorporated only the minimal individual tendencies described (the individual tendencies to walk when five or more other animals are walking) and explored whether it generated the expected inter- and intragroup variances based on our experimental results.

For a swarm of n animals, the model describes how the system evolves from its state at a given time t, described by w(t) = (w1(t), …, wN(t)) to its state at a later time t + 1, given by w(t + 1). The model assumes an effective coarse-grained discrete time scale (6). Assuming that it is a homogeneous Markov chain, it is described as a transition probability matrix of dimension 3N × 3N.

At the beginning of every simulation, we randomly drew the traits of each animal. The traits of animal j determine its probability to change its state (standing, moving CW, or moving CCW). In accordance with the experiments, we assumed that if the fraction of conspecifics walking in the arena is less than 0.5, then the probability of walking is the same for all animals, but grows with f (Fig. 5A). If half the animals or more are walking, then the probability of walking is a random variable, pj, with values drawn from the empirical distribution described in fig. S3B. As in the experiments, simulated shuffled swarms were created by shuffling simulated single-animal trajectories (with no repetitions). See Materials and methods for further details.

The model generated 1000 independent samples of 10 animal groups (simulated groups), in which each individual received at random one of the real individual tendencies to walk when 5 or more others walk as measured experimentally (overall 200 samples). Shuffling the trajectories produced new simulated-shuffled groups. Both the simulated and simulated-shuffled groups generated order and collectivity parameters, as well as fractions of time spent walking values, comparable with those of the experiments. The order and collectivity parameters, and the fraction of walking time intergroup variance of the simulated groups were higher than those of the simulated-shuffled ones (Fig. 6, A to C). The figure also compares results with homogeneous groups, either only within each group (all animals in a group are the same, but groups are different) or across all groups (all animals in all groups have the average value of pj). Furthermore, the intragroup variance in the fraction of time spent walking was lower in the simulated groups than in the simulated-shuffled ones (Fig. 6D). These results are all consistent with the experimental data (cf. Figs. 2 and 4) and therefore indicate that the different individual tendencies of locusts are sufficient for the generation of a group’s unique characteristics.

Fig. 6 Simulation kinematic and collectivity measures.

The output of computational simulations was compared when the model was introduced with either the data of the locusts in the real experimental groups (real groups), the shuffled data (shuffled groups), and the homogeneous data (same for all group members) equal to the average value of each simulated group (homogenized within groups), or the average of all simulated groups (homogenized across groups). (A to D) Distribution of the simulated outputs of the order parameter, collectivity parameter, average fraction of walking, and within groups’ IQR of fraction of walking, respectively.

Modeling larger swarms

While these simulations mimicked the experimental results, the computational model also enabled us to manipulate the initial distribution of individual traits, the swarm size, and the interaction network among conspecifics. To this end, we studied four model versions corresponding to different interaction networks: one global (each animal interacts with all others) and three local (each animal interacts only with a subpopulation, reflecting the real locust visual field of view; these subpopulations were either fixed or dynamic). See Materials and methods for details.

All local versions showed qualitatively similar dynamics and statistics in almost all parameters (figs. S4 to S7). However, a major difference was found between the local and global model results. In the latter, the averaged order and collectivity parameters did not decline as the groups grew larger than 100 animals but rather reached an asymptotic value (0.4 to 0.5 for the order parameter and 0.2 to 0.4 for the collectivity). Another result obtained in the local fixed models only was that the intragroup variances of the time spent walking were wider for simulated groups. Yet, they become similar to the shuffled-simulated groups’ variance as a function of the group size. The dynamic model, on the other hand, resembled the global model from that perspective.

The combination of results from the various types of models indicates that the intergroup variance is a prominent consequence of the difference among the animals that compose the groups and that it is not masked or averaged out by large groups. Moreover, the intergroup variance carries information on the topology of the social interaction network between conspecifics.

The intragroup variance, however, seems to depend largely on both the kind of information each animal receives and the size of the group. In rather small groups, all model types behave similarly, as the number of animals dictates that all animals receive information about the entire group at each step. However, the differences between the local models indicate that the ability to generate in-group homogeneity is related to the formation of stable subgroups within the swarms. This is demonstrated by the fixed and grid-based models, in which animals receive and deliver information to only a steady subset of the population. There, each subgroup probably generates high uniformity within itself (as estimated for small groups in all models) and reduces the overall swarm inner variability (figs. S4C, S5C, S6C, and S7C).


True collective-coordinated behavior is a macroscopic, group-level property, evolving from local interactions among the individual group members [e.g., (14)]. Here, we asked whether and how the group affects the behavior of its members and whether individual behavioral tendencies are masked or, on the contrary, manifested in the group behavior.

The overall average and variance of individual locusts’ walking kinematics were mostly similar (with the exception of the pause duration), when the locusts were tested singly or as part of a small group. At the same time, the group clearly exerted a homogenizing effect on the kinematics of its members. This is seemingly a contradiction—if the group environment does not affect the overall observed variance, how can variance be reduced by the group? The answer lies in the balance between intragroup homogeneity and intergroup heterogeneity: While each group averages out the properties of the individuals forming it, the average kinematics reached within each group are distinctive. Hence, the specific features of the group are strongly dependent on the combination of its comprising individuals, rather than being determined by the social context per se.

The only notable exception to the above was found in the average duration of pauses between consecutive walking bouts, which was shorter when tested in a group compared with the singles. This behavioral feature, therefore, seems to constitute a fundamental one, most influenced by the animals’ social environment. In accord with previous studies that explored the role of intermittent motion in collective behavior [e.g., (4, 38)], the pauses, serving the decision of the individuals to join the collective motion, are critical for the formation of the swarm. The intergroup variance in this particular parameter was rather small and exceptionally similar between the real and the shuffled groups, again suggesting the importance of the pauses in the collective swarm behavior. We therefore emphasize the importance of examining intergroup variance as an effective tool in identifying those behavioral characteristics that are essential for the generation of collective behavior. Our method is particularly applicable given that it allows studying small swarms, which are typically easier to analyze than large ones.

The consistency of our finding was corroborated by Markov chain simulations. The computational model also enabled us to manipulate the initial distribution of individual traits, the swarm size, and the interaction network between conspecifics. We find that while both the inter- and intragroup variances decrease with swarm size, they also depend on the topology of the graph describing the interaction network within the group.

The above key points regarding collective motion of animal groups in general are even more pertinent for locusts, known for their ability to display density-dependent plasticity in their behavior. Locusts are known to form swarms constituting millions of individuals. This is not to say, however, that our results on small groups of locusts lack natural relevance. The density within a swarm is not fully homogeneous. The collective behavior in low-density areas, such as the outskirts of the swarm, might be greatly determined by the individuals and the local small groups within these areas. Moreover, the coalescence of locusts into destructive plagues commences by means of small-scale local aggregations, followed by a complex and far from fully understood process of phase transformation, further aggregation, and swarming. Similarly, our understanding of how locust swarms disperse is lacking. The data presented here suggest that during both processes (swarm buildup and dispersal), the individual tendencies of the members might play a critical role in the swarm dynamics. These ideas are supported by our simulation results (figs. S4 to S7), for example with the local grid-based model, which indicates that the ability to generate in-group homogeneity is related to the formation of stable subgroups within the swarms.

Finally, our findings highlight the prominence of biological variance, which echoes in every aspect of the life sciences (39, 40). We have demonstrated here a general methodology in which a careful analysis of both individual and group variances can reveal which features are key for the formation of collective motion, and uncover the intricate, synergetic relations between the dynamics of crowds and the personal traits of the individuals compromising it.



Desert locusts, Schistocerca gregaria (Forskål), were obtained from our colony at the School of Zoology, Tel Aviv University, Israel. The locusts were reared for many consecutive generations under crowded conditions with 100 to 160 individuals in 60-liter aluminum cages under a controlled temperature of 30°C, 35 to 60% humidity, and a 12-hour dark/12-hour light cycle. The locusts were fed daily with wheat seedlings and dry oats. All experiments were performed with nymphs of the final (fifth) nymphal instar (3 to 4 cm in length and ~0.5 cm in width).

Experimental setup

The experimental arena was composed of a flat paper sheet floor circumscribed by an outer blue plastic wall (60-cm diameter by 55-cm height). A circular concentric wall made of similar plastic (diameter, 30 cm) was placed in the center to create a ring-shaped arena (Fig. 1A). The lower 10 cm of the arena walls and central dome were thinly coated with Fluon (Whitford Plastics Ltd., Runcorn, UK) to prevent the nymphs from climbing. The arena was placed in a room heated to 30°C and lit by three 100-W bulbs. A video camera (Sony FDR-AXP35: 4K Ultra HD) recorded the experiments from above.

Individual locust recognition

Before each experiment, locusts were individually tagged with miniature barcode tags [Fig. 1A; BugTag, Robiotec Ltd., Israel; see also a similar technique using barcodes for tracking insects specially across time in (41)]. Offline analysis of the video recordings by the Robiotec advanced system for consistent and continuous individual identification, complemented by a custom-designed multiple-target tracking and a trajectory-smoothing method [as detailed in (4)], enabled retrieval of the position of each animal throughout the experiment in respect to the arena’s center.

The BugTag system enables highly accurate measurements of the tag’s center of mass with a resolution of 2 to 3 pixels (corresponding to ca. 0.5 mm) at a rate of 25/3 frames per second. Short segments in which animals were not identified by the system (shorter than 5 cm or 25 s) were interpolated, resulting in about 99% identification. The rest of the frames were analyzed manually, resulting in 100% identification of all animals in the arena.

Experimental conditions

Two types of conditions were tested in the arena: (i) experiments with single locusts (n = 20) and (ii) experiments with groups of 10 locusts (n = 20). In addition, shuffled groups were created by shuffling the members of the group experiments (n = 20). Each locust was used exactly once to create a fictive movie with nine other locusts with which it had not originally swarmed (Fig. 1B).

Analysis of behavior

All data analysis was performed using MATLAB (MathWorks, Natick, MA, USA). The analysis of all experiments was conducted from the 1st to the 111th minute of the recorded movie. Specific attributes of the system and the individual locusts were defined and analyzed as follows:

1) The instantaneous spread measure was defined as the average of all distances between all pairs of animals in each frame. The global spread measure is the average over all frames in a single experiment.

2) The instantaneous walking speed was calculated by the distance an animal traveled over the time of one frame. The global walking speed in an experiment is the average over all animals and frames.

3) Walking bouts and pauses were identified using a repeated running median (RRM) smoothing (4, 42). Walking bouts were defined as segments with RRM speeds greater than 0.25 cm/s for more than 1 s. The global walking bout and pause duration in an experiment are the average duration over all walking bouts or pauses, respectively.

4) Probability of walking as a function of k other walkers was calculated for each locust by the number of frames it walked when k other animals walked divided by the number of frames k other animals walked (Fig. 5A). Denote P2W as the conditional probability to walk, P2Wik = P(Li|Ok), where Li is the event animal i walked and Ok is the event that k other animals walked. To calculate the probability to walk conditioned on the event that K or more (less) others walk, P2WiK = P(Li|Mk), the number of frames the animal walked, Li, and K or more (less) others walk, MK, was divided by the number of times MK occurred (Fig. 5B and fig. S3). The global probability to walk when K or more/less others walked is the average of P2WiK = P(Li|Mk) over all animals (Fig. 5C): P2WK = ∑iP2WiK/N.

Statistical analysis

All statistical tests were conducted with MATLAB. To compare between median values, Wilcoxon signed-rank test was used. To compare between variances, Brown-Forsythe test was used. Significant differences in variance were marked using vertical whiskers and asterisks. All correlation values represent Spearman’s rank coefficients and are all significant statistically (P < 0.05). Violin plots were generated on the basis of the violinplot function for MATLAB provided here:

Markov chain model

We devised a simplified model to test our hypothesis that variability in the response of animals to conspecifics accounts for the observed inter- and intragroup variance in real and shuffled groups. In addition, we applied the model to predict the dynamics of larger swarms.

For a swarm of n animals, the model is essentially a homogeneous Markov chain over the states space Ω = {−1, 0, 1}N. For w(t) ∈ Ω, we denote w(t) = (w1(t), …, wN(t)). Recall that wi(t) = 0 implies that animal i is standing at time t, while wi(t) = ±1 implies that at time t, animal i is walking in the CCW(+1)/CW(−1) direction. The model assumes a coarse-grained discrete time scale (6) and is determined by the transition probability matrix P of dimension 3N × 3N. For u, v ∈ Ω, Pu,v is the probability to change from state u = (u1, …, uN) to state v = (v1, …, vN).

At the beginning of every simulation, we randomly draw the traits of each animal. The traits of animal j determine the probability to have vj = −1, 0, or 1 as a function of u. In accordance with the experiments, we assume that if the fraction of conspecifics walking in the arena is less than 0.5, then the probability of walking (vj = ±1) is 0.1 + 0.6f. If half the animals or more are walking, then the probability of walking is a random variable, chosen once at the beginning of the simulation for each animal, with values drawn from the empirical distribution described in fig. S3B. If the animal is walking, the probability of walking in the same direction of ϕ(t) depends linearly on ϕ(t). By fitting to experimental values (4), we takeEmbedded Image

Simulations were run for 1000 steps with N = 10, 20, 50, 100, 200, 500, 1000, and 2000. The first 100 steps were discarded and not used for the statistics. As in the experiments, simulated shuffled groups were created by shuffling simulated single-animal trajectories (with no repetitions).

Modeling of large swarms

The model described above is global, in the sense that the decision to walk and in which direction depends on all the animals. This assumption makes sense for small swarms, in which the coarse-grained time can be interpreted as the time it takes an animal to “sample” the state of all others. However, within large swarms, a single animal will typically only see a few neighbors and will not have any knowledge of the entire state of the swarm. To this end, we studied three versions of a local model. The model assumes that the probability of an animal to walk depends on how many of the other animals it sees are walking. Let us denote by f the fraction of walking animals it sees, i.e., the number of animals seen walking divided by the number of animals seen (walking or standing). If f is less than 0.5, then the probability to walk in the next simulation step is 0.1 + 0.6f. Parameters were obtained by fitting the probability to walk in all 200 tested animals (similar to the left half of Fig. 5A). However, if f ≥ 0.5, then the probability to start walking is itself random: The values are drawn from the empirical distribution depicted in fig. S3B. They are different for each animal but constant throughout the simulation. The threshold of f = 0.5 corresponds to our finding that the influence of five or more walking animals out of nine is indeed an individual trait that is consistent throughout an experiment (Fig. 5B).

The results with the global model, in which every animal sees all others, were detailed above in Results. As in our experimental analysis, simulated-shuffled groups were generated by shuffling animal trajectories between simulation instances. The order and collectivity parameters were computed, as well as the average (among animals in a simulation instance) fraction of time walking. Averages and inter- and intragroup variances (IQR) were compared.

One of the key problems with the global model is the unrealistic assumption that all animals are continuously aware of the walking state of all other animals even within very large groups. As a result, large global swarms fail to synchronize. This can be seen in fig. S4 (Aa and Ab), which shows that both the order and collectivity parameters of simulated swarms become very small as the number of animals grows.

To this end, we studied three versions of local models, in which each animal only sees and reacts to a small number of conspecifics. These versions correspond to different interaction networks among individuals as follows.

1) A fixed local model, in which every animal only sees nine other animals, randomly chosen once at the beginning of each simulation. The set of neighbors is fixed throughout the simulations, i.e., the same nine animals are observed (fig. S5).

2) A dynamic local model, in which every animal only sees nine other animals. A new set of nine neighbors is drawn for each animal every simulation step (fig. S6).

3) A grid-based model, in which animals are initially placed on a square two-dimensional grid. Each animal sees its nearest neighbors on the grid, with periodic boundaries (fig. S7). Note that the number of neighbors in this model is eight.


Supplementary material for this article is available at

Fig. S1. Relation between the order and collectivity parameters.

Fig. S2. Aggregation of walking and standing animals.

Fig. S3. Distributions of the social-dependent probability to walk.

Fig. S4. Global model results.

Fig. S5. Local-fixed model results.

Fig. S6. Local-dynamic model results.

Fig. S7. Local grid-based model results.

This is an open-access article distributed under the terms of the Creative Commons Attribution-NonCommercial license, which permits use, distribution, and reproduction in any medium, so long as the resultant use is not for commercial advantage and provided the original work is properly cited.


Acknowledgments: Funding: D.K. and G.A. are thankful for partial support from the Israel Science Foundation’s grant no. 373/16. Author contributions: D.K., A.A., M.G., and G.A. designed the study. D.K. and M.G. performed the experiments. D.K. and G.A. analyzed the data. G.A. constructed the model. D.K., A.A., and G.A. wrote the manuscript. Competing interests: The authors declare that they have no competing interests. Data and materials availability: All data needed to evaluate the conclusions in the paper are present in the paper and/or the Supplementary Materials. Additional data related to this paper may be requested from the authors.
View Abstract

Navigate This Article