[statnet_help] Constraint blocks of dyads via 'constraints = ~ Dyads(vary, fix)'

Karim Khader Karim.Khader at hsc.utah.edu
Thu Dec 10 15:46:04 PST 2020


Does anyone have experience using the Dyad constraint (i.e. constraints = ~ Dyads(vary = ~nodematch("group"), fix = NULL)) within 'ergm', used to impose a block diagonal structure on the network adjacency matrix? I have recently tried implementing it but am finding that the model estimates when the constraint is used do not make sense.

Code for a simple example that illustrates my concern is included below. In the example, I understand that e1 should be different from e2 and e3, but I would have thought that e2 and e3 should return the same estimate (since the # of possible edges and the total # of edges represented in e3 is a multiple of those represented in e2). Am I simply misunderstanding how constraints = ~ Dyads() is supposed to work?


Karim Khader
Assistant Professor
Division of Epidemiology
University of Utah
Salt Lake City, Utah


### Create N independent copies of 'flomarriage'
N <- 2
Florentine <- list()
for (i in 1:N){
Florentine[[i]] <- flomarriage

### Create new edgelist that incorporates the N independent copies,
### and assigns each node a 'group' id depending on which group they belong to
EL <- list()
for (i in 1:N){
EL[[i]] <- as.edgelist(Florentine[[i]]) + (i-1)*16
EL[[i]] <- as.data.frame(EL[[i]])%>%
mutate(group = i)%>%
rename(from = V1, to = V2)
EL <- do.call("rbind", EL)
NL <- rbind(EL%>%select(from, group)%>%rename(id=from),
EL%>%select(to, group)%>%rename(id=to))%>%
arrange(group, id)%>%
distinct(.keep_all = T)

### Create new Network that represents N independent copies of flomarriage
Flomarriage <- network(select(EL, from, to), vertex.attr = NL, directed = TRUE)

e1 <- ergm(Flomarriage ~ edges)
e2 <- ergm(flomarriage ~ edges)
e3 <- ergm(Flomarriage ~ edges, constraints = ~ Dyads(vary = ~nodematch("group"), fix = NULL))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman13.u.washington.edu/pipermail/statnet_help/attachments/20201210/0adf01e5/attachment.html>

More information about the statnet_help mailing list