{'fraction_non_alphanumeric': 0.04660305680713844, 'fraction_numerical': 0.014488912448096122, 'mean_word_length': 4.467036947597199, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Analytical approach to the generalized friendship paradox in networks with correlated attributes

One of the interesting phenomena due to the topological heterogeneities in complex networks is the friendship paradox, stating that your friends have on average more friends than you do. Recently, this paradox has been generalized for arbitrary nodal attributes, called a generalized friendship paradox (GFP). In this paper, we analyze the GFP for the networks in which the attributes of neighboring nodes are correlated with each other. The correlation structure between attributes of neighboring nodes is modeled by the Farlie-Gumbel-Morgenstern copula, enabling us to derive approximate analytical solutions of the GFP for three kinds of methods summarizing the neighborhood of the focal node, i.e., mean-based, median-based, and fraction-based methods. The analytical solutions are comparable to simulation results, while some systematic deviations between them might be attributed to the higher-order correlations between nodal attributes. These results help us get deeper insight into how various summarization methods as well as the correlation structure of nodal attributes affect the GFP behavior, hence better understand various related phenomena in complex networks.


I. INTRODUCTION
In recent years, complex social phenomena have been extensively studied by means of statistical physics [1,2] due to the structural similarity between social phenomena and physical processes in a sense that macroscopic complex patterns emerge from the interaction between numerous microscopic constituents. The interaction structure between individuals has been modeled in terms of social networks, where nodes and links represent individuals and their pairwise interactions, respectively [3][4][5]. Empirical analyses of various social network datasets have revealed that the topological structure of social networks is heterogeneous [6], typically showing heavy-tailed degree distributions [7,8], assortative mixing [9], and community structure [10], etc. Such heterogeneous topological properties enable various interesting phenomena in social networks and social processes taking place on them, such as diffusion, spreading, and opinion formation [1,2,11,12].
Among various interesting phenomena due to the topological heterogeneities of social networks we focus on the friendship paradox (FP) and its generalized version, namely, the generalized friendship paradox (GFP). The FP states that your friends have on average more friends than you do [13]. In terms of network science, the FP is about the node degree, i.e., the number of neighbors of the node. On the other hand, the GFP can be applied to the network of nodes having attributes other than degrees whether such attributes are topological, e.g., be- * h2jo@catholic.ac.kr tweenness or eigenvector centralities [14,15], or nontopological, e.g., happiness or sentiment [16,17]: The GFP states that your friends have on average higher attributes than yours [18][19][20]. Since its introduction, the GFP has been extensively studied by means of empirical analyses [16][17][18][19][21][22][23][24] as well as by analytical and numerical approaches [15,20,25].
Both FP and GFP are based on the comparison of one node's attribute to a set of attributes of its neighbors or a single value summarizing the set. The most common summarization method has been to take an average of the attributes in the set, which is however sensitive on a few neighbors with very high attributes. Therefore, the median was suggested for the summarization as the median is less sensitive on such neighbors than the average [13,22,26,27]. More recently, another summarization method using the fraction of neighbors having higher attributes than the node of interest has been suggested to systematically compare different summarization methods [28]. These three summarization methods are called mean-based, median-based, and fraction-based, respectively. Each summarization method can be interpreted as a perception model by which individuals perceive their neighborhood. It has been shown that different summarization methods lead to qualitatively different behaviors of FP and opinion formation [28].
As a natural extension of the previous work on the effect of summarization methods on the FP, here we study how the above three summarization methods affect the GFP behavior. For more rigorous understanding of such effects, we derive approximate analytical solutions of the probability that the GFP holds for a node with given degree and non-topological attribute, for each of three summarization methods. We interpret the GFP holding probability as the peer pressure on the individual node. It is straightforward to get the solution for the uncorrelated case, i.e., when the attributes of neighboring nodes are uncorrelated, e.g., as shown in Ref. [20]. In contrast, it has been highly non-trivial to derive the analytical solution for the case with correlated attributes, mainly due to the difficulty in modeling the correlation structure between attributes of neighboring nodes in a closed form. For modeling the correlated attributes of neighboring nodes, we adopt a Farlie-Gumbel-Morgenstern copula among others [29,30] to derive approximate analytical solutions of the mean-based, fraction-based, and medianbased peer pressure for the first time to the best of our knowledge. The analytical solutions are compared to the simulation results. These results can help us get deeper insight into how various summarization methods as well as the correlation structure of nodal attributes affect the GFP behavior, hence better understand various related phenomena in complex networks.

II. MEAN-BASED GFP
Let us consider a network with N nodes and a nontopological attribute distribution P (x) for nodes. We assume the range of x ≥ 0 for the sake of convenience, while the negative value of attributes can also be considered. The generalized friendship paradox (GFP) at the individual level is based on the comparison of one node's attribute to a set of attributes of its neighbors or a single value summarizing the set. We consider three different summarization methods, which are mean-based, medianbased, and fraction-based, respectively [28].

A. Analysis
The mean-based GFP holds for a node i if the node has lower attribute than the average attribute of its neighbors, precisely if the following condition is satisfied [19,20]: where Λ i denotes the set of i's neighbors and k i ≡ |Λ i | is the degree of the node i. The probability of satisfying Eq. (1) is called the mean-based peer pressure. The mean-based peer pressure of a focal node with degree k and attribute x can be written as where θ(·) is a Heaviside step function, · denotes the ensemble average over {x j }, and P (x 1 , · · · , x k |x) is the conditional joint probability distribution function (PDF) of k attributes of neighbors of the focal node when the attribute of the focal node is given as x. For the analysis, we assume that x j s are independent of each other but only conditioned by x, which is called the conditional independence. By this assumption the conditional joint PDF of k attributes reduces to the product of k conditional PDFs as follows: Here the joint PDF P (x, x ) carries information on the pairwise correlation between attributes of neighboring nodes. For modeling P (x, x ), we adopt a Farlie-Gumbel-Morgenstern (FGM) copula among others [29,30], enabling us to write where The FGM copula indicates a function C joining a bivariate cumulative distribution function (CDF), say G(x, y), to their one-dimensional marginal CDFs, say u(x) and v(y), such that G(x, y) [29,30]. Then the bivariate PDF of x and y is derived by ∂ 2 G ∂x∂y = P 1 (x)P 2 (y)[1 + r(2u − 1)(2v − 1)], where P 1 (x) and P 2 (y) denote PDFs. In our case, P 1 and P 2 are identical and the parameter r ∈ [−1, 1] controls the degree of correlations between x and x in Eq. (4). Thus, r is related to the Pearson correlation coefficient between x and x , which is written as where and µ and σ are the mean and standard deviation of P (x), respectively. Using Eq. (4) one gets The upper bound of A for any P (x) is known as 1/3, implying that |ρ x | ≤ 1/3 [31]. The FGM copula has recently been used for modeling the bivariate luminosity function of galaxies [32] and bursty time series with correlated interevent times [33,34]. By plugging Eq. (4) into Eq. (3), we obtain For the second line, by assuming that |r| 1, we have expanded the equation up to the first order of r. We take the Laplace transform of Eq. (2) using Eq. (9) to get where andP (s) is the Laplace transform of P (x). Then the mean-based peer pressure h mn (k, x) can be obtained by taking the inverse Laplace transform of Eq. (10) analytically or numerically if necessary. Note that the analytical result in Eq. (10) has been derived for the arbitrary form of P (x) and any correlation coefficient ρ x whose range is limited by the functional form of P (x) [see Eq. (8)].
For studying the solvable case, we consider an exponential distribution for x, i.e., with x = 1/λ, leading to Note that A = 1/4 from Eq. (8), implying that SinceP one gets from Eq. (10) Then we take the inverse Laplace transform of Eq. (16) to finally get h mn (k, x) as follows: where Here Γ(a) and Γ(a, z) denote the Gamma function and the upper incomplete Gamma function, respectively. See Appendix A for the detailed calculation. By this solution we can rigorously understand the effects of the correlation between attributes of neighboring nodes on the mean-based GFP. We also remark that the first term on the right hand side of Eq. (17) is the same as the previous analytical solution for the case with uncorrelated attributes, namely, Eq. (10) with α = 1 in Ref. [20]. The analytical solution in Eq. (17) is depicted as heat maps in Fig. 1(a-c) for both uncorrelated and correlated cases, i.e., for r = −0.16, 0, and 0.16, respectively. The effects due to the attribute correlation can be effectively characterized by a transition point x * r (k) for given k and r between regimes with low and high peer pressure, which is defined by the condition The curves x * r (k) for various values of r are shown as solid lines in Fig. 1(a-c). In particular, we find that as k increases, x * r (k)/ x approaches a value smaller than, equal to, or larger than one for r < 0, r = 0, or r > 0, respectively. For the case with r = 0 we indeed derive the following result from Eq. (17): see Appendix B for the derivation. These results imply that in a network in which attributes of neighboring nodes are positively correlated, some nodes having attributes above the average tend to have high peer pressure as their neighbors have even higher attributes than their own attributes, and vice versa. This behavior is qualitatively consistent with the previous numerical results presented in Fig. 2(c, i) of Ref. [20].

B. Numerical simulation
The analytical solution of h mn (k, x) in Eq. (17) is compared with simulation results. We first generate 10 uncorrelated random networks of size N = 5×10 4 following the configuration model [35], in which the degrees of nodes are drawn from an exponential distribution with the average of 50. Each node i in the generated network is assigned by an attribute x i that is randomly drawn from an exponential distribution P (x) in Eq. (12). For quantifying the correlation between attributes of neighboring nodes, we adopt the Pearson correlation coefficient, precisely, where the summations are over all links ij and L is the number of links in the network [36]. To introduce the correlation between attributes of neighboring nodes, we uniformly randomly choose a link, say ij, and swap x i and x j only when the swap makesρ x closer to the target value ρ x . This swapping is repeated untilρ x gets close enough to ρ x , i.e., until the following condition is satisfied: with = 10 −5 . Once the network with (un)correlated attributes is ready, we calculate the mean-based peer pressure for each node i by using to obtain the average of h i,mn for nodes with the same k and x, i.e., h mn (k, x). For a given ρ x , we generate 2 × 10 3 random configurations of attributes per network. Since ρ x = r/4 in Eq. (14), we obtain the simulation results for ρ x = −0.04, 0, and 0.04 to compare them with the analytical counterparts for r = −0.16, 0, and 0.16, respectively. We find that the simulation results of h mn (k, x) and of the transition point x * r (k) in Fig. 1(d-f) are comparable with the analytical solution in Fig. 1(a-c). This is supported by the comparison between the simulation results and analytical solution of h mn (k, x) as a function of x for several values of k in each case of (ρ x , r) = (−0.04, −0.16), (0, 0), and (0.04, 0.16), as shown in Fig. 1(g-i). Since the analytical solution of h mn (k, x) in Eq. (17) was obtained up to the first-order term of r by assuming that |r| 1, the effects of higher-order terms of r on the results can be studied by looking at the difference between the results in the correlated case and those in the uncorrelated case. Precisely, we compare the firstorder term of r on the right hand side of Eq. (17) for a given value of r > 0 to the difference between correlated and uncorrelated cases, defined as where h ρx mn (k, x) is the simulation result of the meanbased peer pressure when the correlation between attributes of neighboring nodes is given as ρ x . Here ρ x = ±r/4 are used for the comparison. For the simulation, we generate 5 × 10 4 random configurations of attributes per network. It is shown in Fig. 2 that the difference ∆h mn (k, x) is only qualitatively predicted by the first-order term of r in Eq. (17). This is probably due to the non-negligible higher-order terms of r, the calculation of which seems to be highly non-trivial. In addition, the deviation of the analytical solution from the simulation results might be partly due to the correlation between attributes of neighbors of the node. We have assumed the conditional independence between attributes of neighbors of the focal node i, i.e., {x j } j∈Λi , enabling us to simplify the joint PDF of those x j s, as done in Eq. (3). However, the correlation between x i and x j can naturally lead to the correlation between x j s.

III. FRACTION-BASED GFP
Next we consider the fraction-based GFP in terms of the fraction of neighbors having higher attributes than the focal node [28]. Here we define the fraction-based peer pressure as the ensemble average of the fraction of neighbors having higher attributes than the focal node with degree k and attribute x as follows: By the assumption of conditional independence in Eq. (3) the fraction-based peer pressure in Eq. (25) reduces to a simpler form as It is remarkable that h fr (k, x) is independent of k and that from Eq. (2) Using Eq. (4) one obtains In the case with the exponential distribution of attributes in Eq. (12), we have . (29) Note that this solution is exact without any assumption on the range of r.
The analytical solution of h fr (k, x) in Eq. (29) is depicted as solid lines in Fig. 3(a-c) for both uncorrelated and correlated cases. As expected from the equivalence between the fraction-based GFP and the mean-based GFP for k = 1 in Eq. (27), we conclude that the positive correlation between attributes of neighboring nodes enhances (suppresses) the fraction-based peer pressure of nodes having higher (lower) attributes. The opposite behavior is found for the negatively correlated attributes. For the comparison of the analytical solution to the simulation results, we use the same networks with correlated attributes generated for the mean-based GFP to measure the fraction-based peer pressure for each node i by using Then we calculate the average of h i,fr for nodes with the same k and x to get h fr (k, x). The simulation results of h fr (k, x) for various values of ρ x and k are presented as symbols in Fig. 3(a-c), which are comparable with the analytical solution. We also find in Fig. 3(d-f) that the difference ∆h fr (k, x), defined similarly to ∆h mn (k, x) in Eq. (24), is qualitatively predicted by the first-order term of r in Eq. (29). In particular, when k is large, e.g., k = 100, the simulation results and the analytical solution are not only qualitatively but also quantitatively similar to each other. Yet the deviation between them might be attributed to the assumption on the conditional independence between attributes of neighbors of the focal node, as discussed in the previous Section.

IV. MEDIAN-BASED GFP
As mentioned in Section I, the median has been used instead of the average for summarizing the attributes of neighbors of the focal node [13,26] because the median is less sensitive to the neighbors whose attributes are very high, in particular when the attribute distribution P (x) is skewed to the right. We define the median-based peer pressure as the probability that the focal node has lower attribute than the median attribute of its neighbors: Note that h md (1, x) = h fr (k, x) = h mn (1, x). As the above equation in Eq. (31) is not trivial to analyze, by the assumption of conditional independence between x j s, we rewrite the median-based peer pressure in terms of the binomial distribution: where p x is the probability that a neighbor of the focal node has an attribute bigger than that of the focal node, hence A similar approach has been taken for the FP when the degrees of neighboring nodes are correlated [37]. In the case with large k, the median-based peer pressure in Eq. (32) can be approximated as where Φ(z) is the cumulative distribution function of the normal distribution: For the exponentially distributed attributes, i.e., as in Eq. (12), one can numerically calculate h md (k, x) with p x = h fr (k, x) using Eq. (29). The analytical solution of h md (k, x) in Eq. (34) is depicted as heat maps in Fig. 4(a-c) for both uncorrelated and correlated cases, i.e., r = −0.4, 0, and 0.4, respectively. We observe that h md (k, x = x ln 2) = 1/2, irrespective of both k and r, which can be easily shown by the fact that p x = 1/2 when x = x ln 2 from Eq. (29). That is, the transition point between regimes with low and high peer pressure, similarly defined as Eq. (19), is obtained as x * r (k) = x ln 2, which turns out to be constant of r and k [see also Fig. 4(a-c)]. The transition of h md (k, x) at x * r (k) becomes more gradual as the correlation increases. This implies that the positive correlation between attributes of neighboring nodes enhances (suppresses) the medianbased peer pressure of nodes having higher (lower) attributes.
We remark that for a given r, x * r (k) is constant of k for the median-based GFP, whereas it varies with k for the mean-based GFP. It is because very large attributes of a node's neighbors significantly affect the average of neighbors' attributes but they may barely affect their median.
For the simulation, we generate the networks with correlated attributes similarly to the case of the mean-based GFP to measure the median-based peer pressure for each node i by using where x i,md is defined as the median of the set of attributes of i's neighbors, i.e., {x j } j∈Λi . If the node i has an even number of neighbors, x i,md is given as the average of two middle attributes. Then we calculate the average of h i,md for nodes with the same k and x to get h md (k, x). The simulation results of h md (k, x) for ρ x = −0.1, 0, and 0.1 are shown in Fig. 4(d-f), respectively. We find that the simulation results for nonnegatively correlated attributes are comparable with the analytical solution in Eq. (34), whereas those for negatively correlated attributes deviate from the analytical solution, which is also confirmed in Fig. 4(g-i). The effect of correlations between attributes of neighboring nodes is also shown in terms of ∆h md (k, x), which is defined similarly to ∆h mn (k, x) in Eq. (24). These differences are compared to the analytical counterparts that are derived from Eq. (34) in Fig. 5 to find that the simulation results are only qualitatively explained by the analytical solution. The deviations between them are probably due to the assumption on the conditional independence as well as the assumption for the large k.

V. CONCLUSION
The generalized friendship paradox (GFP) states that your neighbors have on average higher attributes than you do [19,20]. In other words, individuals tend to compare their own attributes to the average of attributes of their neighbors. However, the average is not the only summarization method of their neighborhood: The median of attributes of neighbors [13] as well as the fraction of neighbors having higher attributes than that of the individual [28] have been used, but mostly for the friendship paradox. Yet little has been known about how such different summarization methods affect the GFP behavior for a network with correlated attributes.
For the systematic comparison of different summarization methods, namely, mean-based, fraction-based, and median-based methods, we have derived the approximate analytical solutions of the probability that the GFP holds for an individual node with given degree and attribute, enabling us to understand the GFP more rigorously. For modeling the correlation between attributes of neighboring nodes, we have adopted a Farlie-Gumbel-Morgenstern (FGM) copula among others to successfully obtain the analytical solutions for the correlated cases; in the case of the mean-based method, the analytical solution is obtained only for weakly correlated attributes. These solutions are numerically confirmed and support some of the previous simulation results [20], while we also find some systematic deviations at a finer scale between the analytical solutions and the simulation results. Such deviations might be partly due to the higher-order correlations as well as due to the correlation between attributes of neighbors of a focal node that has been ignored by the conditional independence between attributes of neighbors of the focal node for the sake of analytic tractability. These limits might be able to be overcome by considering the higher-order terms of the correlation parameter and the higher-order correlations between neighbors of the focal node. Finally, one can investigate the case with other functional forms of the attribute distribution than the exponential distribution, such as heavy-tailed ones [19,38], using other kinds of copulas [29] to represent more realistic correlation structure between attributes of neighboring nodes in complex networks.