I have a social network with a modularity of 0.88 (I used cluster_edge_betweenness
). From what I can understand I need to create a number of null networks and use the resulting modularity distribution from them to assess if the modularity from my observed network is statistically significant. I can make null networks using nullmodel
and simulate
but I have no idea how to get the modularity distribution back from the null networks.
From what I've found online, I need to do something along the lines of this:
d <- array(dim=c(10000, vcount(gftest)))
c=numeric(10000)
r=numeric(10000)
for (i in 1:10000) {random_network=sample_degseq(d0)
random_network=simplify(random_network)
r[i]=cluster_edge_betweenness(random_network)
c[i]=transitivity(random_network, type="global")
}
which returns the error message:
In r[i] <- cluster_edge_betweenness(random_network) : number of items to replace is not a multiple of replacement length
or this:
nulltest <- nullmodel(amg1, "r00")
test2 <-simulate(nulltest, nsim = 1000)
oecosimu(nulltest, modularity(??), "r00", nsimul = 99, statistic = "Q", alternative = c("two.sided"))
which doesn't work.