Emergence of metapopulations and echo chambers in mobile agents

Multi-agent models often describe populations segregated either in the physical space, i.e. subdivided in metapopulations, or in the ecology of opinions, i.e. partitioned in echo chambers. Here we show how both kinds of segregation can emerge from the interplay between homophily and social influence in a simple model of mobile agents endowed with a continuous opinion variable. In the model, physical proximity determines a progressive convergence of opinions but differing opinions result in agents moving away from each others. This feedback between mobility and social dynamics determines the onset of a stable dynamical metapopulation scenario where physically separated groups of like-minded individuals interact with each other through the exchange of agents. The further introduction of confirmation bias in social interactions, defined as the tendency of an individual to favor opinions that match his own, leads to the emergence of echo chambers where different opinions coexist also within the same group. We believe that the model may be of interest to researchers investigating the origin of segregation in the offline and online world.

Metapopulation models were first introduced in ecology and are nowadays widely used for the study of a large variety of phenomena, ranging from epidemic spreading to general social phenomena [1][2][3][4] . They describe agents, possibly of different species, that diffuse stochastically on the vertices of a network and interact among them upon contact on the same vertex, whose occupancy is not limited (hence the term 'bosonic' often used to describe these models 5 ). Recently, attention has been devoted to understand how different features of the metapopulation network, fixed during the dynamics of the process, affect the behavior of the system 5,6 . However, less attention has been devoted to describe how metapopulation structures emerge in absence of obvious environmental factors. How does a population end up into many segregated subgroups?
The pioneering work of Schelling showed that no strong incentives are needed at a microscopic level for segregation to occur. Specifically, it showed that individual weak preferences to be surrounded by similar others are sufficient for the emergence of spatially segregated subpopulations, and no strong desire to avoid different others is needed 7,8 . Further studies confirmed this picture, showing that even a population of individuals who actively seek diversity can result into segregation [9][10][11] . All of these models describe individuals that occupy the nodes of a lattice or network and are endowed with a visible trait that rules their interactions (e.g., skin color). They address the question of how different microscopic interaction rules impact the spatial distribution of these individuals. Crucially, the visible trait is modeled as a fixed and immutable characteristic of the individuals.
In this paper, we relax the assumption of a fixed trait of the individuals and focus on the interplay between spatial mobility and opinion dynamics. We consider mobile agents characterized by a continuous variable, or "opinion", that evolves in time depending on the microscopic interactions between individuals. The model we propose incorporates • Mobility: Individuals move in a two dimensional space; • Homophily: Individuals have a tendency to interact more with others who share their opinion; • Social Influence: Interactions between individuals tend to increase their similarity.
(Here we consider an operative definition of 'social influence' , see e.g., refs 12 and 13). These three elements have been considered by a number of models, but the interplay between them has received less attention. For example, the question of why homophily and social influence do not necessarily yield social uniformity motivated the well-known Axelrod model of dissemination of culture 12,14 , and models based on mobile interacting agents have been used to study such phenomena as epidemic spreading 15 , social cooperation 16 and consensus 17 . Here, we consider the mobility scheme introduced in refs 18 and 19, which reproduces empirical data on human face-to-face interactions in social gatherings. However, while ref. 18 considers individuals characterized by a quenched "attractiveness" ruling the duration of their interactions, here the role of attractiveness is played by the status or opinion of individuals with respect to the other agents, that is, by a dynamic variable. Individuals tend to become more similar to the agents surrounding them and have a higher probability of moving away from dissimilar peers. We show that for certain values of the parameters the dynamics of the model yields the emergence of a metapopulation structure, i.e. physically segregated groups of individuals sharing similar opinions, that yet interact with each other through the exchange of agents.
Finally, we address more in detail the relation between the segregation in the physical and opinion spaces. We specify further the role of homophily by introducing a confirmation bias of the agents, i.e. a tendency to acquire or evaluate new information in a way that confirms one's current opinion and avoids contradiction with prior beliefs [20][21][22] . Following a consolidated line of modelling in the context of continuous-variable models [23][24][25] , we model confirmation bias as a bounded confidence between agents. This assumption reflects the idea that individuals will not interact with others whose opinion is too dissimilar from their own, and corresponds to a step-function description of the confirmation bias. The introduction of bounded confidence leads to the emergence of 'echo chambers' of agents that co-exist within the same group but do not influence each other, thus breaking the coupling between spatial segregation and polarization in the space of opinions.

Model Definition
The model is defined as follows. N individuals, initially randomly distributed in a square box of linear size L (corresponding to a density ρ = N/L 2 ), perform a random walk of fixed step length v ⋅ δt and interact with the agents they find within a certain distance d. For the rest of the paper, without loss of generality, we fix δt = 1. The position of agent i at time t is indicated as (x i (t), y i (t)).
Each individual i is characterized by a dynamical state variable s i (t) ∈ [0, 1] representing his opinion, whose initial value s i (0) is randomly extracted from a uniform and bounded distribution F(s) within the interval s ∈ [0, 1]. The s i variable is defined in an opinion space with periodic boundary conditions, so that the difference between two states s i and s j is always taken by modulo 1. Upon interaction, individuals modify their status seeking a local consensus with their neighbors. At each time t the status of each agent i, s i (t), is updated as , and K is the coupling constant regulating the strength of the social influence they experience. However, individuals may also change autonomously their status. At each time step t, each individual has a very small probability R to reset his status s i (t) to a new value, randomly extracted from the distribution F(s). The reset rate R introduces noise in the model and accounts for external factors or exogenous sources of information that can influence the opinion of the individuals.
Homophily is modeled through the probability that an individual will continue the interaction with his neighbors or not. If an individual shares a similar opinion with his neighbors he will probably remain with them, otherwise he will walk away. Thus, the walking probability p i (t) of the agent i at time t is proportional to the difference between his status s i (t) and the status of his most similar neighbor, where, as in Eq. (1), the difference between the states is taken modulo 1 to model an opinion space with periodic boundary conditions. Thus, each agent performs a step of length v in a random direction with probability p i (t) or maintains his position with probability 1 − p i (t). Isolated agents have a walking probability p i (t) = 1. Thus, heterogeneous groups are more fragile as individuals will tend to abandon them. Conversely, groups whose individuals experience a strong consensus will tend to persist in time with stable status and position.

Results
The model dynamics is fully characterized by four parameters: the collision rate p c , given by the product between the density ρ and the interaction area πd 2 , that is p c = πd 2 ρ, the velocity of agents v, the coupling constant K, and the reset rate R. The results presented here are obtained by numerical simulations of the model, see Methods.
Group formation. The microscopic rules described above introduce a positive feedback between mobility and opinion dynamics: Individuals can reach a local consensus based on proximity in the physical space, Eq. (1), and the achievement of a local consensus favors the persistence of that proximity, Eq. (2). As a consequence, in general the system reaches a quasi-stationary regime characterized by the presence of metastable groups of individuals. However, two events can alter the equilibrium of a group and change its composition and/or spatial properties, namely the arrival of a new individual and the spontaneous change of opinion by an agent. In the first case, either the newcomer's opinion is close to the group's local consensus and he will settle within the group with high probability, or he will leave, potentially having weakened the group by causing part of its members to shift their opinions -a scenario that may undermine or destroy the existing group. The second case is equivalent to the first, with the newly re-set agent that may remain in the group or leave it. This dynamic interplay between the processes Scientific RepoRts | 6:31834 | DOI: 10.1038/srep31834 of group formation and group fragmentation introduces a rich phenomenology which can be understood in light of two quantities: the average fraction of moving agents, 〈 N m 〉 , and the average size of the groups, 〈 S〉 , defined as where N m (t) is the number of isolated and moving agents at time t, N i (t) is the number of individuals forming group i at time t (see Methods), and G t ( ) is the set of groups at time t. Figure 1(A) shows the average fraction of moving agents 〈 N m 〉 and the average groups size 〈 S〉 as a function of the collision rate p c . For very small collision rates p c ≪ 1 the system is formed only by isolated agents and small groups, for very large collision rates p c ≫ 1 the network formed by the agents percolates, and a single group spans a finite fraction of the system, while for a large range of intermediate values of the collision rate  p 1 c a regime with several groups of different sizes and few isolated agents moving from one group to another emerges. This regime reveals the onset of a metapopulation structure which we further characterize in the next Section. The average number of moving agents 〈 N m 〉 is inversely proportional to the collision rate, The velocity of agents, v, appears to have a small effect on the number of moving agents 〈 N m 〉 but it is positively correlated with the average group size 〈 S〉 , large v values leading to significantly larger groups (Fig. 1B). Indeed, large values of v favor the mixing of the system, triggering a sort of rich-get-richer dynamics for the groups where the probability for a new individual to join a group is simply proportional to its size. On the contrary, small values of v promote the stability of existent groups, as the probability for a walking individual to re-join the group he just left is high.
The average fraction of moving agents 〈 N m 〉 and the average groups size 〈 S〉 show strong dependence on the strength of social influence K (Fig. 1C). The larger the value of K, the smaller the number of interactions required before a moving agent reaches a local consensus within some group, so the number of moving individuals 〈 N m 〉 Onset of metapopulation structures. The metapopulation regime is characterized by groups of individuals heterogeneously distributed in the physical and opinion spaces. At any time, some individuals leave and join groups, moving freely in the physical space. This regime emerges when the collision rate p c is large enough to allow groups formation and the interchange of individuals between groups, but smaller than the percolation threshold. The size of the groups, as well as the number of individuals moving between groups, are regulated by the strength of the social influence of the individuals, modeled by the coupling constant K, and the external influence represented by the reset rate R (see Fig. 1C,D).
The metapopulation regime is illustrated in Fig. 2, showing a snapshot of the model behavior for three different values of p c , modified by varying the density of agents (see also Movies S1 and S2). Agents not moving in a time window of 1,500 timesteps, i.e., forming stable groups over that observation time, are represented as filled circles. The value of agent status is color coded, illustrating how groups are formed by individuals sharing similar opinions. We note that as p c increases, the number of groups reduces and their size increases. At the same time, the difference in the opinions between the groups reduces, indicating that the system is approaching the regime where a unique group of individuals sharing the same opinion is formed. Panel B also shows the trajectories of two agents selected among those who have changed position at least once in the time observation window. They are representative of two distinct cases. One of them initially belonged to a group located in the right, bottom part of the physical space, then left the group and joined another one approximatively located in the center of the figure (trajectory depicted as a continuous line). The second individual left the group located in the center of the plane but eventually joined it again to remain within it for the rest of the observation (dashed line).
In literature, metapopulation structures are characterized by the connectivity matrix representing metapopulations as nodes of a graph, and defining which groups may exchange agents. In our system, the connectivity is the result of the dynamical self-organization of the system. Despite the fact that every link is possible, only some of them, depending on the system parameters, are statistically relevant. In particular, the typical scenario observed for low values of v/L is that agents leaving a group travel for a short distance before reaching the new group. The probability that this group is one of the closest (in a geographical sense) is high, yielding a group connectivity that can be modeled as a random geometric graph. On the other extreme, for high values of v/L, agents are allowed to reach potentially any other group starting from their own, thus we expect a connectivity pattern with an all-to-all coupling between the populations.
The characteristic timescale over which a metapopulation does not change its state depends on the reset rate R and on the coupling constant K. A large reset rate R implies a shorter lifetime for a group, while a large coupling strength K increases the resilience of a group to perturbations such as the spontaneous change of opinion by a This behavior is illustrated in Fig. 3(A), showing the number of stable groups in a given time window of length τ, indicated as 〈 N sg 〉 (see Methods), for selected values of the parameters ruling the model. As expected, 〈 N sg 〉 grows with p c until it reaches a maximum and then decreases as the system percolates into one or few groups. Therefore, the metapopulation regimes emerges for collision rates p c between the extreme scenarios of very small groups and system percolation. Figure 3(A) also shows how the average number of stable groups is affected by the coupling strength K and the reset rate R. Increasing K has an effect qualitatively similar to that obtained by a decrease of R (compare the curve for K = 0.05, R = 10 −4 with that for K = 0.01, R = 10 −5 ) as, in both cases, the formation of groups with few individuals is favored and a large number of stable groups appears even at low values of p c . Therefore, the strength of the social influence K and that of the external opinion sources R act as opposite forces on the group stability.
Our analysis also focused on the role of initial conditions. Does a single stable group segregate into several different subgroups under the dynamics driven by a nonzero reset rate R? Or rather do particularly homogeneous initial conditions guarantee asymptotic stability? To address this question we consider two different kinds of extreme initial conditions: (i) all the agents have the same position in the space, x i = y i = L/2, ∀ i, and (ii) all the agents have the same position in the space and the same status value, x i = y i = L/2, s i (0) = 0.5, ∀ i. Interestingly, the feedback between the dynamics in the physical space and the space of social consensus is enough to partition the population into different groups, well separated in both physical and opinion space, under both initial conditions, reaching a dynamical equilibrium indistinguishable from the one achieved with random initial conditions. Figure 3(B) shows the evolution in time of the average number of moving individuals, 〈 N m (t)〉 , and the average groups size, 〈 S(t)〉 , for random initial conditions, compared to initial conditions i) and ii). While initially the evolution of these quantities is different, in the large time limit,  T 10 6 , both 〈 N m (t)〉 and 〈 s(t)〉 converge to the values that do not depend on the initial conditions. The model is therefore robust to changes in the initial conditions of the population.
Emergence of echo chambers. In the previous Sections, homophily was implemented through the probability of motion p i (t) defined so as to favor repeated interactions between agents sharing similar opinions. In this Section, we enrich the picture and consider confirmation bias, i.e., the tendency to prefer and select information in a way that confirms one's beliefs or hypotheses, while giving less consideration to alternative possibilities 20 . We operationalize the confirmation bias through a parameter of bounded confidence, according to which individuals are influenced only by peers whose opinion is not too different from their own [23][24][25] . Thus, within this framework, homophily enters also in the definition of the interaction rule between individuals (1), as social influence between agents i and j now depends on the difference of opinions: Here, the parameter C ∈ [0, 1] tunes the strength of the confirmation bias. For C = 0 we recover Eq. (1) (note that, giving periodic boundary conditions, the status difference cannot be greater that 0.5), while increasing values of C represent a stronger bias, the larger C the more an individual is biased toward similar opinions, so that fewer individuals are able to influence him. In the limit C → 1 social influence vanishes since no agent is able to influence any other one. Figure 4(A) shows the average group size, 〈 S〉 , and the number of stable groups, 〈 N sg 〉 , as a function of C, showing that a stronger confirmation bias yields a larger number of stable groups, yet their size 〈 S〉 decrease with C. This behavior is common across different values of the parameters, such as the collision rate p c or the strength of the social influence K. For C → 1, the number of stable groups drops sharply, due to disappearance of the social influence effect. More importantly, Fig. 4(B) (see also Movie S3) shows that confirmation bias leads to the presence of groups where agents with heterogeneous opinions coexist, i.e. echo chambers of agents that ignore each other although being in spatial proximity and belonging to the same (spatially defined) group.
Finally, we address more in detail the close relation between the physical and opinion spaces in order to uncover the impact of the confirmation bias. In the original formulation of the model, the physical metapopulation structure is mirrored in the space of consensus as different groups in general experience a consensus on different opinions (see Fig. 2). The introduction of confirmation bias changes this scenario, allowing the presence of groups with individuals sharing different opinions (see Fig. 4(B)). This fact can be quantified by measuring the correlation between the Euclidean distance between two individuals i and j, d ij , and the difference between their status values, |s i − s j | mod1 , shown in Fig. 5. Without confirmation bias (for C = 0), for any choice of the other parameters the difference |s i − s j | mod1 is small and constant for d ij ≤ 1, i.e. within the radius of interaction. Then |s i − s j | mod1 grows with the distance and reaches a second plateau for large distances  d L ij , indicating that only individuals within the same group share the same opinion. The choice of the parameters impacts the level of consensus: larger values of the reset rate R or smaller values of the strength coupling K yield less consensus among the agents, and viceversa. The presence of confirmation bias lowers the degree of consensus within groups, leading to larger values of the difference |s i − s j | mod1 for small distances d ij . This is due to the fact that two or more echo  Fig. 2(b). Note the presence of groups formed by agents with very different opinions. chambers are formed within the same group, formed by agents with different opinions unable to influence each others. Increasing values of C make the difference |s i − s j | mod1 more insensitive with respect to the distance d ij , and in the limit C → 1 the opinion difference is independent of the physical distance.

Conclusions
This paper studied the interplay between mobility, homophily and social influence in the context of a simple model of opinion dynamics. The combination of these ingredients leads to the emergence of a metastable metapopulation structure in which groups of like-minded individuals spontaneously segregate in space, while single individuals constantly leave or join them. The emergence of the metapopulation regime crucially depends on the density of the agents, but it is not influenced by the initial conditions. The metapopulation structure is controlled, in terms of group sizes and stability, by the strength of the social influence, K, and the reset rate, R, at which the individuals spontaneously change their opinion. The feedback loop between mobility and social influence yields a strong assortativity between physical and opinion space: the closer two individuals are in space, the closer will be their opinions. This scenario is transformed by the introduction of confirmation bias. The fact that individuals can be influenced only by peers sharing similar opinions leads to the emergence of echo chambers where polarized opinions coexist within the same group.
The contributions of the model are threefold. First, it shows that spatial segregation can result from a dynamics involving agents seeking consensus on a non-quenched variable. Second, it provides a framework in which the metapopulation structure, often assumed in the modelling of social systems, emerges from the microscopic rules of the model itself. Third, it shows that confirmation bias yields the possibility that different opinions coexist within the same metapopulation.
We believe that our work opens interesting possibilities of future research. For example, it would be interesting to investigate the features leading to the observed fractal patterns of human space occupancy in archeological records 26,27 or present-day distribution of cities 28,29 . The study of the emergent network properties, such as the distribution of tie strength and its evolution in time, would be interesting with respect to the impact of such time-varying topology on spreading dynamics. At the same time, the emergence of metapopulation structures in which like-minded individuals are relatively isolated from the rest of the subpopulation is interesting also in light of the recently documented emergence of online echo chambers, in which misinformation spreads and persists [30][31][32] .

Methods
Dynamical equations of the model. The dynamical equations governing the evolution of the model are fully specified by the rules for the agent position and status updates, given by Eq. 2 and Eq. 5, respectively. At each time step, the agent position is updated as: . − To avoid spurious effects due to a transient state, we start to observe the system after a time T 0 = 10 3 , which turns out to be sufficient to reach the steady state under different conditions, and run simulation up to T end = T 0 + T, with T =