Learn R Programming

latentnet (version 0.6-0)

rergm: Draw from the distribution of an Exponential Family Random Graph Model

Description

rergm is used to draw from exponential family random network models in their natural parameterizations. See ergm for more information on these models.

Usage

rergm(object, ...)

## S3 method for class 'default': rergm(object,\dots,prob,theta0,n=1, directed=TRUE,numedges=NULL) ## S3 method for class 'ergm': rergm(object, \dots, theta0=NULL, n=1, burnin=1000, interval=1000, randseed=NULL, sequential=TRUE, summarizestats=FALSE, verbose=FALSE)

Arguments

object
an R object. Either a number of nodes in the network, a formula or an ergm object. See documentation for ergm. If the number of nodes in the network is given then Bernoulli networks are drawn.
prob
The probability of a link for Bernoulli networks. Defaults to 0.5 if neither prob nor theta0 are given.
theta0
For Bernoulli networks this is the log-odds of a tie, however it is only used if prob is not specified. When given either a formula or an object of class ergm, theta0 are the parameters from which the sample is drawn.
directed
Whether the Bernoulli network should be directed or undirected.
numedges
If present, sample the network(s) conditional on this number of edges (rather than independently with the specified probability).
n
Size of the sample of networks to be randomly drawn from the given distribution on the set of all networks, returned by the Metropolis-Hastings algorithm.
burnin
The number of proposed proposals before any MCMC sampling is done. Currently, there is no support for any check of the Markov chain mixing, so burnin should be set to a fairly large number.
interval
The number of proposals between sampled statistics. The program prints a warning if too few proposals are being accepted (if the number of proposals between sampled observations ever equals an integral multiple of 100(1+the number of proposals
randseed
Random number integer seed. The default is sample(10000000, size=1).
sequential
Should the returned draws use the prior draw as the starting network or always use the initially passed network? For random draws the results should be similar (stochastically), but the sequential=TRUE option is useful for dynamic d
summarizestats
Print out a summary of the sufficient statistics of the generated network. This is useful as a diagnostic.
verbose
If this is TRUE, we will print out more information as we run the program, including (currently) some goodness of fit statistics.
...
further arguments passed to or used by methods.

Value

  • rergm returns an object of class network.series that is a list consisting of the following elements:
  • $formulaThe formula used to generate the sample.
  • $networksA list of the generated networks.
  • $statsThe $n\times p$ matrix of network change statistics, where $n$ is the sample size and $p$ is the number of network change statistics specified in the model.

Details

A sample of networks is randomly drawn from the specified model. The model is either specified by the first argument of the function. If the first argument is a formula then this defines the model. If this is not given as the first argument then a Bernoulli network is generated with the probability of ties defined by prob or theta0.

Note that the first network is sampled after burnin + interval steps, and any subsequent networks are sampled each interval steps after the first.

More information can be found by looking at the documentation of ergm.

See Also

ergm, network, print.network

Examples

Run this code
#
# Let's draw from a Bernoulli model with 16 nodes
# and tie probability 0.1
#
g.use <- rergm(16,prob=0.1,directed=FALSE)
#
data(sampson)
gest <- ergm(samplike ~ latent(k=2))
summary(gest)
#
# Draw from the fitted model
#
g.sim <- rergm(gest,n=100,burnin=1000,interval=1000)
g.sim

Run the code above in your browser using DataLab