{'fraction_non_alphanumeric': 0.02936630602782071, 'fraction_numerical': 0.012083743150203738, 'mean_word_length': 4.805328983143013, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Identifying opinion-based groups from survey data: a bipartite network approach

A survey can be represented by a bipartite network as it has two types of nodes, participants and items in which participants can only interact with items. We introduce an agreement threshold to take a minimal projection of the participants linked by shared responses in order to identify opinion-based groups. We show that in American National Election Studies-data, this can identify polarisation along political attitudes. We also take a projection of attitudes that are linked by how participants respond to them. This can be used to show which attitudes are commonly held together in different countries or communities.


I. INTRODUCTION
The concept of opinion-based groups is a relatively new and important development for our understanding of intergroup relations and polarisation from a social-identity perspective [1,2]. Opinion-based identification can exacerbate social problems or solve them. For example, addressing urgent collective issues such as the climate emergency or a global pandemic requires widespread solidarity. Solidarity requires the coordination of core opinions (e.g. agreement that climate change is occurring).
Opinion-based group identification is particularly likely to inspire collective behaviour, because coordination of opinions is an important step towards collective agency [2,3]. However, even in the face of overwhelming evidence, these core opinions often become the focus of partisan alignment where different "sides" of the issue become incorporated into partisan group identities [4][5][6]. Once opinions are absorbed into partisan identities it becomes difficult to achieve the broad consensus required for decisive democratic responses.
Opinion-based identification is an important feature of online interaction, and groups formed around shared opinions can emerge rapidly though online social media interactions [7]. While geographical proximity or shared experience have historically been drivers of interaction and identification, users of social media transcend these. Instead, interactions often centre around shared (or disputed) interests and attitudes, and these become the basis for perceived similarity and difference [8].
Even offline groups form based on shared opinions through general process such as homophily-that we tend to associate with those similar to ourselves [9]and the need for group differentiation [10]. However, these processes are amplified in online interaction. First, the affordances of online media platforms are oriented to opinion-sharing. Online interaction frequently centres around "liking," "upvoting/downvoting," "retweeting," and other forms of interaction related to attitude sharing and evaluation. Second, the personalisation of information flow on social media has lead to the emergence of filter bubbles or echo chambers that reinforce opinionbased differentiation [11].
Social networks record traces of interaction and information flow. However, people can interact without ever influencing each-other [12]. Conversely, groups of people in close agreement can influence society without ever interacting, for example when voting in elections. We refer to the network of agreements and disagreements between people on a field of attitudes as a homophily network.
In traditional opinion-dynamics models (for example [13]), the homophily network can be even more influential on outcomes than the social network [14]. In online interactions, it is often the case that people have little influence over each-other if they perceive themselves to be on different "sides." Instead, interaction in these circumstances may even drive opinions further apart [12]. So while the homophily network does not tell us much about actual interaction, it can reveal a great deal about the structure of social groups and likely paths of social influence [15][16][17].
Several methods exist for visualizing the social structure and belief systems, conceived as an inter-related network of opinions and values [18,19]. These approaches are invaluable for mapping the opinion-space of a society and identifying how opinions are tied together in a network of inter-related beliefs. However, our interest is particularly in the structure of social groups and groupidentities afforded by the opinion space. We want to analyse the way people are bound together or divided by opinions as well as how opinions are tied together.
In the social sciences the most common way of measuring attitudes is through the use of surveys. Survey data is therefore generally more available and easier to obtain than accessing data from closed online platforms. Most usefully, survey data is coded (by participants) at the point of collection, typically by rating a series of statements (or questions) on ordinal scales [20].
In this paper, we build on earlier proposals that survey data can be treated as a bipartite network [15,21]. This enables researchers to capture what Breiger calls the "duality" of the opinion space which contains, simultaneously, clusters of individuals who share similar arXiv:2012.11392v1 [cs.SI] 17 Dec 2020 opinions and clusters of opinions shared by similar individuals. This can be done by taking projections from the bipartite graph of the survey. The groups of participants identified by shared responses can be used to show polarisation in some situations and the attitudes that make up their group identity can be easily viewed. There are many methods for taking projections from bipartite networks, for example [22], here we introduce an agreement threshold to form the groups and reduce the density.
There are other methods for connecting shared attitudes or belief systems eg. [19,23]. These methods tend to use models from statistical physics resulting in partial correlations between shared attitudes, these are then cut-off below a certain correlation and the graphs are displayed. It can, however, be challenging to interpret what an edge between two items represents or how to decide to threshold the model. There are often many parameters involved in these decisions. Using the method presented in this paper, the initial visualisations are parameter-free and the projections have a single parameter -the agreement threshold. This can initially be set to establish a giant component connecting the majority of participants. This is essentially the backbone of the participant network, lowering this threshold then allows further agreement between participants.

II. METHODS
As a survey consists of a group of participants responding to a number of items, it is, by definition, a bipartite graph (i.e. it has two types of nodes where nodes of one type may only interact with nodes of another type). The responses to an item are generally given on a scale (e.g. a Likert-type scale). The value associated with this can be assigned as a property of each edge (similar to a weight). The idea of representing this kind of data as a bipartite graph is not new, for example this has previously been done linking senators in the US Supreme court to the motions they voted on and linking Netflix users to media they liked or disliked [22,24,25]. Here and in the following sections we take secondary survey data, and display some of their bipartite graphs and corresponding projections.
The Wellcome Global Monitor 2018 surveyed almost 150,000 people on attitudes towards science and vaccines in 149 countries [26]. In fig. 1, we show the bipartite graphs for almost one thousand respondants in France and Bangladesh, two countries identified in the report [26] as having differing attitudes towards vaccines. The survey consists of 13 items, 10 having a four-point scales and the three vaccine questions have five-point scales. In fig. 1  While these visualisations alone do not tell us too much, we can easily see that many participants in Bangladesh respond positively to all items except Traditional Healers, in France there is significant distrust of the Government as well as some distrust towards Journalists. There are also more neutral responses to the vaccine questions compared to Bangladesh. It is worth pointing out, that at this stage we have lost no information and have done no filtering.

A. Projections
We next take projections of the bipartite graph to connect attitudes linked by being co-held by participants, and linking participants with a high agreement on items.
The projections of each of these can be done in different ways. For example, the easiest method is to give a weight to the edge between each participant based on the number of items they give the same response to. That way, an edge with weight 1 between two participants means they answered the same on just one item, whereas, for example, an edge of 12 means they answered the same in 12 of the 13 items. A projected network can be built up by adding edges of highest weight until a giant component (a large subset of nodes where a path can be made between any pair within the component) is formed (this is like the "backbone" of the network, a similar method for constructing a network is found in [27]). Once a giant component is formed, the process can be stopped. Therefore we introduce the one and only parameter, the agreement threshold, to reach a giant component.
This type of participant projection method is shown in fig. 2 for France (blue nodes) and Bangladesh (green nodes). For the French participants, a giant component (capturing 70.5% of the nodes) is formed at an agreement of 11 (of 13). In Bangladesh, a giant component forms (with 71.4% of the nodes) at an agreement of 12. Hence, in the Bangladesh network the large clusters are groups of participants who agree on all items and each subsequent group is one edge away from that cluster. Without resorting to network measures, it is clear that the opinion-based group networks are quite different for the two countries. However, it should be noted that comparing networks when they have different thresholds for network formation would be not be advised, instead it would be better to compare the networks at the same threshold (11 in this case or lower if it is desired to capture more participants).
The layout algorithm used here is a force-directed layout algorithm [28] as implemented by the graph-tool library in Python using [29]. Other layout algorithms that aim to reduce the number of edges crossing will yield similar results (eg. Kamada-Kawai [30]).

B. Score-based method
A disadvantage of the previous method is, if two participants are linked it does not take into account how much they diverged. For example, in the Bangladesh projec-tion in fig. 2, if, two participants differed where one has complete trust in "Scientists" and the other having some trust on those two items, they would not be linked in that network despite having similar opinions. Instead we introduce a score-based linking method. This takes into account how far away two participants are on the scale  To do this, we renormalise the scale from -1 to +1 going in equal increments corresponding to the scale. For example, if it is a 5-point scale, we take -1, -1/2, 0, 1/2, 1. On a 4-point scale this would be -1, -1/3, 1/3, 1. This value is then assigned to the edge in the bipartite graph. When we take the projection, we then compute the difference between each pair of nodes across all item responses. To make the threshold easier to conceptualise, we subtract the number of items from the difference score which gives each pair of vertices a similarity score going from −n items to +n items where n items is the total number of items.
In the Wellcome Trust data above, with 13 items, the difference can go from 0 (i.e. they both answer the same to everything) to 26 (i.e. the are on opposite extremes for each answer). To compute the similarity between them we subtract the number of items (i.e. 13) from this difference so each pair of vertices will now have a value from -13 to +13. Fig. 3 shows these projections for France with an agreement threshold of 11.5 (blue, top) and Bangladesh with an agreement threshold of 12 (green, bottom). At an agreement threshold of 12, France had a giant component of 31%, whereas each is above 65% in the networks displayed. We have also included negative edges with a threshold of -3 or lower in each (on average this requires two participants being more than a value of one away for each item on the renormalised scale). In each case clusters of opinion-based groups can be identified visually. Using community detection algorithms, these could be identified and studied in more detail (see below).
Note that if a participant does not respond to an item with an extreme value, then they cannot have a difference of 2. Therefore, a score of −n items (e.g. -13 above) will be rare as it will require one participant to answer fully positively to everything and another fully negatively.
A similar method can be applied to obtain a projection of links between items in what we call the attitude projection. This is shown for France and Bangladesh again in fig. 4. Here, the weight between two items goes from the total number of participants N to −N . For the purposes of visualisation, dotted blue edges are used to represent a weight of the first third, dashed represent from N/3 to 2N/3 and solid for the top third. The red edges represent the same thirds but for negative values. Here we see that in France, there are a group of participants who trust the government and journalists, but are removed from the rest.

C. Further examples
In the following examples, we use our visualisation method to assess polarisation among the Unites States (US) public. To achieve this we model American National Election Studies (ANES) data. These surveys produce large representative datasets of public attitude to-wards politics during different US elections. For the following example, we use the 2012 and 2016 pre-election datasets and take a number of items commonly used to assess partisanship in US politics [31]). These are views on: abortion, income, immigration, welfare, gay marriage, business, gun control and gay marriage. In each case we apply the score based method to the participant projection and display with a threshold of 7 (maximum of 8) in fig. 5. We then coloured the nodes based on whether respondents self-identify as either democrats (blue), republicans (red) or other/independent (yellow).
The layout algorithm demonstrates a clear distinction between democrats and republicans. Using the Girvan-Newman algorithm [32] to recursively remove nodes of high betweenness, we observe in the 2016 dataset there are 375 edges tying the two largest clusters together (this is 0.7%) of the edges. In 2012, however, the algorithm removes smaller communities each time suggesting that either the democrats and republicans are not as easily separated, or that the clusters of democrats and republicans are not as unified so the algorithm separates subcommunities of each. Such a pattern is indicative of the growing polarisation that occurred in US society between these two time-points [33].
In fig. 6, we also display the non-scoring version where we link participants based on the number of questions they answer in common for 2012. Here, we make one simplification by "binarising" the data. In this case, any pair that answer the same question both positively or both negatively get linked instead of having to get the same value. This is shown in the bottom of fig. 6. In both these figures, each cluster is separated by a distance of one attitude. Due to the simplification of the binarised version, these clusters, i.e. opinion-based groups, are much more clearly visible. Note that in both cases, the agreement score is n items − 1.
Using the Girvan-Newman algorithm, we can successfully separate two main clusters in 2012 in this case, here removing 2% of the edges splits into two similarly sized groups, one with predominantly republicans, the other democrats.

III. CONCLUSIONS
In this study we have introduced a method to map opinion-based groups and attitude networks from survey data. In the case of the opinion-based groups, there is a single parameter, how much agreement one wishes the participants to have. In the case of the attitude networks, there are no real parameters, the weight of the edges tell you how often the attitudes are held together positively and negatively.
In the participant projections, community detection methods can be used to identify polarised groups. We show that this method captures political groupings (i.e. republicans and democrats) in ANES data. Furthermore, we demonstrate that from 2012 to 2016, participants be- came more ideologically polarised in the same attitudes, an observation previously made in the social sciences [33]. When taking other datasets, such as the Wellcome Trust Global Health Monitor data, we are similarly able to identify distinct groups of people separated on different items.
We have previously used this agreement threshold method to map the emergence of novel opinion-based groups [5]. In that study, survey a group of participants across three time points using the same items as the Wellcome Trust Global Health Monitor. Each survey was carried out one week apart in the UK in March 2020 during the early phase of the COVID-19 pandemic. In the final period of data collection N = 253, we observe two attitude-based clusters separated by only 7 edges. These two groups were not observable in earlier time-points and were mostly separated by trust in science, suggesting a change in science attitudes at the onset of the COVID-19 outbreak in the UK.
With the attitude projections in fig. 4, we can identify attitudes that are commonly held together. For example, in France, a large number of people hold doctors, scientists, NGOs & charities and hospitals and health centres in a high regard, these are quite separate from people who have a lot of trust in government and journalists. In Bangladesh on the other hand, participants with a high trust in scientists also have a high trust in journalists. Similarly those who trust vaccines are more likely to trust traditional healers than in France.
These attitude projections are similar in principle to the ones constructed in [19,23]. However, an advantage of our method, is the ease of computation and interpretation. Our edges represent the number of participants agreeing or disagreeing with each pair of attitudes as opposed to a partial correlation. We therefore make less theoretical and statistical assumptions about the connections between nodes in our network.
Further network measures could be used to analyse the participant projections, however care must be taken when interpreting these, as they are not social networks. The participants in these do not know each other, they just align on certain attitudes. Therefore quantities will have to be interpreted in a different way. Clustering algorithms however are of particular interest to identify group-based alignment and polarisation. A next step is to use bipartite partition methods, such as [24] on the initial graph, and other statistical clustering methods on the raw data, to compare the opinion-based groups identified.
One issue with the stopping when the giant component is reached is the loss of some participants. If more participants are desired the agreement threshold could be lowered and clustering algorithms relying on the weight of the edge could be used instead. Using the size of the giant component as the parameter is useful when trying to gauge if large groups are highly polarised, however, it will miss small groups of participants with shared extreme attitudes. Therefore the choice of the parameter depends on the question being asked.
Further work from a network approach is to compare the projections to random null-models, this could also be used to ascertain a significance of the edges observed which would be of particular relevance to the clusters identified. In the case of the binarised ANES data (lower panel of fig. 6), there are 2 8 = 256 possible clusters based on eight binarised attitudes. However, from the clusters drawn, less than 10% of these are realised in the empirical sample.
In conclusion, we present a novel and simple means of visualising factional alignment and polarisation with survey data. This is a method that allows researchers to map the emergence of opinion-based groups using standard questionnaires and panel designs. We hope this work can go some way towards facilitating research that addresses the detrimental societal consequences of polaristaion driven by opinion-based group identification.

Declarations
Availability of data and materials The data used comes from secondary datasets which can be found in the relevant references.

Competing interests
The authors declare that they have no competing interests.

Funding
This project has received funding from the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme (grant agreement No. 802421).
Authors' contributions PMC developed the code, figures and co-wrote the manuscript, PM conceptually co-developed the model and co-wrote the manuscript and MQ conceptually co-developed the model and co-wrote the manuscript.