[statnet_help] Combining multiple independent networks into one /
Constrained = ~ Dyads()
Karim Khader
Karim.Khader at hsc.utah.edu
Fri Dec 4 14:45:39 PST 2020
All,
I have been looking for a method to analyze data that is composed of multiple (independent) blocks of networks (where it is not possible to have edges between blocks, only within blocks). I have seen various packages that have been previously developed to implement multi-level ERGMs, but they are either no longer active or will not allow for the network statistics I am interested in.
I came across this thread [https://github.com/statnet/ergm/issues/140] about the development of the Dyads constraint, and it seemed potentially useful as a solution for what I am trying to do.
However, when I implemented the constraint, the results did not seem quite right. I would have assumed that the probability of an edge from a single network (NW) would be the same as the probability of an edge from a network that includes 2 copies of (NW), provided I only allow dyads within the same copy to change (since the # of edges and # of possible edges is just duplicated). So, I am unsure if I am confused about how the constraint works, or if there is a problem.
Code for an example is included below. 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.
Best,
Karim
require(statnet)
require(intergraph)
require(boot)
require(dplyr)
require(igraph)
data(florentine)
### 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){
Florentine[[i]] <- asIgraph(Florentine[[i]])
EL[[i]] <- igraph::as_data_frame(Florentine[[i]])[,c('from', 'to')]%>%mutate(group = i)
EL[[i]]$from <- EL[[i]]$from + (i-1)*16
EL[[i]]$to <- EL[[i]]$to + (i-1)*16
}
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 <- graph_from_data_frame(select(EL, from, to), directed = TRUE, vertices=NL)
Flomarriage <- asNetwork(Flomarriage)
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/20201204/fb7a403e/attachment.html>
More information about the statnet_help
mailing list