Learn R Programming

ergm.ego (version 1.1.4)

simulate.ergm.ego: Simulate from a ergm.ego() fit.

Description

A wrapper around simulate.formula() to simulate networks from an ERGM fit using ergm.ego().

Usage

# S3 method for ergm.ego
simulate(
  object,
  nsim = 1,
  seed = NULL,
  constraints = object$constraints,
  popsize = if (object$popsize == 1 || object$popsize == 0 || is(object$popsize, "AsIs"))
    object$ppopsize else object$popsize,
  control = control.simulate.ergm.ego(),
  output = c("network", "stats", "edgelist", "pending_update_network", "ergm_state"),
  ...,
  basis = NULL,
  verbose = FALSE
)

Value

The ouput has the same format (with the same options) as simulate.formula(). If output="stats" is passed, an additional attribute, "ppopsize" is set, giving the actual size of the network reconstructed, when the pop.wt control parameter is set to "round" and "popsize" is not a multiple of the egocentric sample size or the sampling weights.

Arguments

object

An ergm.ego fit.

nsim

Number of realizations to simulate.

seed

Seed value (integer) for the random number generator. See set.seed().

constraints, ...

Additional arguments passed to san() and simulate.formula().

popsize, basis

A network size to which to scale the model for simulation; a data.frame with at least those ego attributes used to estimate the model to simulate over a specific set of actors; or a network object to use as is. basis is provided for consistency with ergm(), ergm.ego(), simulate.ergm(), and others. If both are specified, popsize overrules.

control

A control.simulate.ergm.ego() control list.

output

one of "network", "stats", "edgelist", "pending_update_network", or, for future compatibility, "ergm_state". See help for simulate.ergm() for explanation.

verbose

A logical or an integer to control the amount of progress and diagnostic information to be printed. FALSE/0 produces minimal output, with higher values producing more detail. Note that very high values (5+) may significantly slow down processing.

Author

Pavel N. Krivitsky

References

KrMo2017ergm.ego

KrMoBo2019ergm.ego

KrHaMo2011ergm.ego

See Also

simulate.formula(), simulate.ergm()

Examples

Run this code

data(faux.mesa.high)
data(fmhfit)
colMeans(egosim <- simulate(fmhfit, popsize=300,nsim=50,
                       output="stats", control=control.simulate.ergm.ego(
                       simulate=control.simulate.formula(MCMC.burnin=2e6))))
colMeans(egosim)/attr(egosim,"ppopsize")*network.size(faux.mesa.high)
summary(faux.mesa.high~edges+degree(0:3)+nodefactor("Race")+nodematch("Race")
           +nodefactor("Sex")+nodematch("Sex")+absdiff("Grade"))

Run the code above in your browser using DataLab