Learn R Programming

ergm (version 3.6.1)

ergm.getMCMCsample: Internal Function to Sample Networks Using C Wrapper

Description

This is an internal function, not normally called directly by the user. The ergm.getMCMCsample function samples networks using an MCMC algorithm via MCMC_wrapper.C and is caple of running in multiple threads using ergm.mcmcslave.

The ergm.mcmcslave function is that which the slave nodes in a parallel process will call to perform a validation on the mcmc equal to their slave number. It also returns an MCMC sample.

Usage

ergm.getMCMCsample(nw, model, MHproposal, eta0, control, verbose, response = NULL, ...)
ergm.mcmcslave(Clist, MHproposal, eta0, control, verbose, ..., prev.run = NULL, burnin = NULL, samplesize = NULL, interval = NULL, maxedges = NULL)

Arguments

nw
a network object
model
a model for the given 'nw' as returned by
MHproposal
a list of the parameters needed for Metropolis-Hastings proposals and the result of calling
eta0
the initial eta coefficients
control
list of MCMC tuning parameters; (see control.ergm)
verbose
whether the C functions should be verbose; default=FALSE
response
characher, name of an edge attribute
...
additional arugments?
Clist
the list of parameters returned by ergm.Cprepare
prev.run
output stats from previous run ???
burnin
number of proposals before any MCMC sampling is done. see control.ergm MCMC.burnin
samplesize
number of network statistics, randomly drawn from a given distribution on the set of all networks, returned by the Metropolis-Hastings algorithm. see control.ergm MCMC.samplesize
interval
number of proposals between sampled statistics. see control.ergm MCMC.interval
maxedges
maximum number of edges expected in network. see control.ergm MCMC.init.maxedges

Value

for ergm.getMCMCsample,the sample as a list containing:
  • statsmatrix: the stats matrix for the sampled networks, RELATIVE TO THE ORIGINAL NETWORK!
  • newnetwork : the edgelist of the final sampled network
  • nedges : the number of edges in the 'newnetwork'
for ergm.mcmcslave the MCMC sample as a list of the following:
  • s : the statsmatrix
  • newnwtails: the vector of tails for the new network- is this the final network sampled? - is this the original nw if 'maxedges' is 0
  • newnwheads: the vector of heads for the new network - same q's

Details

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.