Public discourse and social network echo chambers driven by socio-cognitive biases

In recent years, social media has increasingly become an important platform for political campaigns, especially elections. It remains elusive how exactly public discourse is driven by the intricate interplay between individual socio-cognitive biases, dueling campaign efforts, and social media platforms. We examine this complex socio-political process by integrating observed retweet networks from the 2016 political networks with an agent-based model of political opinion formation and network structure. Here we show that the range of political viewpoints individuals are willing to consider is a key determinant in the formation of polarized networks and the emergence of echo chambers. We also find that winning majority support in public discourse is determined by both the effort exerted by campaigns and the relative ideological positioning of opposing campaigns. Our results demonstrate how public discourse and political polarization can be modeled as an interactive process of shifting individual opinions, evolving social networks, and political campaigns.


Introduction
People are more likely to accept claims that are coherent with their pre-existing beliefs [1]. Furthermore, people are more likely to seek out individuals with similar beliefs. These two mechanisms, confirmation bias and selective exposure [2,3], can generate polarized and homogeneous clusters of opinion, commonly referred to as echo chambers [4]. Echo chamber effects may stop individual from being exposed to information or opinions contrary to their extant beliefs, and further radicalize individuals with extreme beliefs [5]. Political polarization in the United States has increased markedly in recent decades [6]. While confirmation bias and selective exposure are not necessarily new phenomena, new digital environments have arisen that can accelerate and entrench the emergence of echo-chambers. Furthermore, political campaigns aim to strategically capitalize on these mechanisms and environments for their own benefit. Comprehensively understanding the emergence of echo-chambers and large-scale political polarization in the real world requires a model of collective decision making that integrates individual socio-cognitive biases, the digital ecologies and network structures that facilitate communication, and the strategic efforts of political campaigns.
Information consumption and diffusion has radically changed along with the rapid development of large-scale social networks [7,8]. News outlets are integrated with active online social networks, and can now spread information faster, wider and more effectively [9,10]. Furthermore, social network users are no longer just passive recipients of information, but can also create and distribute content, selectively disseminate information, and share their own opinions [11]. These changes have had a substantial impact on public discourse and opinion formation: individuals can easily find evidence that supports their existing ideas and follow those people who hold similar viewpoints, amplifying pre-existing socio-cognitive biases [12,13]. Recommendation algorithms further amplify these biases by predicting and delivering the content that individuals are most likely to consume [14,15].
The seemingly ubiquitous formation of echo chambers on social networks has aroused concern in several different fields [16,17,18]. Sociologists and political scientists are concerned that social polarization caused by politically motivated selective exposure threatens democracies [19]. Twitter data shows that political user groups are more likely to retweet users belonging to their own group while supporters of one party rarely interacts with rival party supporters [20,21]. The role of opinion-based confirmation bias in the diffusion of rumors and fake news has attracted the attention of network and data scientists [22,23,24,25], and several empirical studies have focused on social network users content consumption patterns in the age of misinformation [26,27,28,29,30]. Echo chamber effects can reinforce the diffusion of rumors and intensify the segregation of their believers [31].
While there is extensive empirical work documenting instances of echo chamber formation, and simulation-based work 1 Figure 1: Evolving echo-chambers in core retweet networks. The progression of echo-chamber formation in retweet networks during time frames surrounding (A) the first 2016 U.S. Presidential Debate (B) the 2016 U.S. Vice Presidential Debate. In each subfigure, the nodes represent users, node colors show the nodes cluster, the edges indicate retweets, and node size and color intensity reflect a nodes retweet volume. In (A), the red nodes indicate individuals who tend to support Donald Trump while blue ones Hillary Clinton supporters. The yellow cluster shows users who are mainly retweeting unaligned users or supporters of both sides. The dataset begins at 17 : 45 on September 26 th , and the final graph includes 54840 edges and 25375 nodes. In (B), the networks are divided into two polarized echo-chambers: the red cluster shows Mike Pence (Trumps VP) supporters and the blue cluster shows Tim Kaine (Clintons VP) supporters. Unlike the first presidential debate, there is not a cluster of undecided supporters, despite both graphs being roughly the same size in terms of nodes and edges. The dataset begins at 15 : 40 on October 4 th , 2016 and the final graph includes 55008 edges and 24811 nodes. that demonstrates the mechanisms sufficient for polarization, few attempts have been made to directly integrate observed instances of polarization with proposed generative mechanisms [32,33]. To this end, we develop an agent-based model which explicitly incorporates socio-cognitive biases and network structure to understand the formation of echo chambers and their influence on the public discourse, and then use this model to estimate the causes of empirically observed instances of polarization. First, we demonstrate the evolution of echo chambers in Twitter retweet networks around the time of a series of major political events (Debates between Candidates in the 2016 U.S. Presidential Elections) [34]. We then show that our proposed model of polarization successfully reproduces the observed clustering phenomena. This result suggests that the emergent polarized and segregated network structures are largely a function of the ideological difference between campaigns, and the extent to which individuals are open to considering alternative viewpoints (open-mindedness). We then quantify and explore how confirmation and selection bias known generators of echo chambers [31,35], influence the coevolution of political opinions and network structure. We also find that the success of political campaigns is determined no by relative campaign effort (whose voice is louder) and more subtly by the divergence of ideological positioning between opposing campaigns. Finally, we conduct model-data integration of our proposed model and the observed dynamics of the 2016 US presidential election. Our mechanistic model reproduces the evolution of collective political opinion as measured via Twitter discourse data, providing profound insights into the 2016 campaign. Taken together, our findings demonstrate how shifts in collective opinion can be understood as a function of interacting individual-level cognitive processes, online network structure, and political campaigns. More importantly, these findings suggest potential ways to address political polarization at both the individual and population level, as well as related problems that stem from the social diffusion of information and disinformation.

Results
To illustrate the evolution of echo-chambers over time, we display the core Twitter retweet networks during time windows surrounding two highly visible political events in Fig. 1: the first U.S. Presidential Debate in 2016 between Hilary Clinton and Donald Trump, and the lone Vice-Presidential Debate between Tim Kaine and Michael Pence (see Materials and Methods and Fig. S1 for data processing details). During the first Figure 2: Modeling emergence of echo chambers. The relationship between the degree of ideological segregation and population identity largely influence the nature and outcome of public discourse. Shifts in identity scope are alone sufficient to drastically change the (A) breakdown of candidate support and (B) the distribution of ties between and within supporter groups. The stable network structures of simulations corresponding to three different identity scope values (C to E) show how open-mindedness effects the emergence of echo-chambers. Parameters: campaign effort Ω T = 0.5, position of viewpoint Blue θ 1 = 0.2, position of viewpoint Red θ 2 = 0.7, influence of candidate µ 1 = 0.5, influence of discussion partner µ 2 = 0.5. All simulations begin from an ER graph, the simulations for figures A and B have network size N = 10 4 , and average degree k = 6. Simulation results are averaged over 100 independent runs. In the simulations that generate figures C, D, and E, N = 10 3 and k = 6.
US Presidential Debate Twitter users form three distinct clusters: one supporting Clinton (blue), one Trump (red), and a third cluster of seemingly undecided users in the middle (yellow) (Fig. 1A). The middle cluster becomes relatively smaller over time as a higher percentage of users becomes absorbed in the two extremal clusters. The twitter snapshots surrounding the vice-presidential debate 11 days later reflect an even more polarized electorate (Fig. 1B). There are only two main clusters of supporters, one for Kaine (Clintons VP candidate) and one for Pence (Trumps VP candidate), that become more distinct and polarized over time.

Agent-based model of public discourse and echochamber formation
We now introduce an agent-based model that can reproduce the patterns of dynamic polarization observed in the core-retweet networks (see Fig. S2 for model parameters), while accounting for the relative effort and position of competing political campaigns. Consider a network G with N users. While several different opinions may be expressed by political and media elites, we assume without loss of generality that there are two: viewpoint Blue (θ 1 ) and viewpoint Red (θ 2 ), that each reflect the viewpoint of two opposing political campaigns. Each point exists on ideological spectrum that stretches from 0 to 1 (θ i ∈ [0, 1]), and δ 0 = |θ 1 − θ 2 | indicates the degree of ideological separation between the two viewpoints. Each agent, i, has an initial belief w i ∈ [0, 1], that is distributed with uniform probability, and each agent begins as undecided in the race between candidate blue and candidate red. At each time step, an individual will consider updating their support to one of the two candidates, with a probability that reflects the relative effort exerted by each campaign (Ω T ). Their likelihood of accepting updates to their beliefs will depend on their open-mindedness (δ 1 ), a constant for all individuals in the model, and the proximity of the candidates ideology to the individual supporters current ideology. Individuals are also connected to others in the population. If a selected agent does not accept a candidate, they will have a conversation with one of their connections and update their beliefs if their connection is ideologically close, and update their connection if the connection is ideologically distant.
Specifically, the model goes through the following steps at each time step, T : 1. An agent, i, is randomly selected. 2. Agent i considers updating to either θ 1 or θ 2 with probability Ω T and 1 − Ω T respectively. 3. Assume θ 1 is selected. One of three possible interactions occur: a. (Support candidate) If |w i − θ 1 | < δ 1 , then i becomes a Blue supporter. i also becomes more ideologically similar to their new candidate, and w i is updated tow i beliefs in accordance with a feedback parameter (candidate influence), µ 1 : b. (Discuss with friend) If |w i − θ 1 | ≥ δ 1 , then agent i turns has an ideological conversation with j. If |w i − w j | < δ 1 , i is persuaded by j and updates their beliefs in accordance with a homogeneity parameter (peer influence), µ 2 : c. (Find new friend) If |w i − θ 1 | ≥ δ 1 and |w i − w j | ≥ δ 1 for the chosen candidate and social connection, then i rewires their tie with connection j to another tie, k, where |w i − w k | < δ 1 . 4. Repeat step 1 to 3 until all agents update once.
The model then updates to timestep T + 1, which continues when the beliefs of individual agents have all stabilized, or when the system as a whole reaches a dynamic equilibrium, which occurs when individuals collectively oscillate between supporting different candidates at a constant rate (e.g., Fig. 2E).
This model synthesizes the socio-cognitive biases of the individuals, the evolving structure of the social network, and the relative effort and ideological positions of campaigns. As we shift these parameters from simulation to simulation, we can look at the effect that these interacting mechanisms have on the emergence of distinct ideological clusters (echo-chambers). Of particular interest is how open-mindedness can influence this formation of echo-chambers. On one hand, a population of agreeable people may be particularly prone to the influence of candidates, but a population of closed-minded people may rewire and only listen to those around them. Fig. 2 illustrates how the emergence of echo-chambers is fundamentally related to the open-mindedness of individual voters. In this series of agent-based models, we hold the two viewpoints of candidates constant (θ 1 = 0.2, θ 2 = 0.7), and that campaign efforts exercise equal effort (Ω T = 0.5). Candidates and connections both have intermediate levels of influence on individual agents (µ 1 = 0.5, µ 2 = 0.5). As the open-mindedness (or identity scope) of individual agents in the population becomes larger, the tendency for clusters and for candidates to support changes. There are two phase shifts that occur at 0.19, and 0.43 in this series of models. At low values (δ 1 < 0.19), individuals tend to form smaller distinct ideological clusters, but these clusters may not all align around a candidate. In the case presented there is only one such cluster, but we can imagine more clusters emerging if more ideological space existed between the two candidates. The stubbornness of individuals protects them from the influence of centralized sources of influence (campaigns), allowing the formation of independent echo chambers. At medium values (0.19 < δ 1 < 0.43) of open-mindedness, all individuals congeal around one of the two candidates, and seek out connections with like-minded people. Each echo-chamber corresponds to a centralized campaign message that individuals will go to correctly, or eventually be dragged into by their increasingly homophilous social networks. Individuals are polarized because they are just open enough to social influence for polarization to occur. As openmindedness becomes high δ 1 > 0.43), however, the population forms one giant cluster. Individuals are willing to consider a wide range of political messages, and initial ideology has a much weaker correlation with the ideology of the candidate that each individual chooses. In these environments, it would be expected that the relative efforts of the campaigns would be very important, as most individuals are open to most options. Individuals in this situation will not rewire their ties, and most political influence will happen between individuals and candidates. (The complete evolutions of these three network topologies can be found in the Movies S1-S3.)

Peer and candidate influence and ideological alignment
We now turn out attention to how different sources of social influence interact to create echo-chambers or preserve ideological diversity (Fig. 3). In our model there are two parameters that govern social influence processes and the belief shifts of individuals: µ 1 is the extent to which individual beliefs align with those of their selected candidate, µ 2 is the extent to which individual beliefs align with those of their trusted discussion partners. We would expect high levels of µ 1 to correspond with convergence around candidate viewpoints, and high levels of µ 2 to lead to decentralized and emergent convergence around more arbitrary viewpoints. Intuitively, we would expect that high levels of either or both would lead to echo-chambers and ideological homogeneity.
The results of the model are less intuitive. The emergence of echo-chambers and alignment with political candidates tends to be highest for moderate levels of peer influence, and low levels of candidate influence ( Fig. 3A and B). Very high levels of candidate influence will turn all supporters into extremists, and leave candidate supporters beyond the ideological scope of their undecided peers (Fig. 3C, E and Fig. S4 A-C). Low levels Figure 3: Confirmation bias and attitude evolution. (A to B) Generally, moderate discussion partner influence and weak candidate influence lead to larger echo-chambers (here a significantly higher proportion of Red Supporters) and a lower proportion of undecided individuals. (C) Strong levels of candidate influence may increase the belief distance between supporters and undecided people and accelerate the opinion polarizing process, which hinders sufficient social discourse and results in smaller echo chambers around candidates. (D) When candidate influence is fixed, moderate levels of discussion partner influence promote more social discourse, which reduces the size of the undecided population and effectively prevents the formation of small clusters that hold extreme opinions (also see F). (E to F) Distribution of individual beliefs in steady states, corresponding to the various situations in (C) and (D). Parameters: all simulations begin from an ER graph with N = 10 4 , k = 6 and Ω T = 0.5, θ 1 = 0.2, θ 2 = 0.7, population open-mindedness δ 1 = 0.18. In addition, (C) µ 2 = 0.5, (D) µ 1 = 0.5. Simulation results are averaged over 100 independent runs.
of both forms of influence will similarly leave individuals outside the scope of candidates stuck in an undecided part of the ideological spectrum. Extremely high levels of peer influence may similarly leave certain people behind if their peers congeal around viewpoints too quickly. What seems to be most conducive to echo-chamber formation is a moderate process of peer-influence than pulls people into camps slowly without leaving behind undecided stragglers, perhaps guided by very slight top-down influence from candidates (see the phase re- Fig. 3A). High levels of social influence in a population where people are reluctant to hearing different beliefs can create many different ideological islands that people will be stuck on, but may prevent the emergence of two dominant and opposing opinions (Fig. 3D, F and Fig. S4 D-E).

The ideological positions and efforts of political campaigns
In the presence of social dynamics that lead to the formation of echo-chambers, it may also be logical for political candidates may take on positions that are more extreme than is predicted by standard median-voter models of political competition [37,38]. Given a fixed level of the identity scope of individual voters, peer influence, and candidate influence, candidates may be incentivized to take on viewpoints that are more opposed to one another, as opposed to converging around the median. In Fig. 4A-C, we can see that the best response of a candidate is not to simply position themselves immediately to the side of their opponent that is closer to the median, but rather to stake out a position that is positioned in a large gap between their opponent and an end of the political spectrum. Vote share by viewpoint for different candidates in different scenarios are displayed in Figures 4D-4F, we see that Reds best response to a Blue viewpoint of 0.2 is around 0.68 (Fig. 4A), Blues best response to a Red viewpoint of 0.7 is around 0.3 (Fig. 4E), and that given a fixed viewpoint distance between Red and Blue of 0.4, both candidates maximize proportion of their support by aligning symmetrically around the median (0.5) and selecting viewpoints of 0.3 and 0.7.
We also study the influence of campaign effort on winning majority support (Fig. 5). The importance of campaign effort in our model is largely dependent on the ratio of the identity scope (δ 1 ) of individuals to the spread of the candidate positions (δ 0 ). We denote this value as ρ = δ 1 /δ 0 . When ρ = 1/2, by definition there are no voters between the two candidates who could possibly avoid the influence of either candidate, but in the absence of peer influence each will fall in line with the candidate who is closest to them. (Fig. 5) shows how campaign effort varies in effectiveness as a function of ρ. As ρ goes from 0 to 1/2, the effects of relative campaign efforts may be trivial in the absence of large differences (Fig. 5A, B). For levels of ρ slightly lower than 1/2, excessive campaigning may even be counter-productive if campaigns accidentally pull-in potential supporters too quickly, leaving undecideds more vulnerable to their opponent (Fig. 5C). As ρ goes from 1/2 to 1, however, the number of voters who could support either candidate increases, increasing the importance of campaign efforts (Fig. 5D, E). We also see across all models that there are much higher numbers of undecideds if campaign efforts are lopsided, as the message of one candidate is effectively drowned out by their opponent.
Taken together, our results show that the social conditions that lead to echo-chambers can create political incentives that oppose our common-sense notions of how to win an election. Campaigns no longer benefit from converging to the center, as the median voter theorem predicts. Furthermore, in certain cases where candidates are not too far together or too far apart ideologically, campaign efforts can be counter-productive, as they may polarize individuals that would otherwise be useful in winning over moderates and undecideds. This is an important insight, especially given the relative spending and outcome of the 2016 U.S. Presidential Election.

Model-data integration of opinion evolution in the 2016 US presidential election
Finally, we integrate our model with data from the 2016 U.S. Presidential Campaign (Fig. 6). As the campaign unfolds, data from Twitter shows that network polarization increases as echochambers absorb undecided voters over time (Fig. 6A). Looking at the trajectories of individual Twitter users retweet patterns (Fig. 6B), we see that most individuals who initially supported Clinton or Trump remained fairly constant over time, with Donald Trump winning over many undecideds between the second and third debates.. Using the proposed model in tandem with observed data, we can estimate the ideological position of both candidates, the population identity scope, as well as how the relative efforts and efficacy of each campaign shifted in the last few months of the U.S. Presidential campaign, while holding levels of con-firmation bias within voters constant. Fig. 6C shows how our agent-based model of opinion evolution aligned with shifting levels of support for Clinton and Trump during the 2016 campaign. We assume that the ideological viewpoints of both campaigns (θ 1 , θ 2 ) as well as the population identity scope (δ 1 ) are unchanged throughout the campaign. Simulations start from an Erdos-Renyi graph with N = 10 4 and k = 4.5, which replicates the size and degree distribution of the observed retweet data. We set a moderate level of population confirmation bias (µ 1 = µ 2 = 0.5). We then find a group of best fitting parameters for the ideological polarization of the candidates and the level of campaign effort at each of the time steps (θ 1 = 0.32, θ 2 = 0.7, δ 1 = 0.32, Ω 1 = Ω 2 = 0.5, Ω 3 = 0.8, Ω 4 = 0.4, Ω 5 = 0.1) using least squares minimization with a simulated annealing algorithm (see Materials and Methods).
These results reveal just how dynamic and unpredictable the final phases of the 2016 U.S. Presidential Campaign were, with Clinton and Trump rapidly trading advantages in relative campaigns. Both candidates had ideological positions that were estimated to be a moderate distance from the median of 0.5, with the Clinton campaign being slightly closer (θ 1 = 0.32, θ 2 = 0.7). Furthermore, the large estimated identity scope of Figure 5: Impact of campaign effort on winning majority support. (A to E) As the relative attraction of the viewpoints (defined as identity scope divided by candidate spread) in campaign competition increases (ρ = 0.257, 0.3, 0.36, 0.56, 0.76, respectively), the relative efforts of campaigns become more important. In some cases, the effects of campaign effort become counterproductive (see (C)). Parameters: all simulations begin form an ER graph with N = 10 4 , k = 6 and µ 1 = µ 2 = 0.5. Simulation results are averaged over 100 independent runs.
0.32 places a large proportion of voters within ideological reach of both campaigns. The model also shows wide swings in the relative effort of both campaign, reflecting a campaign where high levels of spending and social media outreach, news reports, and debate performances could rapidly change each candidates appeal to undecided voters.
The observed data also shows that a small fraction of individuals may have switched camps during the election (Fig.  6B). Fig. 6D illustrates how this process could occur within our proposed model a "blue supporter with neutral beliefs that are within reach of both camps (left side of Fig. 6D), may be directly persuaded by the "red campaign (Fig. 6D(1)). Or, a supporter with "blue beliefs may interact with a "red neighbor and be brought to a spot within reach of the red campaign ( Fig.  6D(2)). Overall, this is an example of how open-mindedness can increase the importance of campaign efforts. While polarization and voter stubbornness in the face of new information is detested in modern politics, in these examples it makes individ-uals immune from falling under the influence of high-spending campaigns.

Discussion
Several empirical studies from large-scale social networks have provided valuable insights into the emergence of echo chambers. However, comprehensive analysis of collective opinion dynamics requires simultaneous consideration of top-down campaign level decisions, the network structure of political communication, interpersonal influence dynamics, and individual cognitive biases. Our analysis offers a theoretically driven agent-based model that can estimate and account for the effect of these mechanisms using real-world data.
Interactions between human behavior and social systems are often non-linear and complex, and the aggregate consequences of small changes in individual behavior can be counterintuitive. The model we present here is no exception. A surprising insight is that bipartisan echo-chambers may result from moderate levels of open-mindedness, where people are susceptible to slightly different beliefs but not overwhelmingly different beliefs, as opposed to extreme closed-mindedness (which preserves ideological diversity) or extreme open-mindedness (which brings everyone together somewhere in the middle). This is an inherently uncomfortable finding. The idea of voters being ideologically flexible in the face of new facts and opinions and arguments, while still maintaining a set of core principles, sounds virtuous and essential to a functioning democracy. Yet this 'bend but dont break style of opinion updating may be the very thing that leads to polarization. A purely stubborn or conforming population may both be less susceptible to the emergence of two dominant and opposing echo-chambers.
While the formation of echo-chambers and the issue of political polarization is the primary focus of our model, our results also have practical implications for political campaign strategy. Our findings suggest a potential downside to aggressive campaigning from persuasive but extreme candidates: supporters may become too radical for their relatively moderate friends. In some cases, campaigns and candidates may be better off by being less persuasive, as this gives their supporters ideological room to make their candidates case in everyday discourse. Candidates with relatively extremal positions may do well by instead adopting a "big tent strategy where they win supporters without persuading them to change their ideological stance. In the age of social media, political strategists may need to think more about the order in which theyre targeting people, and their commitment to ideological positions. While "firing up the base may be important early on for gathering donations, it may also create a rift between supporters and potential converts. Preaching to the choir may make it difficult to fill up the pews.
Social division along political lines has aroused great concern since the 2016 US presidential election [9,40,41]. But the emergence of echo-chambers is not confined to elections. In the age of "fake news, determining the truth in everyday affairs has also become a collective decision-making process prone to interacting cognitive biases and social influence dynamics. The spread of misinformation on social networks threatens the foundations of democracy and often disrupts everyday (2) switch via multiple updates, a voter is not persuaded by the candidate initially, but instead talks to a discussion partner within their range who is a red-supporter, and then updates their beliefs. In the next time step the voter is reached by the red campaign again, and is close enough to the red candidate to be persuaded.
life [42,43,44]. The insights generated from our model suggest not only several techniques for inhibiting the emergence of echo-chambers, but also for how to develop more effective messaging strategies for import public health issues, such as the importance of vaccinations or the potential dangers of vaping. In these cases, the public has a strong interest in generating a single echo-chamber inhabited by the right idea. Our models suggest that this would be best accomplished through moderate messaging that gradually pulls individuals with extreme antivaccine or pro-vaping beliefs closer to the mainstream, as opposed to stronger messaging that may convert moderate skeptics but leave extremists isolated in a smaller echo-chamber. Ultimately, what turns a set of like-minded individuals into an ideological bubble is the disappearance of other people who can come in and change their mind.

Materials and Methods
Twitter data processing All original Twitter datasets are publicly available at https://www.docnow.io/catalog. The raw twitter data are not allowed to be shared online according to Twitter's terms of service, therefore all the datasets are Twitter IDs. We first download the tweets using Twitter's API and obtain user ID (nodes), retweeting relationship (edges) and the timestamp from each tweet. Computational constraints prevents us from plotting the whole network, so we use a random sample to obtain 10-20% data of the original datasets for the first, second and third debate, and then focus on the largest connected component (which contains over 90% of nodes). Layouts are constructed using the Force Atlas 2 algorithm in Gephi. Nodes are weighted by the number of times they are retweeted. To capture the core structural characteristics of opinion evolution without losing any information, we record all nodes weights and get rid of pure followers who are not being retweeted (in-degree equals to 0) and only retweet others once (out-degree equals to 1). This leads to a more simplified retweet network with weighted nodes (Fig. S1). This simplification takes out about half of all edges and improves the precision of the community analysis. The retweet networks in Fig. 6A include 54840 edges and 25375 nodes for the first debate, 81055 edges and 33995 nodes for the second debate, and 58354 edges and 26219 nodes for the third debate. Finally, the weighted supporter estimates for each camp (or the supporter strength observed on social networks) can be approximately calculated by simply summing the weight of all nodes within each echo chamber. The sample datasets we use in this paper and the data processing codes (written in Python 3) can be obtained at https://github.com/fufeng/Public-discourseand-social-network-echo-chambers.
All the network figures in this paper use the Force Atlas 2 layout algorithm from Gephi [45]. The color for each node is calculated using the Louvain Algorithm for community detection [46].
We stress that our main focus is to understand how public opinion evolves through individual decision-making processes and socio-cognitive biases using agent-based models. Small inaccuracies in the true proportions of candidate supporters that are caused by random sampling and the community detection algorithm are unavoidable but tolerable for our purposes.

Data fitting method
Within the time-scope of a single event, such as the 2016 US presidential election, we assume that the inherent psychological and cognitive properties (i.e., the identity scope and the effect of discussion partner and candidate influence) of Twitter users would not change by a discernable amount. Therefore, we aimed to find a static set of values for θ 1 , θ 2 , δ 1 , µ 1 , µ 2 with a changing group of Ω T that can best mimic the evolution of the campaign. The simulation results of four successive time steps (from T = 2 to T = 5) are expected to reproduce the real data. To reduce the computational complexity of the fitting procedure we fix a moderate degree of candidate influence and discussion partner influence and set µ 1 = µ 2 = 0.5. Other parameters are constrained as follows: and Ω T ∈ [0, 1], T ∈ {1, 2, 3, 4, 5}. The step length for θ 1 , θ 2 and δ 1 is 0.02 while the step length for Ω T is 0.1. We take the average value of 100 times simulations as the final results for each group of parameters. We develop a simple simulated annealing (SA) algorithm with least squares minimization to find the best fit of real data, which is as follows: 1. Initialization and definitions. Define S = {θ 1 , θ 2 , µ 1 , Ω T } as the set of all possible combinations of parameters. According the descriptions of parameter range and step length above, S is a finite set. Denote R as the eightdimensional vector of real data (containing the proportions of supporters for two candidates before debate and during the first, second and third debates). Initially, the iteration counter i = 0 and an initial state is set S 0 ∈ S. In addition, we select a starting temperature T 0 and a freezing threshold T min with a cooling rate r. At time step i, S i is the current state and T i is the cooling schedule. Based on the least squares minimization, we define the cost function f (S i ) = 1 N · Aver−R 2 σ 2 , where N = 8 is the dimension of R, Aver is the average result (also a eight-dimensional vector) of 100 simulations for state S i , Aver − R is the Euclidean distance of vector Aver and R, and σ = 1% is a precision control coefficient for the global fitting.
2. The SA methods. For time step i + 1, a new stateS is randomly generated from S − {S i }, and the Markov chain of the state vector S i is determined by the followings: The algorithm allows prior information and can be recy-cled by setting S 0 as the best group of parameters that we have already found. The C++ code for this simulated annealing algorithm along with our dynamic model is available at https://github.com/fufeng/Public-discourse-and-socialnetwork-echo-chambers.

Supplementary Materials
Supplementary Text Figs. S1-S9 Movies S1-S3: time evolutions of the three network topologies shown in Fig. 2C-E.
To sum up, now each node has four possible interactions within one updating round: the node becomes S state and receives positive feedback from the viewpoint it supports; the node is advised by a friend who supports the viewpoint and its belief becomes closer to that viewpoint; the node finds that it holds similar opinions with its friend and does not make any change; or the node chooses to rewire (see schematic in Fig.   S5B). The evolution moves to the next time step T + 1 when all notes update once.
The dynamical processes stop when the system becomes steady. As can be seen in Fig. S5 Overall, Model 2 has three general similarities with the original model. First, in both models there are three phases of echo chamber emergence as a function of identity scope: many clusters, two clusters, and one cluster (Fig. S6). Second, in both models candidates can optimize their support by optimally countering the ideological viewpoint of their opponent (Fig. S8). Finally, too much or too little campaign effort can leave certain individuals undecided (Fig. S9).
There are, however, some important differences of note. First and most importantly, Model 2 is more prone to extremist clusters of individuals who fall outside the identity scope of either candidate ( Fig. S6C and F). From this we can conclude that peer influence, which is missing from Model 2, inhibits the formation of small extremist clusters (and possibly clusters nested between the two alternatives, if the identity scope is small enough). Second, levels of candidate influence (µ 1 ) non-monotonically shapes proportions of supporters (Fig. S7). When candidate influence is low, individuals are largely unmoved by candidates, but when candidate influence is too strong it hinders the sufficient social discussion. Finally, we notice that the simulation results of Model 2 are much smoother in all figures, which is explained by the determinism of the model in the absence of peer influence.
In conclusion, comparing the results of Model 2 with findings from the main text shows that the stochasticity introduced by peer influence, while making things more unpredictable, also prevents the formation of small clusters of extremists. Both models are informative, and each may correspond to some situations and 2 environments better than others. For example, in a society with lots of top-down political discussion from debates on networks and political advertisements, the positions of candidates may be more important and Model 2 may be appropriate. Whereas a culture with a culture of decentralized political discussion may be better reflected by the model in the main text. An exploration of the two-dimensional (top-down and peer-to-peer) space of political influence may be fertile ground for future research. Figure S1: Data processing method of retweet networks. Define the weight of each node as the total number of times it is retweeted. In the largest connected component, we get rid of those "pure followers" who are not being retweeted (in-degree equals to 0) and only retweet others once (out-degree equals to 1) and plot the remaining retweet network with all nodes' weights recorded. The simplified retweet network has all the important information and better represents the core structural characters.    The (A) breakdown of candidate support and (B) the distribution of ties between and within supporter groups indicate three possible opinion formation outcomes. The corresponding stable network structures and individual belief evolutions are present in (C to E) and (F to H), respectively. Of particular interest, the "extremist" clusters are more likely to form and their beliefs will rarely change during the whole evolution processes (C and F). Parameters: Ω T = 0.5, θ 1 = 0.2, θ 2 = 0.7, µ 1 = 0.5. All evolutions begin from an ER graph with (A to B) N = 10 4 , k = 6. Simulation results are averaged over 100 independent runs. In (C to H), N = 10 3 and k = 6. 9 Figure S7: Candidate influence and attitude evolution in Model 2. We show how candidate influence without the influence of discussion partners, which is described by solely µ 1 , influences opinion formation. All simulation begins from an ER graph with N = 10 4 with k = 6. Simulation results are averaged over