Learn R Programming

latentnet (version 2.0)

simulate: Draw from the distribution of an Exponential Random Graph Mixed Model

Description

If passed a ergmm fit object, simulate is used to simulate networks from the posterior of an exponetial random graph mixed model fit. Alternatively, a ergmm.model object can be passed to simulate based on a particular parametr configuration.

Usage

## S3 method for class 'ergmm':
simulate(object, nsim = 1, seed = NULL,\dots)
## S3 method for class 'ergmm.model':
simulate(object,nsim=1,seed=NULL,par,prior=ergmm.par.blank(),...)

Arguments

object
either an object of class ergmm for posterior simulation, or an object of class ergmm.model for a specific model.
nsim
number of networks to draw (independently)
seed
random seed to use; defaults to using the current state of the random number generator
par
an object of class ergmm.par with the parameter configuration based on which to simulate
prior
an object of class ergmm.par with the prior distribution parameters that deviate from their defaults
...
Additional arguments. Currently unused.

Value

  • If nsim = 1, simulate returns an object of class network. Otherwise, a network.series that is a list consisting of the following elements:
  • $formulaThe formula used to generate the sample.
  • $networksA list of the generated networks.

Details

A sample of networks is randomly drawn from the specified model. If a needed value of par is missing, it is generated from its prior distribution.

See Also

ergmm, network, print.network

Examples

Run this code
#
data(sampson)
gest <- ergmm(samplike ~ latent(d=2,G=3))
summary(gest)
#
# Draw from the posterior
#
g.sim <- simulate(gest)
plot(g.sim)
#
# Draw from the first draw from the posterior
#
g.sim <- with(gest,simulate(model,par=samples[[1]],prior=prior))
plot(g.sim)

Run the code above in your browser using DataLab