The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
ergm.sign to analyse the
signed Read’s Highland Tribes dataset## 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
The highland tribes dataset from Read
(1954) is included in the ergm.sign package:
This gives us a multilayer network construct with a positive and a negative layer encoding the allied and hostile relationships between the tribes.
The summary summary function returns a matrix with the
most important descriptive statistics for the signed network:
## 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:
## edges Pos~edges Neg~edges
## 58 29 29
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")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.
## 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.
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:
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.