ergm_propagate_ext.encode: Extended states for submodels

Description Usage Arguments Value Note Examples

View source: R/InitErgmTerm.operator.R

Description

ergm_propagate_ext.encode() is a convenience function to propagate the extended state encoder to submodels if they have any.

ergm_no_ext.encode() checks if a submodel contains terms that use extended states and stops with an informative error message if any do.

Usage

1
2
3

Arguments

submodel

the ergm_model to which the encoders should be propagated.

Value

ergm_propagate_ext.encode returns a list with one element, ext.encode containing a function that follows the extended state encoder API and simply returns a list of the subterms extended state encodings.

Note

ergm_propagate_ext.encode should only be used when the operator term does not modify the network and provides an x_function on the C level that does appropriate propagation and handles any return values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
# Typical usage:
InitErgmTerm.ABC <- function(nw, arglist, ...){
  [... implementation ...]
  m <- ergm_model([... etc. ...])
  c(list(name = "abc", inputs=1:3, submodel=m),
    ergm_propagate_ext.encode(m),
    wrap.ergm_model(nw, m)
  )
}

## End(Not run)

ergm documentation built on July 27, 2021, 5:07 p.m.