Last chance! 50% off unlimited learning
Sale ends in
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
can be passed to
simulate based on a particular parametr configuration.
# S3 method for ergmm
simulate(object, nsim = 1, seed = NULL, ...)# S3 method for ergmm.model
simulate(object, nsim = 1, seed = NULL, par, prior = list(), ...)
If nsim = 1
, simulate
returns an object of class
network
. Otherwise, an object of class
network.series
that is a list consisting of the following elements:
The formula used to generate the sample.
A list of the generated networks.
either an object of class ergmm
for posterior simulation, or an object of class
ergmm.model
for a specific model.
number of networks to draw (independently)
random seed to use; defaults to using the current state of the random number generator
Additional arguments. Currently unused.
a list with the parameter configuration based on which to simulate
a list with the prior distribution parameters that deviate from their defaults
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.
ergmm
, network
,
print.network
#
# Fit a short MCMC run: just the MCMC.
#
data(sampson)
gest <- ergmm(samplike ~ euclidean(d=2,G=3),
control=ergmm.control(burnin=100,interval=5,sample.size=100),tofit="mcmc")
#
# 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=sample[[1]],prior=prior))
plot(g.sim)
Run the code above in your browser using DataLab