Using ergm.sign to analyse the signed Read’s Highland Tribes dataset

Marc Schalberger

## Loading required package: network
## 
## 'network' 1.19.0 (2024-12-08), part of the Statnet Project
## *  Remote: github::statnet/network@master (ffe733f4)
## * 'news(package="network")' for changes since last version
## * 'citation("network")' for citation information
## * 'https://statnet.org' for help, support, and other information
## 
## 'ergm' 4.10.1 (2025-08-26), part of the Statnet Project
## * 'news(package="ergm")' for changes since last version
## * 'citation("ergm")' for citation information
## * 'https://statnet.org' for help, support, and other information
## 'ergm' 4 is a major update that introduces some backwards-incompatible
## changes. Please type 'news(package="ergm")' for a list of major
## changes.
## 
## 'ergm.multi' 0.3.0 (2025-06-14), part of the Statnet Project
## * 'news(package="ergm.multi")' for changes since last version
## * 'citation("ergm.multi")' for citation information
## * 'https://statnet.org' for help, support, and other information
## 
## Attaching package: 'ergm.multi'
## The following object is masked from 'package:ergm':
## 
##     snctrl
library(ergm.sign)

Obtaining data

The highland tribes dataset from Read (1954) is included in the ergm.sign package:

data("tribes")

This gives us a multilayer network construct with a positive and a negative layer encoding the allied and hostile relationships between the tribes.

Desctiptive statistics

The summary summary function returns a matrix with the most important descriptive statistics for the signed network:

summary(tribes)
## Network Attributes:
##       Directed Loops Nodes Edges Edges+ Edges- Triads +++ --- ++- +-- Density
## edges    FALSE FALSE    16    58     29     29     68  19   7   2  40    0.48

If we would like to get other descriptive statistics using the summary_formula function:

summary(tribes ~ edges + Pos(~ edges) + Neg(~ edges))
##     edges Pos~edges Neg~edges 
##        58        29        29

Plotting the network

It is also possible to plot the signed network using the plot function. Which requires the UnLayer function that turns the multilayer network into a single layer network:

tribes_sgl <- UnLayer(tribes, color_pos = "green3", color_neg = "red3")
plot(tribes_sgl, edge.col = "col", label = "vertex.names")

Fitting a model

Just like in the unsigned case, we can call the ergm function to fit a model to the signed network. The ergm function requires a formula that specifies the model to be fitted. In addition to the normal ergm terms we can also use the Pos and the Neg function to specify terms that only apply to the positive or negative layer of the network.

fit <- ergm(tribes ~ Pos(~ edges) + Neg(~ edges))
summary(fit)
## Call:
## ergm(formula = tribes ~ Pos(~edges) + Neg(~edges))
## 
## Monte Carlo Maximum Likelihood Results:
## 
##           Estimate Std. Error MCMC % z value Pr(>|z|)    
## Pos~edges  -0.7601     0.2360      0  -3.221 0.001278 ** 
## Neg~edges  -0.7295     0.2185      0  -3.339 0.000842 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##      Null Deviance:   0.00  on 240  degrees of freedom
##  Residual Deviance: -16.93  on 238  degrees of freedom
##  
## Note that the null model likelihood and deviance are defined to be 0. This means that all likelihood-based inference (LRT, Analysis of
## Deviance, AIC, BIC, etc.) is only valid between models with the same reference distribution and constraints.
## 
## AIC: -12.93  BIC: -5.968  (Smaller is better. MC Std. Err. = 0.3594)

Triadic effects are of particular interest in the context of signed networks.

triad_fit <- ergm(tribes ~ gwese(0.5, fixed = TRUE, base = "+") + gwesf(0.5, fixed = TRUE, base = "+"))
summary(triad_fit)
## Call:
## ergm(formula = tribes ~ gwese(0.5, fixed = TRUE, base = "+") + 
##     gwesf(0.5, fixed = TRUE, base = "+"))
## 
## Monte Carlo Maximum Likelihood Results:
## 
##                    Estimate Std. Error MCMC % z value Pr(>|z|)  
## gwese(+).fixed.0.5 -0.33609    0.16017      0  -2.098   0.0359 *
## gwesf(+).fixed.0.5 -0.03003    0.06816      0  -0.441   0.6595  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##      Null Deviance:  0.00  on 240  degrees of freedom
##  Residual Deviance: -5.62  on 238  degrees of freedom
##  
## Note that the null model likelihood and deviance are defined to be 0. This means that all likelihood-based inference (LRT, Analysis of
## Deviance, AIC, BIC, etc.) is only valid between models with the same reference distribution and constraints.
## 
## AIC: -1.62  BIC: 5.342  (Smaller is better. MC Std. Err. = 0.3097)

Here, the gwese (geometrically weighted edgewise shared enemies) term models enemy of my enemy is my friend configuration and the gwesf (geometrically weighted edgewise shared friends) term models friend of a friend is a friend configuration.

Goodness of fit

In order to assess the goodness of fit of the model we can use the GoF function, which compares the observed network statistics to the statistics of simulated networks. The nsim argument specifies the number of simulations to be performed. For example, to perform 20 simulations we can use the following code:

GoF(fit, nsim = 20)

References

Read, Kenneth E. 1954. “Cultures of the Central Highlands, New Guinea.” Southwestern Journal of Anthropology 10 (1): 1–43.

mirror server hosted at Truenetwork, Russian Federation.