Learn R Programming

latentnet (version 0.7-17)

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 ergmm 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 'ergmm': rergm(object, mkl = TRUE, n = 1, \dots)

Arguments

object
an R object. Either a number of nodes in the network, a formula or an ergmm object. See documentation for ergmm. 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.
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.
mkl
If this is TRUE, we will use the minimum Kullback-Leibler positions as the basis of the simulation (rather than the default MLE positions).
...
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 an ergmm object 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 ergmm.

See Also

ergmm, 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 <- ergmm(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