I am struggling with simulating networks, specifically using the ergm package. It seems that in order to simulate a network, we must first run a regression on some initial matrix, and then use that output in the "simulate" function. Below is an example:
fit <- ergm(flobusiness~edges+degree(1))
flomodel.03.sim <- simulate(flomodel.03,nsim=10)
But in this example, "flowbusiness" is some observed data. What if I don't have that, but I do know the parameters I want to use. So, what if I wanted to simulate a network with 30 nodes, with the triangles parameter=a, edges parameter=b, and so on? Is there a way to accomplish this? Thanks in advance.
You need 2 pieces:
net0
below). It is used as the initial point for the chain if you sample from a complex model.coef
argument (see ?ergm::simulate.formula
and ?ergm::simulate_formula
) to provide parameter values.For example:
net0 <- network.initialize(100, directed = FALSE) # Empty graph with 100 nodes
net <- simulate(
net0 ~ edges + triangles + degree(0),
coef = c(-4, - 0.3, -Inf) # Rather sparse, avoid triangles, no isolates
)
plot(net)