This is an internal function, not normally called directly by the
user. The ergm_MCMC_sample
function samples networks and
network statistics using an MCMC algorithm via MCMC_wrapper
and is caple of running in multiple threads using
ergm_MCMC_slave
.
The ergm_MCMC_slave
function calls the actual C
routine and does minimal preprocessing.
ergm_MCMC_sample(nw, model, proposal, control, theta = NULL,
response = NULL, update.nws = TRUE, verbose = FALSE, ...,
eta = ergm.eta(theta, model$etamap))ergm_MCMC_slave(Clist, proposal, eta, control, verbose, ...,
prev.run = NULL, burnin = NULL, samplesize = NULL,
interval = NULL, maxedges = NULL)
a network
object representing the sampler state.
an ergm_model
to be sampled from, as returned by
ergm_model()
.
a list of the parameters needed for
Metropolis-Hastings proposals and the result of calling
ergm_proposal()
.
list of MCMC tuning parameters; see
control.ergm()
.
the (possibly curved) parameters of the model.
Name of the edge attribute whose value is to be
modeled in the valued ERGM framework. Defaults to NULL
for
simple presence or absence, modeled via a binary ERGM.
whether to actually update the network state or to return an object "promising" to update the network.
verbosity level.
additional arugments.
the natural parameters of the model; by default constructed from theta
.
the list of parameters returned by
ergm.Cprepare
a summary of the state of the sampler allowing a
run to be resumed quickly by ergm_MCMC_slave
.
MCMC paramters that can
be used to temporarily override those in the control
list.
ergm_MCMC_sample
returns a list
containing:
an mcmc.list
with sampled statistics.
a list of final sampled networks, one for each thread.
status code, propagated from ergm.mcmcslave
.
adaptively determined MCMC interval.
If update.nws==FALSE, rather than returning the updated networks, the function will remove all edges from the input networks, attach a network attribute .update with the new edge information, and change class name to prevent the resulting object from being accessed or modified by functions that do not understand it.
ergm_MCMC_slave returns the MCMC sample as a list of the following:
the matrix of statistics.
the vector of tails for the new network.
the vector of heads for the new network.
the vector of weights for the new network (if applicable)
success or failure code: 0
is
success, 1
for too many edges, and 2
for a
Metropolis-Hastings proposal failing.
maximum allowed edges at the time of return.
Note that the returned stats will be relative to the original network, i.e., the calling function must shift the statistics if required. The calling function must also attach column names to the statistics matrix if required.