simulate_bigergm {bigergm} | R Documentation |
Simulate networks under Exponential Random Graph Models (ERGMs) under local dependence
Description
This function simulates networks under Exponential Random Graph Models (ERGMs) with local dependence.
There is also an option to simulate only within-block networks and a S3 method for the class bigergm
.
Usage
simulate_bigergm(
formula,
coef_within,
coef_between,
network = ergm.getnetwork(formula),
control_within = ergm::control.simulate.formula(),
only_within = FALSE,
seed = NULL,
nsim = 1,
output = "network",
verbose = 0,
...
)
Arguments
formula |
An R |
coef_within |
a vector of within-block parameters. The order of the parameters should match that of the formula. |
coef_between |
a vector of between-block parameters. The order of the parameters should match that of the formula without externality terms. |
network |
a network object to be used as a seed network for the simulation (if none is provided, the network on the lhs of the |
control_within |
auxiliary function as user interface for fine-tuning ERGM simulation for within-block networks. |
only_within |
If this is TRUE, only within-block networks are simulated. |
seed |
seed value (integer) for network simulation. |
nsim |
number of networks generated. |
output |
Normally character, one of "network" (default), "stats", "edgelist", to determine the output format. |
verbose |
If this is TRUE/1, the program will print out additional information about the progress of simulation. |
... |
Additional arguments, passed to |
Value
Simulated networks, the output form depends on the parameter output
(default is a list of networks).
References
Morris M, Handcock MS, Hunter DR (2008). Specification of Exponential-Family Random Graph Models: Terms and Computational Aspects. Journal of Statistical Software, 24.
Examples
data(toyNet)
# Specify the model that you would like to estimate.
model_formula <- toyNet ~ edges + nodematch("x") + nodematch("y") + triangle
# Simulate network stats
sim_stats <- bigergm::simulate_bigergm(
formula = model_formula,
# Formula for the model
coef_between = c(-4.5,0.8, 0.4),
# The coefficients for the between connections
coef_within = c(-1.7,0.5,0.6,0.15),
# The coefficients for the within connections
nsim = 10,
# Number of simulations to return
output = "stats",
# Type of output
)