Learn R Programming

ergm (version 4.8.1)

ergm_model: Internal representation of an ergm network model

Description

These methods are generally not called directly by users, but may be employed by other depending packages. ergm_model constructs it from a formula or a term list. Each term is initialized via the InitErgmTerm functions to create a ergm_model object.

Usage

ergm_model(object, nw = NULL, ..., formula = NULL)

# S3 method for formula ergm_model(object, nw = NULL, ...)

# S3 method for term_list ergm_model( object, nw = NULL, silent = FALSE, ..., term.options = list(), env = globalenv(), extra.aux = list(), offset.decorate = TRUE, terms.only = FALSE )

# S3 method for ergm_model ergm_model( object, nw, ..., env = globalenv(), extra.aux = list(), offset.decorate = TRUE, terms.only = FALSE )

# S3 method for ergm_model c(...)

as.ergm_model(x, ...)

# S3 method for ergm_model as.ergm_model(x, ...)

# S3 method for formula as.ergm_model(x, ...)

# S3 method for ergm_model is.curved(object, ...)

# S3 method for ergm_model is.dyad.independent(object, byterm = FALSE, ..., ignore_aux = TRUE)

# S3 method for ergm_model nparam(object, canonical = FALSE, offset = NA, byterm = FALSE, ...)

# S3 method for ergm_model param_names(object, canonical = FALSE, offset = NA, ...)

# S3 method for ergm_model param_names(object, canonical = FALSE, ...) <- value

Value

ergm_model returns an ergm_model object as a list containing:

terms

a list of terms and 'term components' initialized by the appropriate InitErgmTerm.X function.

etamap

the theta -> eta mapping as a list returned from <ergm.etamap>

term.options

the term options used to initialize the terms

uid

a string generated with the model, concatenating the UNIX time (Sys.time()) to maximum available precision, process ID (Sys.getpid()), and a counter that starts at -.Machine$integer.max and increments by 1 with every call; different models are, generally, guaranteed to have different strings, but identical models are not guaranteed to have the same string

Arguments

object

An ergm_model object.

nw

The network of interest, optionally instrumented with ergm_preprocess_response() to have a response attribute specification; if passed, the LHS of formula is ignored. This is the recommended usage.

...

additional parameters for model formulation

formula

An ergm() formula of the form network ~ model.term(s) or ~ model.term(s) or a term_list object, typically constructed from a formula's LHS.

silent

logical, whether to print the warning messages from the initialization of each model term.

term.options

A list of additional arguments to be passed to term initializers. See ? term.options.

env

a throwaway argument needed to prevent conflicts with some usages of ergm_model. The initialization environment is always taken from the formula.

extra.aux

a list of auxiliary request formulas required elsewhere; if named, the resulting slots.extra.aux will also be named.

offset.decorate

logical; whether offset coefficient and parameter names should be enclosed in "offset()".

terms.only

logical; whether auxiliaries, eta map, and UID constructions should be skipped. This is useful for submodels.

x

object to be converted to an ergm_model.

byterm

Whether to return the result for each term individually.

ignore_aux

A flag to specify whether a dyad-dependent auxiliary should make the model dyad-dependent or should be ignored.

canonical

Whether the canonical (eta) parameters or the curved (theta) parameters are used.

offset

If NA (the default), all model terms are counted; if TRUE, only offset terms are counted; and if FALSE, offset terms are skipped.

value

For param_names<-(), either a character vector equal in length to the number of parameters of the specified type (though recycled as needed), or a list of two character vectors, one for non-canonical, the other for canonical, in which case canonical= will be ignored. NA elements preserve existing name.

Methods (by class)

  • ergm_model(formula): a method for formula: extracts the network and the term_list and passes it on to the next method.

  • ergm_model(term_list): a method for term_list: nw= is mandatory; initializes the terms in the list and passes it on to the next method.

  • ergm_model(ergm_model): a method for term_list: nw= is mandatory, and term.options= must be a part of the ergm_model object, with ... ignored; (re)generates the auxiliaries and, the eta map, and the unique ID; and decorates offsets.

Methods (by generic)

  • c(ergm_model): A method for concatenating terms of two or more initialized models.

  • is.curved(ergm_model): Tests whether the model is curved.

  • is.dyad.independent(ergm_model): Tests whether the model is dyad-independent.

  • nparam(ergm_model): Number of parameters of the model.

  • param_names(ergm_model): Parameter names of the model.

  • param_names(ergm_model) <- value: Rename the parameters.

See Also

summary.ergm_model(), ergm_preprocess_response()