Draw a Simulation of Network Using Distribution Of An Exponential Family Random Graph Model Based on Observed Data
sim_ergm_network(fit, type_function)
object of ergm class produced by fitting model using ergm
function
function of igraph object g
that takes existing vertex attributes and transforms them into type
attribute in the binary coded format (consists of 0's and 1's only)
igraph network object with vertex attribute type
in the binary coded format (consists of 0's and 1's only)
if (FALSE) {
library(network)
library(ergm)
data('faux.magnolia.high')
fit <- ergm(faux.magnolia.high ~
edges +
gwesp(0.25,fixed=T) +
nodematch("Grade") + nodematch("Sex"),
control = control.ergm(MCMC.interval = 10000),
verbose = F)
sim_ergm_network(fit = fit,
type_function = function(g) {
paste0( as.integer(igraph::vertex_attr(g)$Sex == "M"),
as.integer(igraph::vertex_attr(g)$Grade == 9))})
}