new_rergmito {ergmito}R Documentation

ERGMito sampler

Description

Create a sampler object that allows you simulating streams of small networks fast.

Usage

new_rergmito(model, theta, ...)

## S3 method for class 'ergmito_sampler'
x[i, ...]

Arguments

model

A formula.

theta

Named vector. Model parameters.

...

Further arguments passed to ergmito_formulae().

x

An object of class ergmito_sampler.

i

i is an integer vector indicating the indexes of the networks to draw.

Details

While the ergm package is very efficient, it was not built to do some of the computations required in the ergmito package. This translates in having some of the functions of the package (ergm) with poor speed performance. This led us to "reinvent the wheel" in some cases to speed things up, this includes calculating observed statistics in a list of networks.

The indexing method, ⁠[.ergmito_sampler⁠, allows extracting networks directly by passing indexes. i indicates the index of the networks to draw, which go from 1 through 2^(n*(n-1)) if directed and 2^(n*(n-1)/2) if undirected .

Value

An environment with the following objects:

The indexing method ⁠[.ergmito_sampler⁠ returns a list of networks

Examples


# We can generate a sampler from a random graph
set.seed(7131)
ans <- new_rergmito(rbernoulli(4) ~ edges, theta = -.5)

# Five samples
ans$sample(5)

# or we can use some nodal data:
data(fivenets)
ans <- new_rergmito(
  fivenets[[3]] ~ edges + nodematch("female"),
  theta = c(-1, 1)
)

# Five samples
ans$sample(5) # All these networks have a "female" vertex attr


[Package ergmito version 0.3-1 Index]