statnet / ergm

Fit, Simulate and Diagnose Exponential-Family Models for Networks
Other
98 stars 37 forks source link

Help fitting a network with high centrality #147

Closed mberaha closed 4 years ago

mberaha commented 4 years ago

Hi! I'm trying to fit a network (undirected), with 100 nodes such that some nodes are not connected to any other node and the other (the majority) nodes are connected only to node i .

I have tried dozens of combinations of features among ergm.terms, but once I try to simulate given the MLE estimate of the coefficients, I get completely different networks.

Can someone point me to some features that could lead to a nicer simulation result?

martinamorris commented 4 years ago

Hi Mario,

I'm not sure what you mean by "only connected to node i". Are you trying to get a network with specific i-j ties only?

best, mm

mberaha commented 4 years ago

Hi @martinamorris! Thanks for the super quick reply.

So the problem I am facing now is that I have several networks, among them there are some with the following behaviour

G[i^*, j] = 1 # for most values of j

and

G[i, j] = 0 # elsewhere (mostly)

For example

G = matrix(rbinom(100*100, 1, 0.05), nrow=100, ncol=100)
G[10, ] = rbinom(100, 1, 0.9]

my problem is to formalize an ERGM that can capture well this behaviour, and being a total beginner I'm not really sure which ergm.terms I should include

martinamorris commented 4 years ago

I'm still having a bit of trouble understanding your goal

mberaha commented 4 years ago

Hi again, sorry for the inconsistency, I will try to be clearer.

The following is a valid example of the network I'm trying to model:

G = matrix(rbinom(100*100, 1, 0.005), nrow=100, ncol=100)
G[10, ] = rbinom(100, 1, 0.9)

G = G+t(G)
y = network(G)

So that there is one particular node i^*, which in this case is node 10, that is connected to almost every other node. A part from this, the graph is practically empty elsewhere, meaning that for values of (i, j), with i different from i^*, I typically observe G[i, j] = 0.

I hope this i clearer, thanks a lot!

martinamorris commented 4 years ago

Thx for the clarification. And do you want a specific node to be the hub? Or any node, as long as the structure is hub-and-spoke?

mberaha commented 4 years ago

Yes any node would work to be the hub, as long as the graphs have this kind of topology!

martinamorris commented 4 years ago

G = matrix(rbinom(100*100, 1, 0.005), nrow=100, ncol=100) G[10, ] = rbinom(100, 1, 0.9) G = G+t(G) y = network(G, directed=F) degreedist(y) fit <- ergm(y ~ degree(0:5) + degree(91)) sims <- simulate(fit, nsim=10, stats = T) # just the stats here sims

delete the stats=T to get the networks.

mberaha commented 4 years ago

Thank you so much for your help, it works perfectly!