Statistical Models of Networks III

In the previous handout we saw how to fit exponential random graph models (ergms) for simple undirected networks. As noted, these models are useful for multivariate null hypothesis testing using network data, answering questions of the form: Is this network statistic larger or smaller than I would expect by chance, after conditioning (e.g., “controling for”) these other network statistics?

The ergm modeling framework is pretty flexible, allowing you to test for the statistical significance of any network statistic you can imagine while holding constant a bunch of other ones.

Here we will see how to extend the ergm framework to other types of directed, two-mode, and temporal networks.

ERGMs in Directed Networks

The extension to the directed case is the most straightforward.

The key network statistic that we need to think about in the directed case is reciprocity or mutuality, namely, the fact that in the directed case, it is possible that I send a tie to you but you don’t send it back. In this advice network case this would happen if I seek advice from you, but you don’t seek advice from me.

In an ergm, we use the mutual term to condition on the number of dyads featuring arcs going on both directions (e.g., from \(i\) to \(j\) and from \(j\) to \(i\)).

Let’s see an example using Krackhardt’s High-Tech Managers:

   library(networkdata)
   library(igraph)
   library(ergm)
   library(intergraph)
   set.seed(123)
   g1 <- ht_friends
   n1 <- asNetwork(g1)
   g2 <- ht_advice
   n2 <- asNetwork(g2)
   m1 <- ergm(n1 ~ edges + mutual)
   summary(m1)
Call:
ergm(formula = n1 ~ edges + mutual)

Monte Carlo Maximum Likelihood Results:

       Estimate Std. Error MCMC % z value Pr(>|z|)    
edges   -1.5416     0.1553      0  -9.929  < 1e-04 ***
mutual   1.3320     0.3607      0   3.692 0.000222 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

     Null Deviance: 582.2  on 420  degrees of freedom
 Residual Deviance: 451.6  on 418  degrees of freedom
 
AIC: 455.6  BIC: 463.7  (Smaller is better. MC Std. Err. = 0.3209)
   m2 <- ergm(n2 ~ edges + mutual)
   summary(m2)
Call:
ergm(formula = n2 ~ edges + mutual)

Monte Carlo Maximum Likelihood Results:

       Estimate Std. Error MCMC % z value Pr(>|z|)  
edges   -0.2752     0.1629      0  -1.690   0.0911 .
mutual   0.1693     0.2939      0   0.576   0.5647  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

     Null Deviance: 582.2  on 420  degrees of freedom
 Residual Deviance: 578.2  on 418  degrees of freedom
 
AIC: 582.2  BIC: 590.2  (Smaller is better. MC Std. Err. = 0.05879)

Here we see strong evidence for mutuality effects in friendship nominations (\(\theta_m = 1.33, p < 0.01\)), consistent with the social meaning of the relation, but not in advice relations (\(\theta_m = 0.17, p = 0.57\)), suggesting that these ties are more hierarchical).

Next we may also want to fit models that condition on the different types of dependence between pairs of directed ties that are centered on the same node. There are three flavors of these types of dependencies:

  • Nodes that send a tie are more likely to send another tie. This is a rich get richer effect for outdegree.

  • Nodes that receive a tie are more likely to receive another tie. This is a rich get richer effect for indegree.

  • Nodes that send/receive a tie are more like to receive/send a tie. This fits the correlation between in and outdegree at the node level. If positive, nodes that send ties also receive ties.

The respective ergm terms for these three effects are ostar(2), istar(2) and twopath.

Let’s test for a twopath effect in the friendship and advice networks:

   set.seed(123)
   m3 <- ergm(n1 ~ edges + mutual + twopath)
   summary(m3)
Call:
ergm(formula = n1 ~ edges + mutual + twopath)

Monte Carlo Maximum Likelihood Results:

        Estimate Std. Error MCMC % z value Pr(>|z|)    
edges   -1.69215    0.52987      0  -3.194  0.00141 ** 
mutual   1.33011    0.34058      0   3.905  < 1e-04 ***
twopath  0.01649    0.05477      0   0.301  0.76330    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

     Null Deviance: 582.2  on 420  degrees of freedom
 Residual Deviance: 450.1  on 417  degrees of freedom
 
AIC: 456.1  BIC: 468.2  (Smaller is better. MC Std. Err. = 0.4178)
   m4 <- ergm(n2 ~ edges + mutual + twopath)
   summary(m4)
Call:
ergm(formula = n2 ~ edges + mutual + twopath)

Monte Carlo Maximum Likelihood Results:

        Estimate Std. Error MCMC % z value Pr(>|z|)    
edges    3.11004    0.51671      0   6.019   <1e-04 ***
mutual   0.48283    0.30122      0   1.603    0.109    
twopath -0.20636    0.03315      0  -6.225   <1e-04 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

     Null Deviance: 582.2  on 420  degrees of freedom
 Residual Deviance: 542.9  on 417  degrees of freedom
 
AIC: 548.9  BIC: 561  (Smaller is better. MC Std. Err. = 0.7573)

We can see that in the friendship network, there is no two path effect (\(p = 0.76\)); that is, people who send friendship nominations are not more or less likely to receive them.

However, in the advice network, we see a significant and negative two path effect (\(\theta_{2p} = -0.21\)); people who seek advice are less likely to be sought as advisors from others, which makes sense.

Now let’s look at rich get richer effects by indegree: Are people who are nominated as friends byy one person more likely to be nominated as friends by others? Are people who are sought after for advice by one person more likely to be sought after for advice by others?

   set.seed(123)
   m5 <- ergm(n1 ~ edges + mutual + istar(2))
   summary(m5)
Call:
ergm(formula = n1 ~ edges + mutual + istar(2))

Monte Carlo Maximum Likelihood Results:

       Estimate Std. Error MCMC % z value Pr(>|z|)    
edges  -1.84755    0.37451      0  -4.933  < 1e-04 ***
mutual  1.34842    0.35668      0   3.780 0.000157 ***
istar2  0.06630    0.07263      0   0.913 0.361348    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

     Null Deviance: 582.2  on 420  degrees of freedom
 Residual Deviance: 450.0  on 417  degrees of freedom
 
AIC: 456  BIC: 468.2  (Smaller is better. MC Std. Err. = 0.3208)
   m6 <- ergm(n2 ~ edges + mutual + twopath + istar(2))
   summary(m6)
Call:
ergm(formula = n2 ~ edges + mutual + twopath + istar(2))

Monte Carlo Maximum Likelihood Results:

        Estimate Std. Error MCMC % z value Pr(>|z|)    
edges    0.85773    0.78088      0   1.098   0.2720    
mutual   0.77351    0.31932      0   2.422   0.0154 *  
twopath -0.15003    0.03577      0  -4.194   <1e-04 ***
istar2   0.13288    0.03318      0   4.005   <1e-04 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

     Null Deviance: 582.2  on 420  degrees of freedom
 Residual Deviance: 534.1  on 416  degrees of freedom
 
AIC: 542.1  BIC: 558.3  (Smaller is better. MC Std. Err. = 0.7616)

We can that friendship network displays not cumulative advantage by indegree, but that they advice network does (\(\theta_{is} = 0.13\)), consistent with the idea that the latter is more unequal and hierarchical. Note also that once we adjust for the two path and the rich get richer indegree effect, we can see a strong mutuality effect in advice relations (\(\theta_{m} = 0.77\)).

Now, let’s adjust for the tendency of people who send one tie, to send other ties:

   set.seed(123)
   m7 <- ergm(n1 ~ edges + mutual + ostar(2), 
              estimate = "MPLE",
              control = control.ergm(MPLE.covariance.method = "Godambe"))
   summary(m7)
Call:
ergm(formula = n1 ~ edges + mutual + ostar(2), estimate = "MPLE", 
    control = control.ergm(MPLE.covariance.method = "Godambe"))

Maximum Pseudolikelihood Results:

       Estimate Std. Error MCMC % z value Pr(>|z|)    
edges  -3.06823    0.35873      0  -8.553   <1e-04 ***
mutual  1.70160    0.32521      0   5.232   <1e-04 ***
ostar2  0.26496    0.05675      0   4.669   <1e-04 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

     Null Deviance: 582.2  on 420  degrees of freedom
 Residual Deviance: 356.9  on 417  degrees of freedom
 
AIC: 362.9  BIC: 375.1  (Smaller is better. MC Std. Err. = 0)
   m8 <- ergm(n2 ~ edges + mutual + twopath  
                 + istar(2) + ostar(2),  
              estimate = "MPLE",
              control = control.ergm(MPLE.covariance.method = "Godambe"))
   summary(m8)
Call:
ergm(formula = n2 ~ edges + mutual + twopath + istar(2) + ostar(2), 
    estimate = "MPLE", control = control.ergm(MPLE.covariance.method = "Godambe"))

Maximum Pseudolikelihood Results:

        Estimate Std. Error MCMC % z value Pr(>|z|)    
edges   -4.38711    1.45877      0  -3.007  0.00263 ** 
mutual   1.70972    0.07481      0  22.855  < 1e-04 ***
twopath -0.09056    0.03393      0  -2.669  0.00760 ** 
istar2   0.27931    0.06355      0   4.395  < 1e-04 ***
ostar2   0.29084    0.04304      0   6.757  < 1e-04 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

     Null Deviance: 582.2  on 420  degrees of freedom
 Residual Deviance: 389.0  on 415  degrees of freedom
 
AIC: 399  BIC: 419.2  (Smaller is better. MC Std. Err. = 0)

We can now see that in contrast to the previous null results, there is outdegree dependency between nominations sent by the same node in the friendship network: People who nominate one person as a friend tend to nominate others (\(\theta_{os} = 0.27, p < 0.01\)).

In the advice network, we can see that all tendencies are operative, as the network displays all forms of degree dependence at the node level, along with mutuality.

We can also incorporate homophily based non attributes into our analysis of reciprocity. That is, we can test hypotheses of the form: Is mutuality weaker or stronger for dyads that match on a certain characteristic?

For instance, we may suspect that friendship ties among high-tech managers are influenced by formal organizational position, so that there is more mutuality within levels (e.g., mid-manager to mid-manager) than across levels (mid to lower-level).

Recall than in this network there are three managerial level but only one top manager, so we should compare the middle level to the rest

We can test this hypothesis as using the same argument in the mutual ergm term:

   set.seed(123)
   m9 <- ergm(n1 ~ edges 
              + mutual(same = "level", diff = TRUE, levels = 2)
              + ostar(2), 
              estimate = "MPLE",
              control = control.ergm(MPLE.covariance.method = "Godambe"))
   summary(m9)
Call:
ergm(formula = n1 ~ edges + mutual(same = "level", diff = TRUE, 
    levels = 2) + ostar(2), estimate = "MPLE", control = control.ergm(MPLE.covariance.method = "Godambe"))

Maximum Pseudolikelihood Results:

                    Estimate Std. Error MCMC % z value Pr(>|z|)    
edges               -2.53164    0.18751      0 -13.501   <1e-04 ***
mutual.same.level.2  3.53634    0.58476      0   6.047   <1e-04 ***
ostar2               0.25071    0.02919      0   8.589   <1e-04 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

     Null Deviance: 582.2  on 420  degrees of freedom
 Residual Deviance: 380.1  on 417  degrees of freedom
 
AIC: 386.1  BIC: 398.2  (Smaller is better. MC Std. Err. = 0)
   m10 <- ergm(n2 ~ edges 
              + mutual(same = "level", diff = TRUE, levels = 2)
              + twopath  + istar(2) + ostar(2), 
              estimate = "MPLE",
              control = control.ergm(MPLE.covariance.method = "Godambe"))
   summary(m10)
Call:
ergm(formula = n2 ~ edges + mutual(same = "level", diff = TRUE, 
    levels = 2) + twopath + istar(2) + ostar(2), estimate = "MPLE", 
    control = control.ergm(MPLE.covariance.method = "Godambe"))

Maximum Pseudolikelihood Results:

                    Estimate Std. Error MCMC % z value Pr(>|z|)    
edges               -4.13775    1.36925      0  -3.022  0.00251 ** 
mutual.same.level.2  1.56828    0.35108      0   4.467  < 1e-04 ***
twopath             -0.02600    0.03249      0  -0.800  0.42345    
istar2               0.23461    0.05989      0   3.918  < 1e-04 ***
ostar2               0.26504    0.04004      0   6.619  < 1e-04 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

     Null Deviance: 582.2  on 420  degrees of freedom
 Residual Deviance: 416.7  on 415  degrees of freedom
 
AIC: 426.7  BIC: 446.9  (Smaller is better. MC Std. Err. = 0)

And indeed, we find that compared to lower level managers, tendencies toward mutuality in friendship choices are stronger among mid-level managers. Note that once we adjust for this attribute-specific mutuality effect, the two path effect in the advice network is no longer significant. We can also test hypotheses of the form: Are nodes with certain characteristics more likely to be involved in mutual dyads regardless of the characteristics of the node at the other end of the tie? That is, this tests for differential tendencies toward mutuality based on attribute.

We can do this using the by argument in the mutual term. This time using department as the relevant attribute:

   set.seed(123)
   m11 <- ergm(n1 ~ edges 
              + mutual(by = "dept", levels = 2:4)
              + ostar(2), 
              estimate = "MPLE",
              control = control.ergm(MPLE.covariance.method = "Godambe"))
   summary(m11)
Call:
ergm(formula = n1 ~ edges + mutual(by = "dept", levels = 2:4) + 
    ostar(2), estimate = "MPLE", control = control.ergm(MPLE.covariance.method = "Godambe"))

Maximum Pseudolikelihood Results:

                 Estimate Std. Error MCMC % z value Pr(>|z|)    
edges            -2.76686    0.27732      0  -9.977   <1e-04 ***
mutual.by.dept.1  1.08797    0.25097      0   4.335   <1e-04 ***
mutual.by.dept.2  0.54380    0.30474      0   1.784   0.0743 .  
mutual.by.dept.3  0.33191    0.58650      0   0.566   0.5715    
ostar2            0.24691    0.04965      0   4.972   <1e-04 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

     Null Deviance: 582.2  on 420  degrees of freedom
 Residual Deviance: 371.6  on 415  degrees of freedom
 
AIC: 381.6  BIC: 401.8  (Smaller is better. MC Std. Err. = 0)
   m12 <- ergm(n2 ~ edges 
              + mutual(by = "dept", levels = 2:4)
              + istar(2) + ostar(2), 
              estimate = "MPLE",
              control = control.ergm(MPLE.covariance.method = "Godambe"))
   summary(m12)
Call:
ergm(formula = n2 ~ edges + mutual(by = "dept", levels = 2:4) + 
    istar(2) + ostar(2), estimate = "MPLE", control = control.ergm(MPLE.covariance.method = "Godambe"))

Maximum Pseudolikelihood Results:

                 Estimate Std. Error MCMC % z value Pr(>|z|)    
edges            -5.26275    0.57206      0  -9.200   <1e-04 ***
mutual.by.dept.1  1.03995    0.06568      0  15.834   <1e-04 ***
mutual.by.dept.2 -0.06611    0.09533      0  -0.694    0.488    
mutual.by.dept.3  1.11460    0.03769      0  29.571   <1e-04 ***
istar2            0.25074    0.03531      0   7.101   <1e-04 ***
ostar2            0.29014    0.02182      0  13.296   <1e-04 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

     Null Deviance: 582.2  on 420  degrees of freedom
 Residual Deviance: 397.1  on 414  degrees of freedom
 
AIC: 409.1  BIC: 433.3  (Smaller is better. MC Std. Err. = 0)

The results show that, in the friendship network, nodes in Dept 2 tend to have more mutual ties compared to nodes in Dept 1 (the reference), in the advice network both nodes in Dept 2 and and Dept 4 tend to have more mutual ties, while nodes in Dept 3 are not statistically different from nodes in Dept 1.