Calculating Network Homophily – Part 2

In an earlier post, we learned a command for one type of network homophily in R: the proportion of ties in a social network connecting two actors matching on a given characteristic. Today, we’ll build a command for calculating a second conception of network homophily. Specifically, this is the average proportion of characteristic matching within ego-networks, or the neighborhoods of each individual node.

First, let’s load igraph as we always do for these commands, and install it first if you need it:

Next, we’ll build the function for the ego-network homophily score, again commenting to describe each step in the function:

We only have to specify two things for this function: the graph object (created with igraph) and the name of the vertex attribute we want to use to calculate homophily. Let’s try this function out with a simulated random network:

Now let’s see what we get when we run the function we built, assigning the output as its own vertex attribute in the network:

One score for each node in the network, corresponding to the proportion of their neighbors which share the same level of educational achievement as they have. Since this is a vector, we can easily calculate the average and standard deviation:

We can treat this like a distribution, even generating a histogram:

But to correctly calculate traditional homophily at the group level, we will aggregate this score across a sub-population, e.g., for all male (or female) egos or nodes in the network:

Now we have two distinct ways to calculate homophily in social networks using R; one method measures the proportion of total ties involving actors with a specific attribute which connect actors matching on that attribute. This calculation will give more weight to the choices of egos with the largest networks: if nodes with relatively large ego networks are systematically more (or less) likely to choose alters of the same background, their choices will substantially increase (decrease) the homophily score for the group as a whole. The second approach averages across the choices of different group members without respect to ego network size, and thus the choices of each group member are given equal weight in calculcating group level homophily.  Hopefully these will be helpful in their substantive applications to your ongoing research projects!

Leave a Reply

Your email address will not be published. Required fields are marked *