ergm_state: A Representation of ERGM state

View source: R/ergm_state.R

ergm_stateR Documentation

A Representation of ERGM state

Description

ergm_state is a family of semi-internal classes for passing around results of MCMC sampling, particularly when the result is used to start another MCMC sampler. It is deliberately loosely specified, and its structure and even name are subject to change.

Usage

ergm_state(x, ...)

## S3 method for class 'edgelist'
ergm_state(
  x,
  nw0,
  model = NULL,
  proposal = NULL,
  stats = NULL,
  ext.state = NULL,
  ...
)

## S3 method for class 'matrix'
ergm_state(
  x,
  nw0,
  model = NULL,
  proposal = NULL,
  stats = NULL,
  ext.state = NULL,
  ...
)

## S3 method for class 'network'
ergm_state(x, ...)

is.ergm_state(x)

## S3 method for class 'ergm_state'
as.edgelist(x, ...)

## S3 method for class 'ergm_state'
as.matrix(x, matrix.type = NULL, ...)

## S3 method for class 'ergm_state_full'
as.network(x, ..., populate = TRUE)

## S3 method for class 'ergm_state'
network.edgecount(x, na.omit = TRUE, ...)

## S3 method for class 'ergm_state_full'
network.dyadcount(x, na.omit = TRUE, ...)

## S3 method for class 'ergm_state_full'
network.size(x, ...)

## S3 method for class 'ergm_state'
network.naedgecount(x, ...)

## S3 method for class 'ergm_state_full'
lhs %ergmlhs% setting

## S3 method for class 'ergm_state_full'
lhs %ergmlhs% setting <- value

## S3 method for class 'ergm_state'
as.rlebdm(x, ...)

## S3 method for class 'ergm_state_send'
as.ergm_model(x, ...)

## S3 method for class 'ergm_state_send'
is.curved(object, ...)

## S3 method for class 'ergm_state_send'
param_names(object, ...)

## S3 method for class 'ergm_state_send'
nparam(object, ...)

## S3 method for class 'ergm_state_full'
update(
  object,
  el = NULL,
  nw0 = NULL,
  model = NULL,
  proposal = NULL,
  stats = NULL,
  ext.state = NULL,
  state = NULL,
  ...
)

## S3 method for class 'ergm_state'
ergm_state(x, model = NULL, proposal = NULL, stats = NULL, ...)

ERGM_STATE_R_CHANGED

ERGM_STATE_C_CHANGED

ERGM_STATE_RECONCILED

ergm_state_send(x, ...)

## S3 method for class 'ergm_state_send'
ergm_state_send(x, ...)

## S3 method for class 'ergm_state_full'
ergm_state_send(x, ...)

## S3 method for class 'ergm_state_receive'
ergm_state_send(x, ...)

## S3 method for class 'ergm_state_send'
update(object, state, ...)

ergm_state_receive(x, ...)

## S3 method for class 'ergm_state'
ergm_state_receive(x, ...)

## S3 method for class 'ergm_state_full'
ergm_state_receive(x, ...)

## S3 method for class 'ergm_state'
summary(object, ...)

Arguments

...

Additional arguments, passed to further methods.

nw0

a network object, whose edges are absent or ignored.

model

an ergm_model object.

ext.state

a list equal to the number of terms in the model, providing the encoded extended state. This vector is usually generated by ext.encode() function of an ergm term, but it can be specified directly.

na.omit

Whether missing edges should be counted. Note that missing edge information is not stored.

state

An ergm_state to replace the state with.

Format

An object of class integer of length 1.

An object of class integer of length 1.

An object of class integer of length 1.

Details

ergm_state is actually a hierarchy of classes, defined by what they can be used for. Specifically,

c(ergm_state_receive,ergm_state)

needs to contain only el, ext.state, and ext.flag: it is the information that can change in the process of MCMC sampling; it is the one returned by the ⁠*_slave⁠ functions, to minimize the amount of data being sent between nodes in parallel computing.

c(ergm_state_send,ergm_state_receive,ergm_state)

needs the above but also the model and the proposal: is needed to initiate MCMC sampling; it is the information required by the ⁠*_slave⁠ functions, again, to minimize the amount of data being sent between nodes in parallel computing.

c(ergm_state_full, ergm_state_send,ergm_state_receive,ergm_state)

needs the above but also the nw0: is needed to reconstruct the original network.

Value

At this time, an ergm_state object is (subject to change) a list containing some subset of the following elements, with el, ext.state, and ext.flag mandatory and others depending on how it is used:

el

a tibble edgelist representing the edge state of the network

nw0

a network object with all edges removed.

model

an ergm_model object.

proposal

an ergm_proposal object.

ext.state

a list of length equalling to the number of terms in the model.

ext.flag

one of ERGM_STATE_R_CHANGED, ERGM_STATE_C_CHANGED, and ERGM_STATE_R_RECONCILED.

stats

a numeric vector of network statistics or some other statistics used to resume.

uids

a named list of globally unique ID strings associated with a model and/or proposal; for the ergm_state_send and ergm_state_receive, these strings may be retained even if these values are set to NULL

Methods (by class)

  • ergm_state(edgelist): a method for constructing an ergm_state from an edgelist object and an empty network.

  • ergm_state(matrix): a method for constructing an ergm_state from a matrix object and an empty network.

  • ergm_state(network): a method for constructing an ergm_state from a network object. Note that ... arguments will be passed directly to the edgelist method.

  • ergm_state(ergm_state): a method for constructing an ergm_state.

Methods (by generic)

  • network.edgecount(ergm_state): Note that this method fails when na.omit=FALSE, since missing edges are not stored.

  • network.naedgecount(ergm_state): A stub that returns 0.

  • summary(ergm_state): a very low-level function that calculates summary statistics associated with an ergm_state object.

Functions

  • network.dyadcount(ergm_state_full): Note that this method fails with its default argument, since missing edges are not stored.

  • update(ergm_state_full): a method for updating an ergm_state and reconciling extended state.

See Also

ergm_MCMC_sample() for an example of manually constructing and manipulating an ergm_state.


ergm documentation built on Oct. 7, 2024, 5:08 p.m.