Description

Categories

B(formula, form)
Wraps binary ergm terms for use in valued models, with formula specifying which terms are to be wrapped and form specifying how they are to be used and how the binary network they are evaluated on is to be constructed. More precisely,

formula

A onesided formula whose RHS contains the binary ergm terms to be used. Which terms may be used depends on the argument form .

form

One of three values:

“sum”

see section “Generalizations of binary terms” above; all terms in formula must be dyadindependent.

“nonzero”

section “Generalizations of binary terms” above; any binary ergm terms may be used in formula .

a onesided formula

valuedependent network. form must contain one valued ergm term, with the following properties:
Formally, this means that it is expressable as
sum[i,j] f[i,j] (y[i,j]),
, where for all i, j, and y, f_{i,j}(y_{i,j}) is either 0 or 1 and, in particular, f[i,j] (0)=0.
Examples of such terms include nonzero , ininterval() , atleast() , atmost() , greaterthan() , lessthen() , and equalto() .
Then, the value of the statistic will be the value of the statistics in formula evaluated on a binary network that is defined to have an edge if and only if the corresponding dyad of the valued network adds 1 to the valued term in form .
For example, B(~nodecov(“a”), form=“sum”) is equivalent to nodecov(“a”, form=“sum”) and similarly with form=“nonzero” .
When a valued implementation is available, it should be preferred, as it is likely to be faster.

valued, operator

Parametrize(formula, params, map, gradient=NULL, minpar=Inf, maxpar=+Inf, cov=NULL)
Impose a curved structure on term parameters.
formula is an arbitrary formula for a linear or curved ERGM. params , map , gradient , minpar , maxpar , and cov are the curved ERGM term API: a named list whose names are the curved parameter names, the mapping from curved to canonical, its gradient function, the minimum and the maximum allowed curved parameter values, and an optional “covariate” object.
Arguments may have the same forms as in the API, but for convenience, alternative forms are accepted.

params

may also be a character verctor with names.

minpar and maxpar

will be recycled to appropriate length.

map

may have the following forms:

a
function(x, n, …)

treated as in the API: called with x set to the curved parameter vector, n to the length of output expected, and cov , if present, passed in … . The function must return a numeric vector of length n .

a numeric vector

to fix the output coefficients, like in an offset.

a character string

to select (partiallymatched) one of predefined forms. Currently, the defined forms include:

“rep”

recycle the input vector to the length of the output vector as a rep function would.

gradient

is optional if map is constant or one of the predefined forms; otherwise, it must have one of the following forms:

a
function(x, n, …)

treated as in the API: called with x set to the curved parameter vector, n to the length of output expected, and cov , if present, passed in … . The function must return a numeric matrix with length(params) rows and n columns.

a numeric matrix

to fix the gradient; this is useful when map is linear.

a character string

to select (partiallymatched) one of predefined forms. Currently, the defined forms include:

“linear”

calculate the (constant) gradient matrix using finite differences. Note that this will be done only once at the initialization stage, so use only if you are certain map is, in fact, linear.
If the model in formula is curved, then the outputs of this operator term’s map argument will be used as inputs to the curved terms of the formula model.
Curve is an obsolete alias and may be deprecated and removed in a future release.

binary, operator

Parametrise(formula, params, map, gradient=NULL, minpar=Inf, maxpar=+Inf, cov=NULL)
Impose a curved structure on term parameters.
formula is an arbitrary formula for a linear or curved ERGM. params , map , gradient , minpar , maxpar , and cov are the curved ERGM term API: a named list whose names are the curved parameter names, the mapping from curved to canonical, its gradient function, the minimum and the maximum allowed curved parameter values, and an optional “covariate” object.
Arguments may have the same forms as in the API, but for convenience, alternative forms are accepted.

params

may also be a character verctor with names.

minpar and maxpar

will be recycled to appropriate length.

map

may have the following forms:

a
function(x, n, …)

treated as in the API: called with x set to the curved parameter vector, n to the length of output expected, and cov , if present, passed in … . The function must return a numeric vector of length n .

a numeric vector

to fix the output coefficients, like in an offset.

a character string

to select (partiallymatched) one of predefined forms. Currently, the defined forms include:

“rep”

recycle the input vector to the length of the output vector as a rep function would.

gradient

is optional if map is constant or one of the predefined forms; otherwise, it must have one of the following forms:

a
function(x, n, …)

treated as in the API: called with x set to the curved parameter vector, n to the length of output expected, and cov , if present, passed in … . The function must return a numeric matrix with length(params) rows and n columns.

a numeric matrix

to fix the gradient; this is useful when map is linear.

a character string

to select (partiallymatched) one of predefined forms. Currently, the defined forms include:

“linear”

calculate the (constant) gradient matrix using finite differences. Note that this will be done only once at the initialization stage, so use only if you are certain map is, in fact, linear.
If the model in formula is curved, then the outputs of this operator term’s map argument will be used as inputs to the curved terms of the formula model.
Curve is an obsolete alias and may be deprecated and removed in a future release.

binary, operator

Curve(formula, params, map, gradient=NULL, minpar=Inf, maxpar=+Inf, cov=NULL)
Impose a curved structure on term parameters.
formula is an arbitrary formula for a linear or curved ERGM. params , map , gradient , minpar , maxpar , and cov are the curved ERGM term API: a named list whose names are the curved parameter names, the mapping from curved to canonical, its gradient function, the minimum and the maximum allowed curved parameter values, and an optional “covariate” object.
Arguments may have the same forms as in the API, but for convenience, alternative forms are accepted.

params

may also be a character verctor with names.

minpar and maxpar

will be recycled to appropriate length.

map

may have the following forms:

a
function(x, n, …)

treated as in the API: called with x set to the curved parameter vector, n to the length of output expected, and cov , if present, passed in … . The function must return a numeric vector of length n .

a numeric vector

to fix the output coefficients, like in an offset.

a character string

to select (partiallymatched) one of predefined forms. Currently, the defined forms include:

“rep”

recycle the input vector to the length of the output vector as a rep function would.

gradient

is optional if map is constant or one of the predefined forms; otherwise, it must have one of the following forms:

a
function(x, n, …)

treated as in the API: called with x set to the curved parameter vector, n to the length of output expected, and cov , if present, passed in … . The function must return a numeric matrix with length(params) rows and n columns.

a numeric matrix

to fix the gradient; this is useful when map is linear.

a character string

to select (partiallymatched) one of predefined forms. Currently, the defined forms include:

“linear”

calculate the (constant) gradient matrix using finite differences. Note that this will be done only once at the initialization stage, so use only if you are certain map is, in fact, linear.
If the model in formula is curved, then the outputs of this operator term’s map argument will be used as inputs to the curved terms of the formula model.
Curve is an obsolete alias and may be deprecated and removed in a future release.

binary, operator

Parametrize(formula, params, map, gradient=NULL, minpar=Inf, maxpar=+Inf, cov=NULL)
Impose a curved structure on term parameters.
formula is an arbitrary formula for a linear or curved ERGM. params , map , gradient , minpar , maxpar , and cov are the curved ERGM term API: a named list whose names are the curved parameter names, the mapping from curved to canonical, its gradient function, the minimum and the maximum allowed curved parameter values, and an optional “covariate” object.
Arguments may have the same forms as in the API, but for convenience, alternative forms are accepted.

params

may also be a character verctor with names.

minpar and maxpar

will be recycled to appropriate length.

map

may have the following forms:

a
function(x, n, …)

treated as in the API: called with x set to the curved parameter vector, n to the length of output expected, and cov , if present, passed in … . The function must return a numeric vector of length n .

a numeric vector

to fix the output coefficients, like in an offset.

a character string

to select (partiallymatched) one of predefined forms. Currently, the defined forms include:

“rep”

recycle the input vector to the length of the output vector as a rep function would.

gradient

is optional if map is constant or one of the predefined forms; otherwise, it must have one of the following forms:

a
function(x, n, …)

treated as in the API: called with x set to the curved parameter vector, n to the length of output expected, and cov , if present, passed in … . The function must return a numeric matrix with length(params) rows and n columns.

a numeric matrix

to fix the gradient; this is useful when map is linear.

a character string

to select (partiallymatched) one of predefined forms. Currently, the defined forms include:

“linear”

calculate the (constant) gradient matrix using finite differences. Note that this will be done only once at the initialization stage, so use only if you are certain map is, in fact, linear.
If the model in formula is curved, then the outputs of this operator term’s map argument will be used as inputs to the curved terms of the formula model.
Curve is an obsolete alias and may be deprecated and removed in a future release.

binary, operator

Parametrise(formula, params, map, gradient=NULL, minpar=Inf, maxpar=+Inf, cov=NULL)
Impose a curved structure on term parameters.
formula is an arbitrary formula for a linear or curved ERGM. params , map , gradient , minpar , maxpar , and cov are the curved ERGM term API: a named list whose names are the curved parameter names, the mapping from curved to canonical, its gradient function, the minimum and the maximum allowed curved parameter values, and an optional “covariate” object.
Arguments may have the same forms as in the API, but for convenience, alternative forms are accepted.

params

may also be a character verctor with names.

minpar and maxpar

will be recycled to appropriate length.

map

may have the following forms:

a
function(x, n, …)

treated as in the API: called with x set to the curved parameter vector, n to the length of output expected, and cov , if present, passed in … . The function must return a numeric vector of length n .

a numeric vector

to fix the output coefficients, like in an offset.

a character string

to select (partiallymatched) one of predefined forms. Currently, the defined forms include:

“rep”

recycle the input vector to the length of the output vector as a rep function would.

gradient

is optional if map is constant or one of the predefined forms; otherwise, it must have one of the following forms:

a
function(x, n, …)

treated as in the API: called with x set to the curved parameter vector, n to the length of output expected, and cov , if present, passed in … . The function must return a numeric matrix with length(params) rows and n columns.

a numeric matrix

to fix the gradient; this is useful when map is linear.

a character string

to select (partiallymatched) one of predefined forms. Currently, the defined forms include:

“linear”

calculate the (constant) gradient matrix using finite differences. Note that this will be done only once at the initialization stage, so use only if you are certain map is, in fact, linear.
If the model in formula is curved, then the outputs of this operator term’s map argument will be used as inputs to the curved terms of the formula model.
Curve is an obsolete alias and may be deprecated and removed in a future release.

binary, operator

Curve(formula, params, map, gradient=NULL, minpar=Inf, maxpar=+Inf, cov=NULL)
Impose a curved structure on term parameters.
formula is an arbitrary formula for a linear or curved ERGM. params , map , gradient , minpar , maxpar , and cov are the curved ERGM term API: a named list whose names are the curved parameter names, the mapping from curved to canonical, its gradient function, the minimum and the maximum allowed curved parameter values, and an optional “covariate” object.
Arguments may have the same forms as in the API, but for convenience, alternative forms are accepted.

params

may also be a character verctor with names.

minpar and maxpar

will be recycled to appropriate length.

map

may have the following forms:

a
function(x, n, …)

treated as in the API: called with x set to the curved parameter vector, n to the length of output expected, and cov , if present, passed in … . The function must return a numeric vector of length n .

a numeric vector

to fix the output coefficients, like in an offset.

a character string

to select (partiallymatched) one of predefined forms. Currently, the defined forms include:

“rep”

recycle the input vector to the length of the output vector as a rep function would.

gradient

is optional if map is constant or one of the predefined forms; otherwise, it must have one of the following forms:

a
function(x, n, …)

treated as in the API: called with x set to the curved parameter vector, n to the length of output expected, and cov , if present, passed in … . The function must return a numeric matrix with length(params) rows and n columns.

a numeric matrix

to fix the gradient; this is useful when map is linear.

a character string

to select (partiallymatched) one of predefined forms. Currently, the defined forms include:

“linear”

calculate the (constant) gradient matrix using finite differences. Note that this will be done only once at the initialization stage, so use only if you are certain map is, in fact, linear.
If the model in formula is curved, then the outputs of this operator term’s map argument will be used as inputs to the curved terms of the formula model.
Curve is an obsolete alias and may be deprecated and removed in a future release.

valued, operator

Exp(formula)
Exponentiate a network’s statistic: Evaluate the terms specified in formula and exponentiates them with base e.

binary, operator

Exp(formula)
Exponentiate a network’s statistic: Evaluate the terms specified in formula and exponentiates them with base e.

valued, operator

F(formula, filter)
Filtering on arbitrary oneterm model. filter must contain one binary ergm term, with the following properties:
Formally, this means that it is expressable as
sum[i,j] f[i,j] (y[i,j]),
where for all i, j, and y, f_{i,j}(y_{i,j}) for which f[i,j] (0)=0.
Examples of such terms include nodemix , nodematch , nodefactor , and nodecov and edgecov with appropriate covariates.
formula will be evaluated on a network constructed by taking y and removing any edges for which f[i,j] (y[i,j])=0.
For convenience, the term in filter can be a part of a simple logical or comparison operation: (e.g., ~!nodematch(“A”) or ~absdiff(“X”)>3 ), which filters on f[i,j] (y[i,j]) %OP% 0 instead.

binary, operator

Log(formula, log0=1/sqr)
Take a natural logarithm of a network’s statistic: Evaluate the terms specified in formula and takes a natural (base e) logarithm of them. Since an ERGM statistic must be finite, log0 specifies the value to be substituted for log(0) . The default value seems reasonable for most purposes.

binary, operator

Log(formula, log0=1/sqr)
Take a natural logarithm of a network’s statistic: Evaluate the terms specified in formula and takes a natural (base e) logarithm of them. Since an ERGM statistic must be finite, log0 specifies the value to be substituted for log(0) . The default value seems reasonable for most purposes.

valued, operator

Prod(formulas, label)
A product (or an arbitrary power combination) of one or more formulas:
formulas is a list of formulas whose corresponding RHS statistics will be multiplied elementwise. They are required to be nonnegative.
If a formula has an LHS, it is interpreted as follows:

a numeric scalar

Network statistics of this formula will be exponentiated by this.

a numeric vector

Corresponding network statistics of this formula will be exponentiated by this.

a numeric matrix

Vector of network statistics will be exponentiated by this using the same pattern as matrix multiplication.

a character string

One of several predefined linear combinations. Currently supported presets are as follows:

“prod”

Network statistics of this formula will be multiplied together; equivalent to matrix(1,1,p) , where p is the length of the network statistic vector.

“geomean”

Network statistics of this formula will be geometrically averaged; equivalent to matrix(1/p,1,p) , where p is the length of the network statistic vector.
.
Note that each formula must either produce the same number of statistics or be mapped through a matrix to produce the same number of statistics.
A single formula is also permissible. This can be useful if one wishes to, say, multiply together the statistics returned by a formula.
Offsets are ignored unless there is only one formula and the transformation only exponentiates the statistics (i.e., the effective transformation matrix is diagonal).
label is used to specify the names of the elements of the resulting term sum vector. If label is a character vector of length 1, it will be recycled with indices appended. If label is a function, formulas ’ parameter names are extracted and their list of character vectors is passed label . (For convenience, if only one formula is given, just a character vector is passed. Lastly, if label or result of its function call is an AsIs object, it is not wrapped in Sum~… .
Curved models are supported, subject to some limitations. In particular, the first model’s etamap will be used, overwriting the others. If label is not of length 1, it should have an attr style attribute “curved” specifying the names for the curved parameters.
Note that the current implementation piggybacks on the Log , Exp , and Sum operators, essentially Exp(_{Sum(}Log(formula), label)) . This may result in loss of precision, particularly for extremely large or small statistics. The implementation may change in the future.

binary, operator

Prod(formulas, label)
A product (or an arbitrary power combination) of one or more formulas:
formulas is a list of formulas whose corresponding RHS statistics will be multiplied elementwise. They are required to be nonnegative.
If a formula has an LHS, it is interpreted as follows:

a numeric scalar

Network statistics of this formula will be exponentiated by this.

a numeric vector

Corresponding network statistics of this formula will be exponentiated by this.

a numeric matrix

Vector of network statistics will be exponentiated by this using the same pattern as matrix multiplication.

a character string

One of several predefined linear combinations. Currently supported presets are as follows:

“prod”

Network statistics of this formula will be multiplied together; equivalent to matrix(1,1,p) , where p is the length of the network statistic vector.

“geomean”

Network statistics of this formula will be geometrically averaged; equivalent to matrix(1/p,1,p) , where p is the length of the network statistic vector.
.
Note that each formula must either produce the same number of statistics or be mapped through a matrix to produce the same number of statistics.
A single formula is also permissible. This can be useful if one wishes to, say, multiply together the statistics returned by a formula.
Offsets are ignored unless there is only one formula and the transformation only exponentiates the statistics (i.e., the effective transformation matrix is diagonal).
label is used to specify the names of the elements of the resulting term sum vector. If label is a character vector of length 1, it will be recycled with indices appended. If label is a function, formulas ’ parameter names are extracted and their list of character vectors is passed label . (For convenience, if only one formula is given, just a character vector is passed. Lastly, if label or result of its function call is an AsIs object, it is not wrapped in Sum~… .
Curved models are supported, subject to some limitations. In particular, the first model’s etamap will be used, overwriting the others. If label is not of length 1, it should have an attr style attribute “curved” specifying the names for the curved parameters.
Note that the current implementation piggybacks on the Log , Exp , and Sum operators, essentially Exp(_{Sum(}Log(formula), label)) . This may result in loss of precision, particularly for extremely large or small statistics. The implementation may change in the future.

valued, operator

S(formula, attrs)
Evaluation on an induced subgraph:
attrs is a twosided formula whose LHS gives the attribute or attribute function (see Specifying Vertex Attributes and Levels) for which tails and heads will be used to construct the induced subgraph. A onesided formula (e.g., ~A ) is symmetrized (e.g., A~A ).
It should evaluate either to a logical vector equal in length to the number of tails (for LHS) and heads (for RHS) indicating which nodes are to be used to induce the subgraph or a numeric vector giving their indices. (As with indexing vectors, the logical vector will be recycled to the size of the network or the size of the appropriate bipartition, and negative indices will deselect vertices.)
When the two sets are identical, the induced subgraph retains the directedness of the original graph. Otherwise, an undirected bipartite graph is induced.

binary, operator

Sum(formulas, label)
A sum (or an arbitrary linear combination) of one or more formulas:
formulas is a list of formulas whose corresponding RHS statistics will be summed elementwise.
If a formula has an LHS, it is interpreted as follows:

a numeric scalar

Network statistics of this formula will be multiplied by this.

a numeric vector

Corresponding network statistics of this formula will be multiplied by this.

a numeric matrix

Vector of network statistics will be premultiplied by this.

a character string

One of several predefined linear combinations. Currently supported presets are as follows:

“sum”

Network statistics of this formula will be summed up; equivalent to matrix(1,1,p) , where p is the length of the network statistic vector.

“mean”

Network statistics of this formula will be averaged; equivalent to matrix(1/p,1,p) , where p is the length of the network statistic vector.
.
Note that each formula must either produce the same number of statistics or be mapped through a matrix to produce the same number of statistics.
A single formula is also permitted. This can be useful if one wishes to, say, scale or sum up the statistics returned by a formula.
Offsets are ignored unless there is only one formula and the transformation only scales the statistics (i.e., the effective transformation matrix is diagonal).
label is used to specify the names of the elements of the resulting term sum vector. If label is a character vector of length 1, it will be recycled with indices appended. If label is a function, formulas ’ parameter names are extracted and their list of character vectors is passed label . (For convenience, if only one formula is given, just a character vector is passed. Lastly, if label or result of its function call is an AsIs object, it is not wrapped in Sum~… .
Curved models are supported, subject to some limitations. In particular, the first model’s etamap will be used, overwriting the others. If label is not of length 1, it should have an attr style attribute “curved” specifying the names for the curved parameters.

binary, operator

Sum(formulas, label)
A sum (or an arbitrary linear combination) of one or more formulas:
formulas is a list of formulas whose corresponding RHS statistics will be summed elementwise.
If a formula has an LHS, it is interpreted as follows:

a numeric scalar

Network statistics of this formula will be multiplied by this.

a numeric vector

Corresponding network statistics of this formula will be multiplied by this.

a numeric matrix

Vector of network statistics will be premultiplied by this.

a character string

One of several predefined linear combinations. Currently supported presets are as follows:

“sum”

Network statistics of this formula will be summed up; equivalent to matrix(1,1,p) , where p is the length of the network statistic vector.

“mean”

Network statistics of this formula will be averaged; equivalent to matrix(1/p,1,p) , where p is the length of the network statistic vector.
.
Note that each formula must either produce the same number of statistics or be mapped through a matrix to produce the same number of statistics.
A single formula is also permitted. This can be useful if one wishes to, say, scale or sum up the statistics returned by a formula.
Offsets are ignored unless there is only one formula and the transformation only scales the statistics (i.e., the effective transformation matrix is diagonal).
label is used to specify the names of the elements of the resulting term sum vector. If label is a character vector of length 1, it will be recycled with indices appended. If label is a function, formulas ’ parameter names are extracted and their list of character vectors is passed label . (For convenience, if only one formula is given, just a character vector is passed. Lastly, if label or result of its function call is an AsIs object, it is not wrapped in Sum~… .
Curved models are supported, subject to some limitations. In particular, the first model’s etamap will be used, overwriting the others. If label is not of length 1, it should have an attr style attribute “curved” specifying the names for the curved parameters.

valued, operator

Symmetrize(formula, rule=“weak”)
Evaluation on symmetrized (undirected) network: Evaluates the terms in formula on an undirected network constructed by symmetrizing the LHS network using one of four rules:

“weak”

A tie (i,j) is present in the constructed network if the LHS network has either tie (i,j) or (j,i) (or both).

“strong”

A tie (i,j) is present in the constructed network if the LHS network has both tie (i,j) and tie (j,i).

“upper”

A tie (i,j) is present in the constructed network if the LHS network has tie ((i,j),(i,j)): the upper triangle of the LHS network.

“upper”

A tie (i,j) is present in the constructed network if the LHS network has tie ((i,j),(i,j)): the lower triangle of the LHS network.

binary, directed, operator

Label(formula, label, pos)
Modify terms’ coefficient names: The Label operator evaluates formula without modification, but modifies its coefficient and/or parameter names based on label and pos . label is either a character vector specifying the label for the terms or a function through which term names are mapped (or a as_mapper style formula). If it is a character vector, the pos argument controls how it modifies the term naes: one of “prepend” , “replace” , “append” , or “(” , with the latter wrapping the term names in parentheses like a function call with name specified by label .

binary, operator

Label(formula, label, pos)
Modify terms’ coefficient names: The Label operator evaluates formula without modification, but modifies its coefficient and/or parameter names based on label and pos . label is either a character vector specifying the label for the terms or a function through which term names are mapped (or a as_mapper style formula). If it is a character vector, the pos argument controls how it modifies the term naes: one of “prepend” , “replace” , “append” , or “(” , with the latter wrapping the term names in parentheses like a function call with name specified by label .

valued, operator

NodematchFilter(formula, attrname)
Filtering on nodematch : evaluates the terms specified in formula on a network constructed by taking y and removing any edges for which attrname(i)!=attrname(j) . The attrname argument is a character vector giving one or more names of attributes in the network’s vertex attribute list.

binary, operator

Offset(formula, coef, which)
Terms with fixed coefficients: This operator is analogous to the offset() wrapper, but the coefficients are specified within the term and the curved ERGM mechanism is used internally. In addition, the which argument can be used to specify which of the parameters in the formula are fixed. It can be a logical vector (recycled as needed), a numeric vector of indices of parameters to be fixed, or a character vector of parameter names.

binary, operator

absdiff(attr, pow=1)
Absolute difference: The attr argument specifies a quantitative attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds one network statistic to the model equaling the sum of abs(attr[i]attr[j])^pow for all edges (i,j) in the network.
Note that ergm versions 3.9.4 and earlier used different arguments for this term. See the above section on versioning for invoking the old behavior.

binary, dyadindependent, frequentlyused, directed, undirected, quantitative nodal attribute

absdiff(attr, pow=1, form =“sum”)
Absolute difference: The attr argument specifies a quantitative attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds one network statistic to the model equaling the sum of abs(attr[i]attr[j])^pow for all edges (i,j) in the network.
Note that ergm versions 3.9.4 and earlier used different arguments for this term. See the above section on versioning for invoking the old behavior.

valued, dyadindependent, directed, undirected, quantitative nodal attribute

absdiffcat(attr, base=NULL, levels=NULL)
Categorical absolute difference: The attr argument specifies a quantitative attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds one statistic for every possible nonzero distinct value of abs(attr[i]attr[j]) in the network; the value of each such statistic is the number of edges in the network with the corresponding absolute difference. The optional argument levels specifies which nonzero differences to include in or exclude from the model (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). For example, if the possible values of abs(attr[i]attr[j]) are 0, 0.5, 3, 3.5, and 10, then to omit 0.5 and 10 one could set levels=2:3 (we wish to retain the second and third nonzero difference, when differences are sorted in increasing order). Note that this term should generally be used only when the quantitative attribute has a limited number of possible values; an example is the “Grade” attribute of the faux.mesa.high or faux.magnolia.high datasets.
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and levels are passed, levels overrides base .

binary, dyadindependent, directed, undirected, categorical nodal attribute

absdiffcat(attr, base=NULL, levels=NULL, form=“sum”)
Categorical absolute difference: The attr argument specifies a quantitative attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds one statistic for every possible nonzero distinct value of abs(attr[i]attr[j]) in the network; the value of each such statistic is the number of edges in the network with the corresponding absolute difference. The optional argument levels specifies which nonzero differences to include in or exclude from the model (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). For example, if the possible values of abs(attr[i]attr[j]) are 0, 0.5, 3, 3.5, and 10, then to omit 0.5 and 10 one could set levels=2:3 (we wish to retain the second and third nonzero difference, when differences are sorted in increasing order). Note that this term should generally be used only when the quantitative attribute has a limited number of possible values; an example is the “Grade” attribute of the faux.mesa.high or faux.magnolia.high datasets.
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and levels are passed, levels overrides base .

valued, dyadindependent, directed, undirected, categorical nodal attribute

altkstar(lambda, fixed=FALSE)
Alternating kstar: This term adds one network statistic to the model equal to a weighted alternating sequence of kstar statistics with weight parameter lambda . This is the version given in Snijders et al. (2006). The gwdegree and altkstar produce mathematically equivalent models, as long as they are used together with the edges (or kstar(1) ) term, yet the interpretation of the gwdegree parameters is slightly more straightforward than the interpretation of the altkstar parameters. For this reason, we recommend the use of the gwdegree instead of altkstar . See Section 3 and especially equation (13) of Hunter (2007) for details. The optional argument fixed indicates whether the decay parameter is fixed at the given value, or is to be fit as a curved exponential family model (see Hunter and Handcock, 2006). The default is FALSE , which means the scale parameter is not fixed and thus the model is a CEF model. This term can only be used with undirected networks.

binary, undirected, curved, categorical nodal attribute

asymmetric(attr=NULL, diff=FALSE, keep=NULL, levels=NULL)
Asymmetric dyads: This term adds one network statistic to the model equal to the number of pairs of actors for which exactly one of (i,j) or (j,i) exists. This term can only be used with directed networks. The optional argument attr specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If attr is specified, only asymmetric pairs that match on the vertex attribute attr are counted. The optional modifiers diff and levels are used in the same way as for the nodematch term; refer to this term for details and an example.
The argument keep is retained for backwards compatibility and may be removed in a future version. When both keep and levels are passed, levels overrides keep .

binary, directed, dyadindependent, triadrelated

atleast(threshold=0)
Number of dyads with values greater than or equal to a threshold Adds the number of statistics equal to the length of threshold equaling to the number of dyads whose values equal or exceed the corresponding element of threshold .

valued, directed, undirected, dyadindependent

atmost(threshold=0)
Number of dyads with values less than or equal to a threshold Adds the number of statistics equal to the length of threshold equaling to the number of dyads whose values equal or are exceeded by the corresponding element of threshold .

valued, directed, undirected, dyadindependent

attrcov(attr, mat)
Edge covariate by attribute pairing: The attr argument specifies a vertex attribute (see Specifying Vertex Attributes and Levels for details), and the mat argument is a matrix of covariates with the same dimensions as a mixing matrix for attr . This term adds one statistic to the model, equal to the sum of the covariate values for each edge appearing in the network, where the covariate value for a given edge is determined by its mixing type on attr . Undirected networks are regarded as having undirected mixing, and it is assumed that mat is symmetric in that case.
This term can be useful for simulating large networks with many mixing types, where nodemix would be slow due to the large number of statistics, and edgecov cannot be used because an adjacency matrix would be too big.

binary, dyadindependent, directed, undirected

b1concurrent(by=NULL, levels=NULL)
Concurrent node count for the first mode in a bipartite (aka twomode) network: This term adds one network statistic to the model, equal to the number of nodes in the first mode of the network with degree 2 or higher. The first mode of a bipartite network object is sometimes known as the “actor” mode. The optional argument by specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details); it functions just like the by argument of the b1degree term. Without the optional argument, this statistic is equivalent to b1mindegree(2) . This term can only be used with undirected bipartite networks.

binary, bipartite, undirected, categorical nodal attribute

b1cov(attr)
Main effect of a covariate for the first mode in a bipartite (aka twomode) network: The attr argument specifies one or more quantitative attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds a single network statistic for each quantitative attribute or matrix column to the model equaling the total value of attr(i) for all edges (i,j) in the network. This term may only be used with bipartite networks. For categorical attributes, see b1factor .
Note that ergm versions 3.9.4 and earlier used different arguments for this term. See the above section on versioning for invoking the old behavior.

binary, undirected, bipartite, dyadindependent, quantitative nodal attribute, frequentlyused

b1cov(attr, form=“sum”)
Main effect of a covariate for the first mode in a bipartite (aka twomode) network: The attr argument specifies one or more quantitative attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds a single network statistic for each quantitative attribute or matrix column to the model equaling the total value of attr(i) for all edges (i,j) in the network. This term may only be used with bipartite networks. For categorical attributes, see b1factor .
Note that ergm versions 3.9.4 and earlier used different arguments for this term. See the above section on versioning for invoking the old behavior.

valued, undirected, bipartite, dyadindependent, quantitative nodal attribute, frequentlyused

b1degrange(from, to=+Inf, by=NULL, homophily=FALSE, levels=NULL)
Degree range for the first mode in a bipartite (a.k.a. twomode) network: The from and to arguments are vectors of distinct integers (or +Inf , for to (its default)). If one of the vectors has length 1, it is recycled to the length of the other. Otherwise, they must have the same length. This term adds one network statistic to the model for each element of from (or to ); the ith such statistic equals the number of nodes of the first mode (“actors”) in the network of degree greater than or equal to from[i] but strictly less than to[i] , i.e. with edge count in semiopen interval [from,to) . The optional argument by specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If this is specified and homophily is TRUE , then degrees are calculated using the subnetwork consisting of only edges whose endpoints have the same value of the by attribute. If by is specified and homophily is FALSE (the default), then separate degree range statistics are calculated for nodes having each separate value of the attribute.
This term can only be used with bipartite networks; for directed networks see idegrange and odegrange . For undirected networks, see degrange , and see b2degrange for degrees of the second mode (“events”).

binary, bipartite, undirected

b1degree(d, by=NULL, levels=NULL)
Degree for the first mode in a bipartite (aka twomode) network: The d argument is a vector of distinct integers. This term adds one network statistic to the model for each element in d ; the ith such statistic equals the number of nodes of degree d[i] in the first mode of a bipartite network, i.e. with exactly d[i] edges. The first mode of a bipartite network object is sometimes known as the “actor” mode. The optional argument by specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If this is specified then each node’s degree is tabulated only with other nodes having the same value of the by attribute.
This term can only be used with undirected bipartite networks.

binary, bipartite, undirected, categorical nodal attribute, frequentlyused

b1dsp(d)
Dyadwise shared partners for dyads in the first bipartition: The d argument is a vector of distinct integers. This term adds one network statistic to the model for each element in d ; the ith such statistic equals the number of dyads in the first bipartition with exactly d[i] shared partners. (Those shared partners, of course, must be members of the second bipartition.) This term can only be used with bipartite networks.

binary, bipartite, undirected

b1factor(attr, base=1, levels=1)
Factor attribute effect for the first mode in a bipartite (aka twomode) network: The attr argument specifies a categorical vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds multiple network statistics to the model, one for each of (a subset of) the unique values of the attr attribute. Each of these statistics gives the number of times a node with that attribute in the first mode of the network appears in an edge. The first mode of a bipartite network object is sometimes known as the “actor” mode.
The optional levels argument controls which levels of the attribute should be included and which should be excluded. (See Specifying Vertex attributes and Levels (? nodal_attributes ) for details.) For example, if the “fruit” attribute has levels “orange”, “apple”, “banana”, and “pear”, then to include just two levels, one for “apple” and one for “pear”, use any of b1factor(“fruit”, levels=(2:3)) , b1factor(“fruit”, levels=c(1,4)) , and b1factor(“fruit”, levels=c(“apple”, “pear”)) . Note: if you are using numeric values to specify the levels of a character variable, the levels will correspond to the alphabetically sorted character levels.
To include all attribute values is usually not a good idea, because the sum of all such statistics equals the number of edges and hence a linear dependency would arise in any model also including edges . The default, levels=1 , is therefore to omit the first (in lexicographic order) attribute level. To include all levels, pass either levels=TRUE (i.e., keep all levels) or levels=NULL (i.e., do not filter levels).
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and levels are passed, levels overrides base .
This term can only be used with undirected bipartite networks.

binary, bipartite, undirected, dyadindependent, frequentlyused, categorical nodal attribute

b1factor(attr, base=1, levels=1, form=“sum”)
Factor attribute effect for the first mode in a bipartite (aka twomode) network: The attr argument specifies a categorical vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds multiple network statistics to the model, one for each of (a subset of) the unique values of the attr attribute. Each of these statistics gives the number of times a node with that attribute in the first mode of the network appears in an edge. The first mode of a bipartite network object is sometimes known as the “actor” mode.
The optional levels argument controls which levels of the attribute should be included and which should be excluded. (See Specifying Vertex attributes and Levels (? nodal_attributes ) for details.) For example, if the “fruit” attribute has levels “orange”, “apple”, “banana”, and “pear”, then to include just two levels, one for “apple” and one for “pear”, use any of b1factor(“fruit”, levels=(2:3)) , b1factor(“fruit”, levels=c(1,4)) , and b1factor(“fruit”, levels=c(“apple”, “pear”)) . Note: if you are using numeric values to specify the levels of a character variable, the levels will correspond to the alphabetically sorted character levels.
To include all attribute values is usually not a good idea, because the sum of all such statistics equals the number of edges and hence a linear dependency would arise in any model also including edges . The default, levels=1 , is therefore to omit the first (in lexicographic order) attribute level. To include all levels, pass either levels=TRUE (i.e., keep all levels) or levels=NULL (i.e., do not filter levels).
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and levels are passed, levels overrides base .
This term can only be used with undirected bipartite networks.

valued, bipartite, undirected, dyadindependent, frequentlyused, categorical nodal attribute

b1mindegree(d)
Minimum degree for the first mode in a bipartite (aka twomode) network: The d argument is a vector of distinct integers. This term adds one network statistic to the model for each element in d ; the ith such statistic equals the number of nodes in the first mode of a bipartite network with at least degree d[i] . The first mode of a bipartite network object is sometimes known as the “actor” mode.
This term can only be used with undirected bipartite networks.

binary, bipartite, undirected

b1nodematch(attr, diff=FALSE, keep=NULL, alpha=1, beta=1,)
Nodal attributebased homophily effect for the first mode in a bipartite (aka twomode) network: This term is introduced in Bomiriya et al (2014). The attr argument specifies a categorical vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). Out of the two arguments (discount parameters) alpha and beta , both of which take values from [0,1], only one should be set at a time. If none is set to a value other than 1, this term will simply be a homophily based twostar statistic. This term adds one statistic to the model unless diff is set to TRUE , in which case the term adds multiple network statistics to the model, one for each of (a subset of) the unique values of the attr attribute. To include only the attribute values you wish, use the levels arguments.
The argument keep is retained for backwards compatibility and may be removed in a future version. When both keep and levels are passed, levels overrides keep .
If an alpha discount parameter is used, each of these statistics gives the sum of the number of common secondmode nodes raised to the power alpha for each pair of firstmode nodes with that attribute. If a beta discount parameter is used, each of these statistics gives half the sum of the number of twopaths with two firstmode nodes with that attribute as the two ends of the two path raised to the power beta for each edge in the network. The byb2attr argument specifies a second mode categorical attribute. Setting this argument will separate the orginal statistics based on the values of the set second mode attribute— i.e. for example, if diff is FALSE , then the sum of all the statistics for each level of this secondmode attribute will be equal to the original b1nodematch statistic where byb2attr set to NULL . This term can only be used with undirected bipartite networks.

binary, bipartite, undirected, dyadindependent, categorical nodal attribute, frequentlyused

b1sociality(nodes=1)
Degree: This term adds one network statistic for each node in the first bipartition, equal to the number of ties of that node. By default, nodes=1 means that the statistic for the first node will be omitted, but this argument may be changed to control which statistics are included. The nodes argument is interpreted using the new UI for level specification (see Specifying Vertex Attributes and Levels for details), where both the attribute and the sorted unique values are the vector of vertex indices 1:nb1 , where nb1 is the size of the first bipartition. This term can only be used with bipartite networks. For directed networks, see sender and receiver . For unipartite networks, see sociality .

binary, bipartite, undirected, dyadindependent

b1sociality(nodes=1, form=“sum”)
Degree: This term adds one network statistic for each node in the first bipartition, equal to the number of ties of that node. By default, nodes=1 means that the statistic for the first node will be omitted, but this argument may be changed to control which statistics are included. The nodes argument is interpreted using the new UI for level specification (see Specifying Vertex Attributes and Levels for details), where both the attribute and the sorted unique values are the vector of vertex indices 1:nb1 , where nb1 is the size of the first bipartition. This term can only be used with bipartite networks. For directed networks, see sender and receiver . For unipartite networks, see sociality .

valued, bipartite, undirected, dyadindependent

b1star(k, attr=NULL, levels=NULL)
kStars for the first mode in a bipartite (aka twomode) network: The k argument is a vector of distinct integers. This term adds one network statistic to the model for each element in k . The ith such statistic counts the number of distinct k[i] stars whose center node is in the first mode of the network. The first mode of a bipartite network object is sometimes known as the “actor” mode. A kstar is defined to be a center node N and a set of k different nodes {O[1], …, O[k]} such that the ties {N, O[i]} exist for i=1, …, k. The optional argument attr specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If this is specified then the count is over the number of kstars (with center node in the first mode) where all nodes have the same value of the attribute. This term can only be used for undirected bipartite networks. Note that b1star(1) is equal to b2star(1) and to edges .

binary, bipartite, undirected, categorical nodal attribute

b1starmix(k, attr, base=NULL, diff=TRUE)
Mixing matrix for kstars centered on the first mode of a bipartite network: Only a single value of k is allowed. This term counts all kstars in which the b2 nodes (called events in some contexts) are homophilous in the sense that they all share the same value of attr . However, the b1 node (in some contexts, the actor) at the center of the kstar does NOT have to have the same value as the b2 nodes; indeed, the values taken by the b1 nodes may be completely distinct from those of the b2 nodes, which allows for the use of this term in cases where there are two separate nodal attributes, one for the b1 nodes and another for the b2 nodes (in this case, however, these two attributes should be combined to form a single nodal attribute, attr ). A different statistic is created for each value of attr seen in a b1 node, even if no kstars are observed with this value. Whether a different statistic is created for each value seen in a b2 node depends on the value of the diff argument: When diff=TRUE , the default, a different statistic is created for each value and thus the behavior of this term is reminiscent of the nodemix term, from which it takes its name; when diff=FALSE , all homophilous kstars are counted together, though these kstars are still categorized according to the value of the central b1 node.

binary, bipartite, undirected, categorical nodal attribute

b1twostar(b1attr, b2attr, base=NULL, b1levels=NULL, b2levels=NULL, levels2=NULL)
Twostar census for central nodes centered on the first mode of a bipartite network: This term takes two nodal attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details), one for b1 nodes (actors in some contexts) and one for b2 nodes (events in some contexts). Only b1attr is required; if b2attr is not passed, it is assumed to be the same as b1attr . Assuming that there are n_1 values of b1attr among the b1 nodes and n_2 values of b2attr among the b2 nodes, then the total number of distinct categories of two stars according to these two attributes is n_1(n_2)(n_2+1)/2. By default, this model term creates a distinct statistic counting each of these categories. The b1levels , b2levels , base , and levels2 arguments may be used to leave some of these categories out (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details).
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and levels are passed, levels overrides base . The argument base is retained for backwards compatibility and may be removed in a future version. When both base and levels2 are passed, levels2 overrides base .

binary, bipartite, undirected, categorical nodal attribute

b2concurrent(by=NULL)
Concurrent node count for the second mode in a bipartite (aka twomode) network: This term adds one network statistic to the model, equal to the number of nodes in the second mode of the network with degree 2 or higher. The second mode of a bipartite network object is sometimes known as the “event” mode. The optional argument by specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details); it functions just like the by argument of the b2degree term. Without the optional argument, this statistic is equivalent to b2mindegree(2) .
This term can only be used with undirected bipartite networks.

binary, bipartite, undirected, frequentlyused

b2cov(attr)
Main effect of a covariate for the second mode in a bipartite (aka twomode) network: The attr argument specifies one or more quantitative attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds a single network statistic for each quantitative attribute or matrix column to the model equaling the total value of attr(j) for all edges (i,j) in the network. This term may only be used with bipartite networks. For categorical attributes, see b2factor .
Note that ergm versions 3.9.4 and earlier used different arguments for this term. See the above section on versioning for invoking the old behavior.

binary, undirected, bipartite, dyadindependent, quantitative nodal attribute, frequentlyused

b2cov(attr, form=“sum”)
Main effect of a covariate for the second mode in a bipartite (aka twomode) network: The attr argument specifies one or more quantitative attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds a single network statistic for each quantitative attribute or matrix column to the model equaling the total value of attr(j) for all edges (i,j) in the network. This term may only be used with bipartite networks. For categorical attributes, see b2factor .
Note that ergm versions 3.9.4 and earlier used different arguments for this term. See the above section on versioning for invoking the old behavior.

valued, undirected, bipartite, dyadindependent, quantitative nodal attribute, frequentlyused

b2degrange(from, to=+Inf, by=NULL, homophily=FALSE, levels=NULL)
Degree range for the second mode in a bipartite (a.k.a. twomode) network: The from and to arguments are vectors of distinct integers (or +Inf , for to (its default)). If one of the vectors has length 1, it is recycled to the length of the other. Otherwise, they must have the same length. This term adds one network statistic to the model for each element of from (or to ); the ith such statistic equals the number of nodes of the second mode (“events”) in the network of degree greater than or equal to from[i] but strictly less than to[i] , i.e. with edge count in semiopen interval [from,to) . The optional argument by specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If this is specified and homophily is TRUE , then degrees are calculated using the subnetwork consisting of only edges whose endpoints have the same value of the by attribute. If by is specified and homophily is FALSE (the default), then separate degree range statistics are calculated for nodes having each separate value of the attribute.
This term can only be used with bipartite networks; for directed networks see idegrange and odegrange . For undirected networks, see degrange , and see b1degrange for degrees of the first mode (“actors”).

binary, bipartite, undirected

b2degree(d, by=NULL)
Degree for the second mode in a bipartite (aka twomode) network: The d argument is a vector of distinct integers. This term adds one network statistic to the model for each element in d ; the ith such statistic equals the number of nodes of degree d[i] in the second mode of a bipartite network, i.e. with exactly d[i] edges. The second mode of a bipartite network object is sometimes known as the “event” mode. The optional term by specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If this is specified then each node’s degree is tabulated only with other nodes having the same value of the by attribute.
This term can only be used with undirected bipartite networks.

binary, bipartite, undirected, categorical nodal attribute, frequentlyused

b2dsp(d)
Dyadwise shared partners for dyads in the second bipartition: The d argument is a vector of distinct integers. This term adds one network statistic to the model for each element in d ; the ith such statistic equals the number of dyads in the second bipartition with exactly d[i] shared partners. (Those shared partners, of course, must be members of the first bipartition.) This term can only be used with bipartite networks.

binary, bipartite, undirected

b2factor(attr, base=1, levels=1)
Factor attribute effect for the second mode in a bipartite (aka twomode) network : The attr argument specifies a categorical vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds multiple network statistics to the model, one for each of (a subset of) the unique values of the attr attribute. Each of these statistics gives the number of times a node with that attribute in the second mode of the network appears in an edge. The second mode of a bipartite network object is sometimes known as the “event” mode.
The optional levels argument controls which levels of the attribute should be included and which should be excluded. (See Specifying Vertex attributes and Levels (? nodal_attributes ) for details.) For example, if the “fruit” attribute has levels “orange”, “apple”, “banana”, and “pear”, then to include just two levels, one for “apple” and one for “pear”, use any of b2factor(“fruit”, levels=(2:3)) , b2factor(“fruit”, levels=c(1,4)) , and b2factor(“fruit”, levels=c(“apple”, “pear”)) . Note: if you are using numeric values to specify the levels of a character variable, the levels will correspond to the alphabetically sorted character levels.
To include all attribute values is usually not a good idea, because the sum of all such statistics equals the number of edges and hence a linear dependency would arise in any model also including edges . The default, levels=1 , is therefore to omit the first (in lexicographic order) attribute level. To include all levels, pass either levels=TRUE (i.e., keep all levels) or levels=NULL (i.e., do not filter levels).
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and levels are passed, levels overrides base .
This term can only be used with undirected bipartite networks.

binary, bipartite, undirected, dyadindependent, categorical nodal attribute, frequentlyused

b2factor(attr, base=1, levels=1, form=“sum”)
Factor attribute effect for the second mode in a bipartite (aka twomode) network : The attr argument specifies a categorical vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds multiple network statistics to the model, one for each of (a subset of) the unique values of the attr attribute. Each of these statistics gives the number of times a node with that attribute in the second mode of the network appears in an edge. The second mode of a bipartite network object is sometimes known as the “event” mode.
The optional levels argument controls which levels of the attribute should be included and which should be excluded. (See Specifying Vertex attributes and Levels (? nodal_attributes ) for details.) For example, if the “fruit” attribute has levels “orange”, “apple”, “banana”, and “pear”, then to include just two levels, one for “apple” and one for “pear”, use any of b2factor(“fruit”, levels=(2:3)) , b2factor(“fruit”, levels=c(1,4)) , and b2factor(“fruit”, levels=c(“apple”, “pear”)) . Note: if you are using numeric values to specify the levels of a character variable, the levels will correspond to the alphabetically sorted character levels.
To include all attribute values is usually not a good idea, because the sum of all such statistics equals the number of edges and hence a linear dependency would arise in any model also including edges . The default, levels=1 , is therefore to omit the first (in lexicographic order) attribute level. To include all levels, pass either levels=TRUE (i.e., keep all levels) or levels=NULL (i.e., do not filter levels).
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and levels are passed, levels overrides base .
This term can only be used with undirected bipartite networks.

valued, bipartite, undirected, dyadindependent, categorical nodal attribute, frequentlyused

b2mindegree(d)
Minimum degree for the second mode in a bipartite (aka twomode) network: The d argument is a vector of distinct integers. This term adds one network statistic to the model for each element in d ; the ith such statistic equals the number of nodes in the second mode of a bipartite network with at least degree d[i] . The second mode of a bipartite network object is sometimes known as the “event” mode.
This term can only be used with undirected bipartite networks.

binary, bipartite, undirected

b2nodematch(attr, diff=FALSE, keep=NULL, alpha=1, beta=1,)
Nodal attributebased homophily effect for the second mode in a bipartite (aka twomode) network: This term is introduced in Bomiriya et al (2014). The attr argument specifies a categorical vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). Out of the two arguments (discount parameters) alpha and beta , both which takes values from [0,1], only one should be set at a time. If none is set to a value other than 1, this term will simply be a homophily based twostar statistic. This term adds one statistic to the model unless diff is set to TRUE , in which case the term adds multiple network statistics to the model, one for each of (a subset of) the unique values of the attr attribute. To include only the attribute values you wish, use the levels argument.
The argument keep is retained for backwards compatibility and may be removed in a future version. When both keep and levels are passed, levels overrides keep .
If an alpha discount parameter is used, each of these statistics gives the sum of the number of common firstmode nodes raised to the power alpha for each pair of secondmode nodes with that attribute. If a beta discount parameter is used, each of these statistics gives half the sum of the number of twopaths with two secondmode nodes with that attribute as the two ends of the two path raised to the power beta for each edge in the network. The byb1attr argument specifies a first mode categorical attribute. Setting this argument will separate the orginal statistics based on the values of the set first mode attribute— i.e. for example, if diff is FALSE , then the sum of all the statistics for each level of this firstmode attribute will be equal to the original b2nodematch statistic where byb1attr set to NULL .
This term can only be used with undirected bipartite networks.

binary, bipartite, undirected, dyadindependent, categorical nodal attribute, frequentlyused

b2sociality(nodes=1)
Degree: This term adds one network statistic for each node in the second bipartition, equal to the number of ties of that node. By default, nodes=1 means that the statistic for the first node (in the second bipartition) will be omitted, but this argument may be changed to control which statistics are included. The nodes argument is interpreted using the new UI for level specification (see Specifying Vertex Attributes and Levels for details), where both the attribute and the sorted unique values are the vector of vertex indices (nb1 + 1):n , where nb1 is the size of the first bipartition and n is the total number of nodes in the network. Thus nodes=120 will include only the statistic for the 120th node in the second biparition, while nodes=I(120) will include only the statistic for the 120th node in the entire network. This term can only be used with undirected bipartite networks. For directed networks, see sender and receiver . For unipartite networks, see sociality .

binary, bipartite, undirected, dyadindependent

b2sociality(nodes=1, form=“sum”)
Degree: This term adds one network statistic for each node in the second bipartition, equal to the number of ties of that node. By default, nodes=1 means that the statistic for the first node (in the second bipartition) will be omitted, but this argument may be changed to control which statistics are included. The nodes argument is interpreted using the new UI for level specification (see Specifying Vertex Attributes and Levels for details), where both the attribute and the sorted unique values are the vector of vertex indices (nb1 + 1):n , where nb1 is the size of the first bipartition and n is the total number of nodes in the network. Thus nodes=120 will include only the statistic for the 120th node in the second biparition, while nodes=I(120) will include only the statistic for the 120th node in the entire network. This term can only be used with undirected bipartite networks. For directed networks, see sender and receiver . For unipartite networks, see sociality .

valued, bipartite, undirected, dyadindependent

b2star(k, attr=NULL, levels=NULL)
kStars for the second mode in a bipartite (aka twomode) network: The k argument is a vector of distinct integers. This term adds one network statistic to the model for each element in k . The ith such statistic counts the number of distinct k[i] stars whose center node is in the second mode of the network. The second mode of a bipartite network object is sometimes known as the “event” mode. A kstar is defined to be a center node N and a set of k different nodes {O[1], …, O[k]} such that the ties {N, O[i]} exist for i=1, …, k. The optional argument attr specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If this is specified then the count is over the number of kstars (with center node in the second mode) where all nodes have the same value of the attribute. This term can only be used for undirected bipartite networks. Note that b2star(1) is equal to b1star(1) and to edges .

binary, bipartite, undirected, categorical nodal attribute

b2starmix(k, attr, base=NULL, diff=TRUE)
Mixing matrix for kstars centered on the second mode of a bipartite network: This term is exactly the same as b1starmix except that the roles of b1 and b2 are reversed.

binary, bipartite, undirected, categorical nodal attribute

b2twostar(b1attr, b2attr, base=NULL, b1levels=NULL, b2levels=NULL, levels2=NULL)
Twostar census for central nodes centered on the second mode of a bipartite network: This term is exactly the same as b1twostar except that the roles of b1 and b2 are reversed.

binary, bipartite, undirected, categorical nodal attribute

balance()
Balanced triads: This term adds one network statistic to the model equal to the number of triads in the network that are balanced. The balanced triads are those of type 102 or 300 in the categorization of Davis and Leinhardt (1972). For details on the 16 possible triad types, see ?triad.classify in the {sna} package. For an undirected network, the balanced triads are those with an odd number of ties (i.e., 1 and 3).

binary, triadrelated, directed, undirected

coincidence(levels=NULL,active=0)
Coincident node count for the second mode in a bipartite (aka twomode) network: By default this term adds one network statistic to the model for each pair of nodes of mode two. It is equal to the number of (first mode) mutual partners of that pair. The first mode of a bipartite network object is sometimes known as the “actor” mode and the seconds as the “event” mode. So this is the number of actors going to both events in the pair. The optional argument levels specifies which pairs of nodes in mode two to include (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). The second optional argument, active , selects pairs for which the observed count is at least active . If both levels and active are specified, then active is ignored. (Thus, indices passed as levels should correspond to indices when levels = NULL and active = 0.) This term can only be used with undirected bipartite networks.
Note that ergm versions 3.9.4 and earlier used different arguments for this term. See the above section on versioning for invoking the old behavior.

binary, bipartite, undirected

concurrent(by=NULL, levels=NULL)
Concurrent node count: This term adds one network statistic to the model, equal to the number of nodes in the network with degree 2 or higher. The optional argument by specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details); it functions just like the by argument of the degree term. This term can only be used with undirected networks.

binary, undirected, categorical nodal attribute

concurrentties(by=NULL, levels=NULL)
Concurrent tie count: This term adds one network statistic to the model, equal to the number of ties incident on each actor beyond the first. The optional argument by specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details); it functions just like the by argument of the degree term. This term can only be used with undirected networks.

binary, undirected, categorical nodal attribute

ctriple(attr=NULL, diff=FALSE, levels=NULL)
Cyclic triples: By default, this term adds one statistic to the model, equal to the number of cyclic triples in the network, defined as a set of edges of the form {(i,j), (j,k), (k,i)}. Note that for all directed networks, triangle is equal to ttriple+ctriple , so at most two of these three terms can be in a model. The optional argument attr specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If attr is specified and diff is FALSE , then the statistic is the number of cyclic triples where all three nodes have the same value of the attribute. If attr is specified and diff is TRUE , then one statistic is added to the model for each value of attr (or each value of attr specified by levels if that argument is passed), equal to the number of cyclic triples where all three nodes have that value of the attribute. This term can only be used with directed networks.

binary, directed, triadrelated, categorical nodal attribute

ctriad()
Cyclic triples: By default, this term adds one statistic to the model, equal to the number of cyclic triples in the network, defined as a set of edges of the form {(i,j), (j,k), (k,i)}. Note that for all directed networks, triangle is equal to ttriple+ctriple , so at most two of these three terms can be in a model. The optional argument attr specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If attr is specified and diff is FALSE , then the statistic is the number of cyclic triples where all three nodes have the same value of the attribute. If attr is specified and diff is TRUE , then one statistic is added to the model for each value of attr (or each value of attr specified by levels if that argument is passed), equal to the number of cyclic triples where all three nodes have that value of the attribute. This term can only be used with directed networks.

binary, directed, triadrelated, categorical nodal attribute

cycle(k, semi=FALSE)
kCycle Census: The k argument must be a vector of integers giving the cycle lengths to count. Directed cycle lengths may range from 2 to N (the network size); undirected cycle lengths and semicycle lengths may range from 3 to N ; length 2 semicycles are not currently supported. Note that directed 2cycles are equivalent to mutual dyads.
This term adds one network statistic to the model for each value of k , corresponding to the number of k cycles (or, alternately, semicycles) in the graph.
The optional argument semi is a logical indicating whether semicycles (rather than directed cycles) should be counted; this is ignored in the undirected case.
This term can be used with either directed or undirected networks.

binary, directed, undirected

cyclicalties(attr=NULL, levels=NULL)
Cyclical ties: This term adds one statistic, equal to the number of ties i–>j such that there exists a twopath from j to i. (Related to the ttriple term.) The binary version takes a nodal attribute attr , and, if given, all three nodes involved (i, j, and the node on the twopath) must match on this attribute in order for i–>j to be counted.

binary, directed, undirected

cyclicalties(threshold=0)
Cyclical ties: This term adds one statistic, equal to the number of ties i–>j such that there exists a twopath from j to i. (Related to the ttriple term.) The binary version takes a nodal attribute attr , and, if given, all three nodes involved (i, j, and the node on the twopath) must match on this attribute in order for i–>j to be counted.

valued, directed, undirected

cyclicalweights(twopath=“min”,combine=“max”,affect=“min”)
Cyclical weights: This statistic implements the cyclical weights statistic, like that defined by Krivitsky (2012), Equation 13, but with the focus dyad being y_{j,i} rather than y_{i,j}. The currently implemented options for twopath is the minimum of the constituent dyads (“min” ) or their geometric mean (“geomean” ); for combine , the maximum of the 2path strengths (“max” ) or their sum (“sum” ); and for affect , the minimum of the focus dyad and the combined strength of the two paths (“min” ) or their geometric mean (“geomean” ). For each of these options, the first (and the default) is more stable but also more conservative, while the second is more sensitive but more likely to induce a multimodal distribution of networks.

valued, directed, undirected

ddsp(d, type=“OTP”)
Directed dyadwise shared partners: This term adds one network statistic to the model for each element in d where the ith such statistic equals the number of dyads in the network with exactly d[i] shared partners. This term can only be used with directed networks.
While there is only one shared partner configuration in the undirected case, nine distinct configurations are possible for directed graphs, selected using the type argument. Currently, terms may be defined with respect to five of these configurations; they are defined here as follows (using terminology from Butts (2008) and the relevent package):

Outgoing Twopath (
“OTP” )

vertex k is an OTP shared partner of ordered pair (i,j) iff i>k>j. Also known as “transitive shared partner”.

Incoming Twopath (
“ITP” )

vertex k is an ITP shared partner of ordered pair (i,j) iff j>k>i. Also known as “cyclical shared partner”

Reciprocated Twopath (
“RTP” )

vertex k is an RTP shared partner of ordered pair (i,j) iff i<>k<>j.

Outgoing Shared Partner (
“OSP” )

vertex k is an OSP shared partner of ordered pair (i,j) iff i>k, j>k.

Incoming Shared Partner (
“ISP” )

vertex k is an ISP shared partner of ordered pair (i,j) iff k>i, k>j.
By default, outgoing twopaths (“OTP” ) are calculated. Note that Robins et al. (2009) define closely related statistics to several of the above, using slightly different terminology.

binary, directed

degrange(from, to=+Inf, by=NULL, homophily=FALSE, levels=NULL)
Degree range: The from and to arguments are vectors of distinct integers (or +Inf , for to (its default)). If one of the vectors has length 1, it is recycled to the length of the other. Otherwise, they must have the same length. This term adds one network statistic to the model for each element of from (or to ); the ith such statistic equals the number of nodes in the network of degree greater than or equal to from[i] but strictly less than to[i] , i.e. with edges in semiopen interval [from,to) . The optional argument by specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If this is specified and homophily is TRUE , then degrees are calculated using the subnetwork consisting of only edges whose endpoints have the same value of the by attribute. If by is specified and homophily is FALSE (the default), then separate degree range statistics are calculated for nodes having each separate value of the attribute.
This term can only be used with undirected networks; for directed networks see idegrange and odegrange . This term can be used with bipartite networks, and will count nodes of both first and second mode in the specified degree range. To count only nodes of the first mode (“actors”), use b1degrange and to count only those fo the second mode (“events”), use b2degrange .

binary, undirected, categorical nodal attribute

degree(d, by=NULL, homophily=FALSE, levels=NULL)
Degree: The d argument is a vector of distinct integers. This term adds one network statistic to the model for each element in d ; the ith such statistic equals the number of nodes in the network of degree d[i] , i.e. with exactly d[i] edges. The optional argument by specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If this is specified and homophily is TRUE , then degrees are calculated using the subnetwork consisting of only edges whose endpoints have the same value of the by attribute. If by is specified and homophily is FALSE (the default), then separate degree statistics are calculated for nodes having each separate value of the attribute. This term can only be used with undirected networks; for directed networks see idegree and odegree .

binary, undirected, categorical nodal attribute, frequentlyused

degree1.5()
Degree to the 3/2 power: This term adds one network statistic to the model equaling the sum over the actors of each actor’s degree taken to the 3/2 power (or, equivalently, multiplied by its square root). This term is an undirected analog to the terms of Snijders et al. (2010), equations (11) and (12). This term can only be used with undirected networks.

binary, undirected

degreepopularity()
Degree popularity (deprecated): see degree1.5 .

binary, undirected, deprecated

degcrossprod()
Degree CrossProduct: This term adds one network statistic equal to the mean of the crossproducts of the degrees of all pairs of nodes in the network which are tied. Only coded for undirected networks.

binary, undirected

degcor()
Degree Correlation: This term adds one network statistic equal to the correlation of the degrees of all pairs of nodes in the network which are tied. Only coded for undirected networks.

binary, undirected

density()
Density: This term adds one network statistic equal to the density of the network. For undirected networks, density equals kstar(1) or edges divided by n(n1)/2; for directed networks, density equals edges or istar(1) or ostar(1) divided by n(n1).

binary, dyadindependent, directed, undirected

diff(attr, pow=1, dir=“th”, sign.action=“identity”)
Difference: The attr argument specifies a quantitative vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). For values of pow other than 0 , this term adds one network statistic to the model, equaling the sum, over directed edges (i,j), of sign.action(attr[i]attr[j])^pow if dir is “th” (the default), “tailhead” , or “b1b2” and of sign.action(attr[j]attr[i])^pow if “ht” , “headtail” , or “b2b1” . That is, the argument dir determines which vertex’s attribute is subtracted from which, with tail being the origin of a directed edge and head being its destination, and bipartite networks’ edges being treated as going from the first part (b1) to the second (b2).
If pow==0 , the exponentiation is replaced by the signum function: +1 if the difference is positive, 0 if there is no difference, and 1 if the difference is negative. Note that this function is applied after the sign.action . The comparison is exact, so when using calculated values of attr , ensure that values that you want to be considered equal are, in fact, equal.
The following sign.actions are possible:

“identity” (the default)

no transformation of the difference regardless of sign

“abs”

absolute value of the difference: equivalent to the absdiff term

“posonly”

positive differences are kept, negative differences are replaced by 0

“negonly”

negative differences are kept, positive differences are replaced by 0
Note that this term may not be meaningful for unipartite undirected networks unless sign.action==“abs” . When used on such a network, it behaves as if all edges were directed, going from the lowerindexed vertex to the higherindexed vertex.

binary, dyadindependent, frequentlyused, directed, undirected, quantitative nodal attribute

diff(attr, pow=1, dir=“th”, sign.action=“identity”, form =“sum”)
Difference: The attr argument specifies a quantitative vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). For values of pow other than 0 , this term adds one network statistic to the model, equaling the sum, over directed edges (i,j), of sign.action(attr[i]attr[j])^pow if dir is “th” (the default), “tailhead” , or “b1b2” and of sign.action(attr[j]attr[i])^pow if “ht” , “headtail” , or “b2b1” . That is, the argument dir determines which vertex’s attribute is subtracted from which, with tail being the origin of a directed edge and head being its destination, and bipartite networks’ edges being treated as going from the first part (b1) to the second (b2).
If pow==0 , the exponentiation is replaced by the signum function: +1 if the difference is positive, 0 if there is no difference, and 1 if the difference is negative. Note that this function is applied after the sign.action . The comparison is exact, so when using calculated values of attr , ensure that values that you want to be considered equal are, in fact, equal.
The following sign.actions are possible:

“identity” (the default)

no transformation of the difference regardless of sign

“abs”

absolute value of the difference: equivalent to the absdiff term

“posonly”

positive differences are kept, negative differences are replaced by 0

“negonly”

negative differences are kept, positive differences are replaced by 0
Note that this term may not be meaningful for unipartite undirected networks unless sign.action==“abs” . When used on such a network, it behaves as if all edges were directed, going from the lowerindexed vertex to the higherindexed vertex.

valued, dyadindependent, directed, undirected, bipartite, quantitative nodal attribute

desp(d, type=“OTP”)
Directed edgewise shared partners: This term adds one network statistic to the model for each element in d where the ith such statistic equals the number of edges in the network with exactly d[i] shared partners. This term can only be used with directed networks.
While there is only one shared partner configuration in the undirected case, nine distinct configurations are possible for directed graphs, selected using the type argument. Currently, terms may be defined with respect to five of these configurations; they are defined here as follows (using terminology from Butts (2008) and the relevent package):

Outgoing Twopath (
“OTP” )

vertex k is an OTP shared partner of ordered pair (i,j) iff i>k>j. Also known as “transitive shared partner”.

Incoming Twopath (
“ITP” )

vertex k is an ITP shared partner of ordered pair (i,j) iff j>k>i. Also known as “cyclical shared partner”

Reciprocated Twopath (
“RTP” )

vertex k is an RTP shared partner of ordered pair (i,j) iff i<>k<>j.

Outgoing Shared Partner (
“OSP” )

vertex k is an OSP shared partner of ordered pair (i,j) iff i>k, j>k.

Incoming Shared Partner (
“ISP” )

vertex k is an ISP shared partner of ordered pair (i,j) iff k>i, k>j.
By default, outgoing twopaths (“OTP” ) are calculated. Note that Robins et al. (2009) define closely related statistics to several of the above, using slightly different terminology.

binary, directed

dgwdsp(decay, fixed=FALSE, cutoff=30, type=“OTP”)
Geometrically weighted dyadwise shared partner distribution: This term adds one network statistic to the model equal to the geometrically weighted dyadwise shared partner distribution with decay parameter decay parameter, which should be nonnegative. (this parameter was called alpha prior to ergm 3.7 ). The value supplied for this parameter may be fixed (if fixed=TRUE ), or it may be used instead as the starting value for the estimation of decay in a curved exponential family model (when fixed=FALSE , the default) (see Hunter and Handcock, 2006). Note that the GWDSP statistic is equal to the sum of GWNSP plus GWESP.
While there is only one shared partner configuration in the undirected case, nine distinct configurations are possible for directed graphs, selected using the type argument. Currently, terms may be defined with respect to five of these configurations; they are defined here as follows (using terminology from Butts (2008) and the relevent package):

Outgoing Twopath (
“OTP” )

vertex k is an OTP shared partner of ordered pair (i,j) iff i>k>j. Also known as “transitive shared partner”.

Incoming Twopath (
“ITP” )

vertex k is an ITP shared partner of ordered pair (i,j) iff j>k>i. Also known as “cyclical shared partner”

Reciprocated Twopath (
“RTP” )

vertex k is an RTP shared partner of ordered pair (i,j) iff i<>k<>j.

Outgoing Shared Partner (
“OSP” )

vertex k is an OSP shared partner of ordered pair (i,j) iff i>k, j>k.

Incoming Shared Partner (
“ISP” )

vertex k is an ISP shared partner of ordered pair (i,j) iff k>i, k>j.
By default, outgoing twopaths (“OTP” ) are calculated. Note that Robins et al. (2009) define closely related statistics to several of the above, using slightly different terminology.
The optional argument cutoff sets the number of underlying DSP terms to use in computing the statistics when fixed=FALSE , in order to reduce the computational burden. Its default value can also be controlled by the gw.cutoff term option control parameter. (See control.ergm .)

binary, directed

dgwesp(decay, fixed=FALSE, cutoff=30, type=“OTP”)
Geometrically weighted edgewise shared partner distribution: This term adds a statistic equal to the geometrically weighted edgewise (not dyadwise) shared partner distribution with decay parameter decay parameter, which should be nonnegative. (this parameter was called alpha prior to ergm 3.7 ). The value supplied for this parameter may be fixed (if fixed=TRUE ), or it may be used instead as the starting value for the estimation of decay in a curved exponential family model (when fixed=FALSE , the default) (see Hunter and Handcock, 2006).
While there is only one shared partner configuration in the undirected case, nine distinct configurations are possible for directed graphs, selected using the type argument. Currently, terms may be defined with respect to five of these configurations; they are defined here as follows (using terminology from Butts (2008) and the relevent package):

Outgoing Twopath (
“OTP” )

vertex k is an OTP shared partner of ordered pair (i,j) iff i>k>j. Also known as “transitive shared partner”.

Incoming Twopath (
“ITP” )

vertex k is an ITP shared partner of ordered pair (i,j) iff j>k>i. Also known as “cyclical shared partner”

Reciprocated Twopath (
“RTP” )

vertex k is an RTP shared partner of ordered pair (i,j) iff i<>k<>j.

Outgoing Shared Partner (
“OSP” )

vertex k is an OSP shared partner of ordered pair (i,j) iff i>k, j>k.

Incoming Shared Partner (
“ISP” )

vertex k is an ISP shared partner of ordered pair (i,j) iff k>i, k>j.
By default, outgoing twopaths (“OTP” ) are calculated. Note that Robins et al. (2009) define closely related statistics to several of the above, using slightly different terminology.
The optional argument cutoff sets the number of underlying ESP terms to use in computing the statistics when fixed=FALSE , in order to reduce the computational burden. Its default value can also be controlled by the gw.cutoff term option control parameter. (See control.ergm .)

binary, directed

dgwnsp(decay, fixed=FALSE, cutoff=30, type=“OTP”)
Geometrically weighted nonedgewise shared partner distribution: This term is just like gwesp and gwdsp except it adds a statistic equal to the geometrically weighted nonedgewise (that is, over dyads that do not have an edge) shared partner distribution with decay parameter decay parameter, which should be nonnegative. (this parameter was called alpha prior to ergm 3.7 ). The value supplied for this parameter may be fixed (if fixed=TRUE ), or it may be used instead as the starting value for the estimation of decay in a curved exponential family model (when fixed=FALSE , the default) (see Hunter and Handcock, 2006).
While there is only one shared partner configuration in the undirected case, nine distinct configurations are possible for directed graphs, selected using the type argument. Currently, terms may be defined with respect to five of these configurations; they are defined here as follows (using terminology from Butts (2008) and the relevent package):

Outgoing Twopath (
“OTP” )

vertex k is an OTP shared partner of ordered pair (i,j) iff i>k>j. Also known as “transitive shared partner”.

Incoming Twopath (
“ITP” )

vertex k is an ITP shared partner of ordered pair (i,j) iff j>k>i. Also known as “cyclical shared partner”

Reciprocated Twopath (
“RTP” )

vertex k is an RTP shared partner of ordered pair (i,j) iff i<>k<>j.

Outgoing Shared Partner (
“OSP” )

vertex k is an OSP shared partner of ordered pair (i,j) iff i>k, j>k.

Incoming Shared Partner (
“ISP” )

vertex k is an ISP shared partner of ordered pair (i,j) iff k>i, k>j.
By default, outgoing twopaths (“OTP” ) are calculated. Note that Robins et al. (2009) define closely related statistics to several of the above, using slightly different terminology.
The optional argument cutoff sets the number of underlying NSP terms to use in computing the statistics when fixed=FALSE , in order to reduce the computational burden. Its default value can also be controlled by the gw.cutoff term option control parameter. (See control.ergm .)

binary, directed

dnsp(d, type=“OTP”)
Directed nonedgewise shared partners: This term adds one network statistic to the model for each element in d where the ith such statistic equals the number of nonedges in the network with exactly d[i] shared partners. This term can only be used with directed networks.
While there is only one shared partner configuration in the undirected case, nine distinct configurations are possible for directed graphs, selected using the type argument. Currently, terms may be defined with respect to five of these configurations; they are defined here as follows (using terminology from Butts (2008) and the relevent package):

Outgoing Twopath (
“OTP” )

vertex k is an OTP shared partner of ordered pair (i,j) iff i>k>j. Also known as “transitive shared partner”.

Incoming Twopath (
“ITP” )

vertex k is an ITP shared partner of ordered pair (i,j) iff j>k>i. Also known as “cyclical shared partner”

Reciprocated Twopath (
“RTP” )

vertex k is an RTP shared partner of ordered pair (i,j) iff i<>k<>j.

Outgoing Shared Partner (
“OSP” )

vertex k is an OSP shared partner of ordered pair (i,j) iff i>k, j>k.

Incoming Shared Partner (
“ISP” )

vertex k is an ISP shared partner of ordered pair (i,j) iff k>i, k>j.
By default, outgoing twopaths (“OTP” ) are calculated. Note that Robins et al. (2009) define closely related statistics to several of the above, using slightly different terminology.

binary, directed

dsp(d)
Dyadwise shared partners: The d argument is a vector of distinct integers. This term adds one network statistic to the model for each element in d ; the ith such statistic equals the number of dyads in the network with exactly d[i] shared partners. This term can be used with directed and undirected networks.
For directed networks, only outgoing twopath (“OTP”) shared partners are counted. In other words, for a (directed) dyad (i,j) in a directed graph, the number of shared partners counted by dsp is the number of nodes k that have edges i > k > j . (These may also be called homogeneous shared partners.) To count other types of shared partners instead, see ddsp .

binary, directed, undirected

dyadcov(x, attrname=NULL)
Dyadic covariate: The x argument is either a square matrix of covariates, one for each possible edge in the network, the name of a network attribute of covariates, or a network; if the latter, optional argument attrname provides the name of the quantitative edge attribute to use for covariate values (in this case, missing edges in x are assigned a covariate value of zero). This term adds three statistics to the model, each equal to the sum of the covariate values for all dyads occupying one of the three possible nonempty dyad states (mutual, uppertriangular asymmetric, and lowertriangular asymmetric dyads, respectively), with the empty or null state serving as a reference category. If the network is undirected, x is either a matrix of edgewise covariates, or a network; if the latter, optional argument attrname provides the name of the edge attribute to use for edge values. This term adds one statistic to the model, equal to the sum of the covariate values for each edge appearing in the network. The edgecov and dyadcov terms are equivalent for undirected networks.

binary, dyadindependent, directed, undirected, categorical nodal attribute

edgecov(x, attrname=NULL)
Edge covariate: The x argument is either a square matrix of covariates, one for each possible edge in the network, the name of a network attribute of covariates, or a network; if the latter, optional argument attrname provides the name of the quantitative edge attribute to use for covariate values (in this case, missing edges in x are assigned a covariate value of zero). This term adds one statistic to the model, equal to the sum of the covariate values for each edge appearing in the network. The edgecov term applies to both directed and undirected networks. For undirected networks the covariates are also assumed to be undirected. The edgecov and dyadcov terms are equivalent for undirected networks.

binary, dyadindependent, directed, undirected, frequentlyused

edgecov(x,)
Edge covariate: The x argument is either a square matrix of covariates, one for each possible edge in the network, the name of a network attribute of covariates, or a network; if the latter, optional argument attrname provides the name of the quantitative edge attribute to use for covariate values (in this case, missing edges in x are assigned a covariate value of zero). This term adds one statistic to the model, equal to the sum of the covariate values for each edge appearing in the network. The edgecov term applies to both directed and undirected networks. For undirected networks the covariates are also assumed to be undirected. The edgecov and dyadcov terms are equivalent for undirected networks.

valued, directed, undirected, dyadindependent

edges()
Edges: This term adds one network statistic equal to the number of edges (i.e. nonzero values) in the network. For undirected networks, edges is equal to kstar(1) ; for directed networks, edges is equal to both ostar(1) and istar(1) .

binary, valued, dyadindependent, directed, undirected, frequentlyused

nonzero()
Edges: This term adds one network statistic equal to the number of edges (i.e. nonzero values) in the network. For undirected networks, edges is equal to kstar(1) ; for directed networks, edges is equal to both ostar(1) and istar(1) .

valued, directed, undirected, dyadindependent

esp(d)
Edgewise shared partners: This is just like the dsp term, except this term adds one network statistic to the model for each element in d where the ith such statistic equals the number of edges (rather than dyads) in the network with exactly d[i] shared partners. This term can be used with directed and undirected networks.
For directed networks, only outgoing twopath (“OTP”) shared partners are counted. In other words, for a (directed) edge i > j in a directed graph, the number of shared partners counted by esp is the number of nodes k that have edges i > k > j . (These may also be called homogeneous shared partners.) To count other types of shared partners instead, see desp .

binary, directed, undirected

equalto(value=0, tolerance=0)
Number of dyads with values equal to a specific value (within tolerance): Adds one statistic equal to the number of dyads whose values are within tolerance of value , i.e., between valuetolerance and value+tolerance , inclusive.

valued, directed, undirected, dyadindependent

greaterthan(threshold=0)
Number of dyads with values strictly greater than a threshold: Adds the number of statistics equal to the length of threshold equaling to the number of dyads whose values exceed the corresponding element of threshold .

valued, directed, undirected, dyadindependent

gwb1degree(decay, fixed=FALSE, attr=NULL, cutoff=30, levels=NULL)
Geometrically weighted degree distribution for the first mode in a bipartite (aka twomode) network: This term adds one network statistic to the model equal to the weighted degree distribution with decay controlled by the decay parameter, which should be nonnegative, for nodes in the first mode of a bipartite network. The first mode of a bipartite network object is sometimes known as the “actor” mode. The decay parameter is the same as theta_s in equation (14) in Hunter (2007). The value supplied for this parameter may be fixed (if fixed=TRUE ), or it may be used as merely the starting value for the estimation in a curved exponential family model (the default).
The optional argument cutoff sets the number of underlying degree terms to use in computing the statistics when fixed=FALSE , in order to reduce the computational burden. Its default value can also be controlled by the gw.cutoff term option control parameter. (See control.ergm .)
If attr is specified (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details) then separate degree statistics are calculated for nodes having each separate value of the attribute. This term can only be used with undirected bipartite networks.

binary, bipartite, undirected, curved

gwb1dsp(decay=0, fixed=FALSE, cutoff=30)
Geometrically weighted dyadwise shared partner distribution for dyads in the first bipartition: This term adds one network statistic to the model equal to the geometrically weighted dyadwise shared partner distribution for dyads in the first bipartition, with decay parameter decay parameter, which should be nonnegative. The value supplied for this parameter may be fixed (if fixed=TRUE ), or it may be used instead as the starting value for the estimation of decay in a curved exponential family model (when fixed=FALSE , the default) (see Hunter and Handcock, 2006). This term can only be used with bipartite networks.
The optional argument cutoff sets the number of underlying b1dsp terms to use in computing the statistics when fixed=FALSE , in order to reduce the computational burden. Its default value can also be controlled by the gw.cutoff term option control parameter. (See control.ergm .)

binary, bipartite, undirected, curved

gwb2degree(decay, fixed=FALSE, attr=NULL, cutoff=30, levels=NULL)
Geometrically weighted degree distribution for the second mode in a bipartite (aka twomode) network: This term adds one network statistic to the model equal to the weighted degree distribution with decay controlled by the which should be nonnegative, for nodes in the second mode of a bipartite network. The second mode of a bipartite network object is sometimes known as the “event” mode. The decay parameter is the same as theta_s in equation (14) in Hunter (2007). The value supplied for this parameter may be fixed (if fixed=TRUE ), or it may be used as merely the starting value for the estimation in a curved exponential family model (the default).
The optional argument cutoff sets the number of underlying degree terms to use in computing the statistics when fixed=FALSE , in order to reduce the computational burden. Its default value can also be controlled by the gw.cutoff term option control parameter. (See control.ergm .)
If attr is specified (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details) then separate degree statistics are calculated for nodes having each separate value of the attribute. This term can only be used with undirected bipartite networks.

binary, bipartite, undirected, curved

gwb2dsp(decay=0, fixed=FALSE, cutoff=30)
Geometrically weighted dyadwise shared partner distribution for dyads in the second bipartition: This term adds one network statistic to the model equal to the geometrically weighted dyadwise shared partner distribution for dyads in the second bipartition, with decay parameter decay parameter, which should be nonnegative. The value supplied for this parameter may be fixed (if fixed=TRUE ), or it may be used instead as the starting value for the estimation of decay in a curved exponential family model (when fixed=FALSE , the default) (see Hunter and Handcock, 2006). This term can only be used with bipartite networks.
The optional argument cutoff sets the number of underlying b2dsp terms to use in computing the statistics when fixed=FALSE , in order to reduce the computational burden. Its default value can also be controlled by the gw.cutoff term option control parameter. (See control.ergm .)

binary, bipartite, undirected, curved

gwdegree(decay, fixed=FALSE, attr=NULL, cutoff=30, levels=NULL)
Geometrically weighted degree distribution: This term adds one network statistic to the model equal to the weighted degree distribution with decay controlled by the decay parameter. The decay parameter is the same as theta_s in equation (14) in Hunter (2007). The value supplied for this parameter may be fixed (if fixed=TRUE ), or it may be used instead as the starting value for the estimation of decay in a curved exponential family model (when fixed=FALSE , the default) (see Hunter and Handcock, 2006).
The optional argument cutoff sets the number of underlying degree terms to use in computing the statistics when fixed=FALSE , in order to reduce the computational burden. Its default value can also be controlled by the gw.cutoff term option control parameter. (See control.ergm .)
If attr is specified (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details) then separate degree statistics are calculated for nodes having each separate value of the attribute. This term can only be used with undirected networks.

binary, undirected, curved, frequentlyused

gwdsp(decay, fixed=FALSE, cutoff=30)
Geometrically weighted dyadwise shared partner distribution: This term adds one network statistic to the model equal to the geometrically weighted dyadwise shared partner distribution with decay parameter decay parameter, which should be nonnegative. The value supplied for this parameter may be fixed (if fixed=TRUE ), or it may be used instead as the starting value for the estimation of decay in a curved exponential family model (when fixed=FALSE , the default) (see Hunter and Handcock, 2006). This term can be used with directed and undirected networks.
For directed networks, only outgoing twopath (“OTP”) shared partners are counted. In other words, for a (directed) dyad (i,j) in a directed graph, the number of shared partners counted by gwdsp is the number of nodes k that have edges i > k > j . (These may also be called homogeneous shared partners.) To count other types of shared partners instead, see dgwdsp .
The optional argument cutoff sets the number of underlying DSP terms to use in computing the statistics when fixed=FALSE , in order to reduce the computational burden. Its default value can also be controlled by the gw.cutoff term option control parameter. (See control.ergm .)

binary, directed, undirected, curved

gwesp(decay, fixed=FALSE, cutoff=30)
Geometrically weighted edgewise shared partner distribution: This term is just like gwdsp except it adds a statistic equal to the geometrically weighted edgewise (not dyadwise) shared partner distribution with decay parameter decay parameter, which should be nonnegative. The value supplied for this parameter may be fixed (if fixed=TRUE ), or it may be used instead as the starting value for the estimation of decay in a curved exponential family model (when fixed=FALSE , the default) (see Hunter and Handcock, 2006). This term can be used with directed and undirected networks.
For directed networks, only outgoing twopath (“OTP”) shared partners are counted. In other words, for a (directed) edge i > j in a directed graph, the number of shared partners counted by gwesp is the number of nodes k that have edges i > k > j . (These may also be called homogeneous shared partners.) To count other types of shared partners instead, see dgwesp .
The optional argument cutoff sets the number of underlying ESP terms to use in computing the statistics when fixed=FALSE , in order to reduce the computational burden. Its default value can also be controlled by the gw.cutoff term option control parameter. (See control.ergm .)

binary, frequentlyused, directed, undirected, curved

gwidegree(decay, fixed=FALSE, attr=NULL, cutoff=30, levels=NULL)
Geometrically weighted indegree distribution: This term adds one network statistic to the model equal to the weighted indegree distribution with decay parameter decay parameter, which should be nonnegative. (this parameter was called alpha prior to ergm 3.7 ). The value supplied for this parameter may be fixed (if fixed=TRUE ), or it may be used instead as the starting value for the estimation of decay in a curved exponential family model (when fixed=FALSE , the default) (see Hunter and Handcock, 2006). This term can only be used with directed networks.
The optional argument cutoff sets the number of underlying degree terms to use in computing the statistics when fixed=FALSE , in order to reduce the computational burden. Its default value can also be controlled by the gw.cutoff term option control parameter. (See control.ergm .)
If attr is specified (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details) then separate degree statistics are calculated for nodes having each separate value of the attribute.

binary, directed, curved

gwnsp(decay, fixed=FALSE, cutoff=30)
Geometrically weighted nonedgewise shared partner distribution: This term is just like gwesp and gwdsp except it adds a statistic equal to the geometrically weighted nonedgewise (that is, over dyads that do not have an edge) shared partner distribution with weight parameter decay parameter, which should be nonnegative. (this parameter was called alpha prior to ergm 3.7 ). The optional argument fixed indicates whether the decay parameter is fixed at the given value, or is to be fit as a curved exponentialfamily model (see Hunter and Handcock, 2006). The default is FALSE , which means the scale parameter is not fixed and thus the model is a CEF model. This term can be used with directed and undirected networks.
For directed networks, only outgoing twopath (“OTP”) shared partners are counted. In other words, for a (directed) nonedge (i,j) in a directed graph, the number of shared partners counted by gwnsp is the number of nodes k that have edges i > k > j . (These may also be called homogeneous shared partners.) To count other types of shared partners instead, see dgwnsp .
The optional argument cutoff sets the number of underlying NSP terms to use in computing the statistics when fixed=FALSE , in order to reduce the computational burden. Its default value can also be controlled by the gw.cutoff term option control parameter. (See control.ergm .)

binary, directed, undirected, curved

gwodegree(decay, fixed=FALSE, attr=NULL, cutoff=30, levels=NULL)
Geometrically weighted outdegree distribution: This term adds one network statistic to the model equal to the weighted outdegree distribution with decay parameter decay parameter, which should be nonnegative. (this parameter was called alpha prior to ergm 3.7 ). The value supplied for this parameter may be fixed (if fixed=TRUE ), or it may be used instead as the starting value for the estimation of decay in a curved exponential family model (when fixed=FALSE , the default) (see Hunter and Handcock, 2006). This term can only be used with directed networks.
The optional argument cutoff sets the number of underlying degree terms to use in computing the statistics when fixed=FALSE , in order to reduce the computational burden. Its default value can also be controlled by the gw.cutoff term option control parameter. (See control.ergm .)
If attr is specified (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details) then separate degree statistics are calculated for nodes having each separate value of the attribute.

binary, directed, curved

hamming(x, cov, attrname=NULL)
Hamming distance: This term adds one statistic to the model equal to the weighted or unweighted Hamming distance of the network from the network specified by x . (If no argument is given, x is taken to be the observed network, i.e., the network on the left side of the ~ in the formula that defines the ERGM.) Unweighted Hamming distance is defined as the total number of pairs (i,j) (ordered or unordered, depending on whether the network is directed or undirected) on which the two networks differ. If the optional argument cov is specified, then the weighted Hamming distance is computed instead, where each pair (i,j) contributes a prespecified weight toward the distance when the two networks differ on that pair. The argument cov is either a matrix of edgewise weights or a network; if the latter, the optional argument attrname provides the name of the edge attribute to use for weight values.

binary, dyadindependent, directed, undirected

idegrange(from, to=+Inf, by=NULL, homophily=FALSE, levels=NULL)
Indegree range: The from and to arguments are vectors of distinct integers (or +Inf , for to (its default)). If one of the vectors has length 1, it is recycled to the length of the other. Otherwise, they must have the same length. This term adds one network statistic to the model for each element of from (or to ); the ith such statistic equals the number of nodes in the network of indegree greater than or equal to from[i] but strictly less than to[i] , i.e. with inedge count in semiopen interval [from,to) . The optional argument by specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If this is specified and homophily is TRUE , then degrees are calculated using the subnetwork consisting of only edges whose endpoints have the same value of the by attribute. If by is specified and homophily is FALSE (the default), then separate degree range statistics are calculated for nodes having each separate value of the attribute.
This term can only be used with directed networks; for undirected networks (bipartite and not) see degrange . For degrees of specific modes of bipartite networks, see b1degrange and b2degrange . For indegrees, see idegrange .

binary, directed, categorical nodal attribute

idegree(d, by=NULL, homophily=FALSE, levels=NULL)
Indegree: The d argument is a vector of distinct integers. This term adds one network statistic to the model for each element in d ; the ith such statistic equals the number of nodes in the network of indegree d[i] , i.e. the number of nodes with exactly d[i] inedges. The optional term by specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If this is specified and homophily is TRUE , then degrees are calculated using the subnetwork consisting of only edges whose endpoints have the same value of the by attribute. If by is specified and homophily is FALSE (the default), then separate degree statistics are calculated for nodes having each separate value of the attribute. This term can only be used with directed networks; for undirected networks see degree .

binary, directed, categorical nodal attribute, frequentlyused

idegree1.5()
Indegree to the 3/2 power: This term adds one network statistic to the model equaling the sum over the actors of each actor’s indegree taken to the 3/2 power (or, equivalently, multiplied by its square root). This term is analogous to the term of Snijders et al. (2010), equation (12). This term can only be used with directed networks.

binary, directed

idegreepopularity()
Indegree popularity (deprecated): see idegree1.5 .

binary, directed, deprecated

ininterval(lower=Inf, upper=+Inf, open=)
Number of dyads whose values are in an interval Adds one statistic equaling to the number of dyads whose values are between lower and upper . Argument open is a logical vector of length 2 that controls whether the interval is open (exclusive) on the lower and on the upper end, respectively. open can also be specified as one of “[]” , “(]” , “[)” , and “()” .

valued, directed, undirected, dyadindependent

intransitive()
Intransitive triads: This term adds one statistic to the model, equal to the number of triads in the network that are intransitive. The intransitive triads are those of type 111D , 201 , 111U , 021C , or 030C in the categorization of Davis and Leinhardt (1972). For details on the 16 possible triad types, see triad.classify in the sna package. Note the distinction from the ctriple term. This term can only be used with directed networks.

binary, directed, triadrelated

intransitive()
Intransitive triads: This term adds one statistic to the model, equal to the number of triads in the network that are intransitive. The intransitive triads are those of type 111D , 201 , 111U , 021C , or 030C in the categorization of Davis and Leinhardt (1972). For details on the 16 possible triad types, see triad.classify in the sna package. Note the distinction from the ctriple term. This term can only be used with directed networks.

binary, directed, triadrelated

isolatededges()
Isolated edges: This term adds one statistic to the model equal to the number of isolated edges in the network, i.e., the number of edges each of whose endpoints has degree 1. This term can only be used with undirected networks.

binary, undirected, bipartite

isolates()
Isolates: This term adds one statistic to the model equal to the number of isolates in the network. For an undirected network, an isolate is defined to be any node with degree zero. For a directed network, an isolate is any node with both indegree and outdegree equal to zero.

binary, directed, undirected, frequentlyused

istar(k, attr=NULL, levels=NULL)
Instars: The k argument is a vector of distinct integers. This term adds one network statistic to the model for each element in k . The ith such statistic counts the number of distinct k[i] instars in the network, where a kinstar is defined to be a node N and a set of k different nodes {O[1], …, O[k]} such that the ties (O_j, N) exist for j=1, …, k. The optional argument attr specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If this is specified then the count is over the number of kinstars where all nodes have the same value of the attribute. This term can only be used for directed networks; for undirected networks see kstar . Note that istar(1) is equal to both ostar(1) and edges .

binary, directed, categorical nodal attribute

kstar(k, attr=NULL, levels=NULL)
kStars: The k argument is a vector of distinct integers. This term adds one network statistic to the model for each element in k . The ith such statistic counts the number of distinct k[i] stars in the network, where a kstar is defined to be a node N and a set of k different nodes {O[1], …, O[k]} such that the ties {N, O[i]} exist for i=1, …, k. The optional argument attr specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If this is specified then the count is over the number of kstars where all nodes have the same value of the attribute. This term can only be used for undirected networks; for directed networks, see istar , ostar , twopath and m2star . Note that kstar(1) is equal to edges .

binary, undirected, categorical nodal attribute

smallerthan(threshold=0)
Number of dyads with values strictly smaller than a threshold: Adds the number of statistics equal to the length of threshold equaling to the number of dyads whose values are exceeded by the corresponding element of threshold .

valued, directed, undirected, dyadindependent

localtriangle(x)
Triangles within neighborhoods: This term adds one statistic to the model equal to the number of triangles in the network between nodes “close to” each other. For an undirected network, a local triangle is defined to be any set of three edges between nodal pairs {(i,j), (j,k), (k,i)} that are in the same neighborhood. For a directed network, a triangle is defined as any set of three edges (i,j), (j,k) and either (k{}i) or (k{≤ftarrow}i) where again all nodes are within the same neighborhood. The argument x is an undirected network or an symmetric adjacency matrix that specifies whether the two nodes are in the same neighborhood. Note that triangle , with or without an argument, is a special case of localtriangle .

binary, triadrelated, directed, undirected

m2star()
Mixed 2stars, a.k.a 2paths: This term adds one statistic to the model, equal to the number of mixed 2stars in the network, where a mixed 2star is a pair of distinct edges (i,j), (j,k). A mixed 2star is sometimes called a 2path because it is a directed path of length 2 from i to k via j. However, in the case of a 2path the focus is usually on the endpoints i and k, whereas for a mixed 2star the focus is usually on the midpoint j. This term can only be used with directed networks; for undirected networks see kstar(2) . See also twopath .

binary, directed

meandeg()
Mean vertex degree: This term adds one network statistic to the model equal to the average degree of a node. Note that this term is a constant multiple of both edges and density .

binary, dyadindependent, directed, undirected

mm(attrs, levels=NULL, levels2=1)
Mixing matrix cells and margins: attrs is a twosided formula whose LHS gives the attribute or attribute function (see Specifying Vertex attributes and Levels (? nodal_attributes )) for the rows of the mixing matrix and whose RHS gives that for its columns. A onesided formula (e.g., ~A ) is symmetrized (e.g., A~A ). levels similarly specifies the subset of rows and columns to be used. levels2 can then be used to filter which specific cells of the matrix to include. A twosided formula with a dot on one side calculates the margins of the mixing matrix, analogously to nodefactor , with A~. calculating the row/sender/b1 margins and .~A calculating the column/receiver/b2 margins.

binary, dyadindependent, frequentlyused, directed, undirected, categorical nodal attribute

mm(attrs, levels=NULL, levels2=1, form=“sum”)
Mixing matrix cells and margins: attrs is a twosided formula whose LHS gives the attribute or attribute function (see Specifying Vertex attributes and Levels (? nodal_attributes )) for the rows of the mixing matrix and whose RHS gives that for its columns. A onesided formula (e.g., ~A ) is symmetrized (e.g., A~A ). levels similarly specifies the subset of rows and columns to be used. levels2 can then be used to filter which specific cells of the matrix to include. A twosided formula with a dot on one side calculates the margins of the mixing matrix, analogously to nodefactor , with A~. calculating the row/sender/b1 margins and .~A calculating the column/receiver/b2 margins.

valued, dyadindependent, frequentlyused, directed, undirected, categorical nodal attribute

mutual(same=NULL, by=NULL, diff=FALSE, keep=NULL, levels=NULL)
Mutuality: In binary ERGMs, equal to the number of pairs of actors i and j for which (i,j) and (j,i) both exist. For valued ERGMs, equal to ∑{i<j} m(y{i,j},y_{j,i}), where m is determined by form argument: “min” for (y_{i,j},y_{j,i}), “nabsdiff” for y_{i,j},y_{j,i}, “product” for y_{i,j}y_{j,i}, and “geometric” for √{y_{i,j}}√{y_{j,i}}. See Krivitsky (2012) for a discussion of these statistics. form=“threshold” simply computes the binary mutuality after thresholding at threshold .
This term can only be used with directed networks. The binary version also has the following capabilities: if the optional same argument is passed (see Specifying Vertex Attributes and Levels for details), only mutual pairs that match on the attribute are counted; separate counts for each unique matching value can be obtained by using diff=TRUE with same ; and if by is passed (again, see Specifying Vertex Attributes and Levels), then each node is counted separately for each mutual pair in which it occurs and the counts are tabulated by unique values of the attribute. This means that the sum of the mutual statistics when by is used will equal twice the standard mutual statistic. Only one of same or by may be used, and only the former is affected by diff ; if both same and by are passed, by is ignored. Finally, if levels is passed, this tells which statistics should be kept whenever the mutual term would ordinarily result in multiple statistics (see Specifying Vertex Attributes and Levels).
The argument keep is retained for backwards compatibility and may be removed in a future version. When both keep and levels are passed, levels overrides keep .

binary, directed, frequentlyused

mutual(form=“min”,threshold=0)
Mutuality: In binary ERGMs, equal to the number of pairs of actors i and j for which (i,j) and (j,i) both exist. For valued ERGMs, equal to ∑{i<j} m(y{i,j},y_{j,i}), where m is determined by form argument: “min” for (y_{i,j},y_{j,i}), “nabsdiff” for y_{i,j},y_{j,i}, “product” for y_{i,j}y_{j,i}, and “geometric” for √{y_{i,j}}√{y_{j,i}}. See Krivitsky (2012) for a discussion of these statistics. form=“threshold” simply computes the binary mutuality after thresholding at threshold .
This term can only be used with directed networks. The binary version also has the following capabilities: if the optional same argument is passed (see Specifying Vertex Attributes and Levels for details), only mutual pairs that match on the attribute are counted; separate counts for each unique matching value can be obtained by using diff=TRUE with same ; and if by is passed (again, see Specifying Vertex Attributes and Levels), then each node is counted separately for each mutual pair in which it occurs and the counts are tabulated by unique values of the attribute. This means that the sum of the mutual statistics when by is used will equal twice the standard mutual statistic. Only one of same or by may be used, and only the former is affected by diff ; if both same and by are passed, by is ignored. Finally, if levels is passed, this tells which statistics should be kept whenever the mutual term would ordinarily result in multiple statistics (see Specifying Vertex Attributes and Levels).
The argument keep is retained for backwards compatibility and may be removed in a future version. When both keep and levels are passed, levels overrides keep .

valued, directed

nearsimmelian()
Near simmelian triads: This term adds one statistic to the model equal to the number of near Simmelian triads, as defined by Krackhardt and Handcock (2007). This is a subgraph of size three which is exactly one tie short of being complete. This term can only be used with directed networks.

binary, directed, triadrelated

nodecov(attr)
Main effect of a covariate: The attr argument specifies one or more quantitative attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds a single network statistic for each quantitative attribute or matrix column to the model equaling the sum of attr(i) and attr(j) for all edges (i,j) in the network. For categorical attributes, see nodefactor . Note that for directed networks, nodecov equals nodeicov plus nodeocov .
Note that ergm versions 3.9.4 and earlier used different arguments for this term. See the above section on versioning for invoking the old behavior.

binary, dyadindependent, frequentlyused, directed, undirected, quantitative nodal attribute

nodecov(attr, form=“sum”)
Main effect of a covariate: The attr argument specifies one or more quantitative attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds a single network statistic for each quantitative attribute or matrix column to the model equaling the sum of attr(i) and attr(j) for all edges (i,j) in the network. For categorical attributes, see nodefactor . Note that for directed networks, nodecov equals nodeicov plus nodeocov .
Note that ergm versions 3.9.4 and earlier used different arguments for this term. See the above section on versioning for invoking the old behavior.

valued, dyadindependent, directed, undirected, quantitative nodal attribute

nodemain()
Main effect of a covariate: The attr argument specifies one or more quantitative attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds a single network statistic for each quantitative attribute or matrix column to the model equaling the sum of attr(i) and attr(j) for all edges (i,j) in the network. For categorical attributes, see nodefactor . Note that for directed networks, nodecov equals nodeicov plus nodeocov .
Note that ergm versions 3.9.4 and earlier used different arguments for this term. See the above section on versioning for invoking the old behavior.

binary, directed, undirected

nodecovar(center, transform)
Covariance of undirected dyad values incident on each actor: This term adds one statistic equal to ∑{i,j<k} y{i,j}y_{i,k}/(n2). This can be viewed as a valued analog of the star(2) statistic. If center=TRUE , the y_{,}s are centered by their mean over the whole network before the calculation. Note that this makes the model nonlocal, but it may alleviate multimodailty. If transform=“sqrt” , y_{,}s are repaced by their square roots before the calculation. This makes sense for counts in particular. If center=TRUE as well, they are centered by the mean of the square roots.
Note that this term replaces nodesqrtcovar , which has been deprecated in favor of nodecovar(transform=“sqrt”) .

valued, directed

nodecovar()
Uncentered covariance of dyad values incident on each actor: This term adds one statistic equal to ∑{i,j,k} (y{i,j}y_{i,k}+y_{k,j}y_{k,j}). This can be viewed as a valued analog of the kstar(2) statistic.

valued, directed, undirected, quantitative nodal attribute

nodefactor(attr, base=1, levels=1)
Factor attribute effect: The attr argument specifies one or more categorical attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds multiple network statistics to the model, one for each of (a subset of) the unique values of the attr attribute (or each combination of the attributes given). Each of these statistics gives the number of times a node with that attribute or those attributes appears in an edge in the network.
The optional levels argument controls which levels of the attribute should be included and which should be excluded. (See Specifying Vertex attributes and Levels (? nodal_attributes ) for details.) For example, if the “fruit” attribute has levels “orange”, “apple”, “banana”, and “pear”, then to include just two levels, one for “apple” and one for “pear”, use any of nodefactor(“fruit”, levels=(2:3)) , nodefactor(“fruit”, levels=c(1,4)) , and nodefactor(“fruit”, levels=c(“apple”, “pear”)) . Note: if you are using numeric values to specify the levels of a character variable, the levels will correspond to the alphabetically sorted character levels.
To include all attribute values is usually not a good idea, because the sum of all such statistics equals the number of edges and hence a linear dependency would arise in any model also including edges . The default, levels=1 , is therefore to omit the first (in lexicographic order) attribute level. To include all levels, pass either levels=TRUE (i.e., keep all levels) or levels=NULL (i.e., do not filter levels).
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and levels are passed, levels overrides base .

binary, dyadindependent, directed, undirected, categorical nodal attribute, frequentlyused

nodefactor(attr, base=1, levels=1, form=“sum”)
Factor attribute effect: The attr argument specifies one or more categorical attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds multiple network statistics to the model, one for each of (a subset of) the unique values of the attr attribute (or each combination of the attributes given). Each of these statistics gives the number of times a node with that attribute or those attributes appears in an edge in the network.
The optional levels argument controls which levels of the attribute should be included and which should be excluded. (See Specifying Vertex attributes and Levels (? nodal_attributes ) for details.) For example, if the “fruit” attribute has levels “orange”, “apple”, “banana”, and “pear”, then to include just two levels, one for “apple” and one for “pear”, use any of nodefactor(“fruit”, levels=(2:3)) , nodefactor(“fruit”, levels=c(1,4)) , and nodefactor(“fruit”, levels=c(“apple”, “pear”)) . Note: if you are using numeric values to specify the levels of a character variable, the levels will correspond to the alphabetically sorted character levels.
To include all attribute values is usually not a good idea, because the sum of all such statistics equals the number of edges and hence a linear dependency would arise in any model also including edges . The default, levels=1 , is therefore to omit the first (in lexicographic order) attribute level. To include all levels, pass either levels=TRUE (i.e., keep all levels) or levels=NULL (i.e., do not filter levels).
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and levels are passed, levels overrides base .

dyadindependent, valued, directed, undirected, categorical nodal attribute

nodeicov(attr)
Main effect of a covariate for inedges: The attr argument specifies one or more quantitative attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds a single network statistic for each quantitative attribute or matrix column to the model equaling the total value of attr(j) for all edges (i,j) in the network. This term may only be used with directed networks. For categorical attributes, see nodeifactor .
Note that ergm versions 3.9.4 and earlier used different arguments for this term. See the above section on versioning for invoking the old behavior.

binary, directed, quantitative nodal attribute, frequentlyused

nodeicov(attr, form=“sum”)
Main effect of a covariate for inedges: The attr argument specifies one or more quantitative attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds a single network statistic for each quantitative attribute or matrix column to the model equaling the total value of attr(j) for all edges (i,j) in the network. This term may only be used with directed networks. For categorical attributes, see nodeifactor .
Note that ergm versions 3.9.4 and earlier used different arguments for this term. See the above section on versioning for invoking the old behavior.

valued, directed, quantitative nodal attribute

nodeicovar(center, transform)
Covariance of indyad values incident on each actor: This term adds one statistic equal to ∑{i,j,k} y{j,i}y_{k,i}/(n2). This can be viewed as a valued analog of the istar(2) statistic. If center=TRUE , the y_{,}s are centered by their mean over the whole network before the calculation. Note that this makes the model nonlocal, but it may alleviate multimodailty. If transform=“sqrt” , y_{,}s are repaced by their square roots before the calculation. This makes sense for counts in particular. If center=TRUE as well, they are centered by the mean of the square roots.
Note that this term replaces nodeisqrtcovar , which has been deprecated in favor of nodeicovar(transform=“sqrt”) .

valued, directed

nodeifactor(attr, base=1, levels=1)
Factor attribute effect for inedges: The attr argument specifies one or more categorical attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds multiple network statistics to the model, one for each of (a subset of) the unique values of the attr attribute (or each combination of the attributes given). Each of these statistics gives the number of times a node with that attribute or those attributes appears as the terminal node of a directed tie.
The optional levels argument controls which levels of the attribute should be included and which should be excluded. (See Specifying Vertex attributes and Levels (? nodal_attributes ) for details.) For example, if the “fruit” attribute has levels “orange”, “apple”, “banana”, and “pear”, then to include just two levels, one for “apple” and one for “pear”, use any of nodeifactor(“fruit”, levels=(2:3)) , nodeifactor(“fruit”, levels=c(1,4)) , and nodeifactor(“fruit”, levels=c(“apple”, “pear”)) . Note: if you are using numeric values to specify the levels of a character variable, the levels will correspond to the alphabetically sorted character levels.
To include all attribute values is usually not a good idea, because the sum of all such statistics equals the number of edges and hence a linear dependency would arise in any model also including edges . The default, levels=1 , is therefore to omit the first (in lexicographic order) attribute level. To include all levels, pass either levels=TRUE (i.e., keep all levels) or levels=NULL (i.e., do not filter levels).
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and levels are passed, levels overrides base .
For an analogous term for quantitative vertex attributes, see nodeicov .

binary, dyadindependent, directed, categorical nodal attribute, frequentlyused

nodeifactor(attr, base=1, levels=1, form=“sum”)
Factor attribute effect for inedges: The attr argument specifies one or more categorical attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds multiple network statistics to the model, one for each of (a subset of) the unique values of the attr attribute (or each combination of the attributes given). Each of these statistics gives the number of times a node with that attribute or those attributes appears as the terminal node of a directed tie.
The optional levels argument controls which levels of the attribute should be included and which should be excluded. (See Specifying Vertex attributes and Levels (? nodal_attributes ) for details.) For example, if the “fruit” attribute has levels “orange”, “apple”, “banana”, and “pear”, then to include just two levels, one for “apple” and one for “pear”, use any of nodeifactor(“fruit”, levels=(2:3)) , nodeifactor(“fruit”, levels=c(1,4)) , and nodeifactor(“fruit”, levels=c(“apple”, “pear”)) . Note: if you are using numeric values to specify the levels of a character variable, the levels will correspond to the alphabetically sorted character levels.
To include all attribute values is usually not a good idea, because the sum of all such statistics equals the number of edges and hence a linear dependency would arise in any model also including edges . The default, levels=1 , is therefore to omit the first (in lexicographic order) attribute level. To include all levels, pass either levels=TRUE (i.e., keep all levels) or levels=NULL (i.e., do not filter levels).
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and levels are passed, levels overrides base .
For an analogous term for quantitative vertex attributes, see nodeicov .

valued, dyadindependent, directed, categorical nodal attribute

nodematch(attr, diff=FALSE, keep=NULL, levels=NULL)
Uniform homophily and differential homophily: The attr argument specifies one or more attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). When diff=FALSE , this term adds one network statistic to the model, which counts the number of edges (i,j) for which attr(i)==attr(j) . This is also called ”uniform homophily,” because each group is assumed to have the same propensity for withingroup ties. When multiple attribute names are given, the statistic counts only ties for which all of the attributes match. When diff=TRUE , p network statistics are added to the model, where p is the number of unique values of the attr attribute. The kth such statistic counts the number of edges (i,j) for which attr(i) == attr(j) == value(k) , where value(k) is the kth smallest unique value of the attr attribute. This is also called ”differential homophily,” because each group is allowed to have a unique propensity for withingroup ties. Note that a statistical test of uniform vs. differential homophily should be conducted using the ANOVA function.
By default, matches on all levels k are counted. The optional levels argument controls which levels of the attribute should be included and which should be excluded. (See Specifying Vertex attributes and Levels (? nodal_attributes ) for details.) For example, if the “fruit” attribute has levels “orange”, “apple”, “banana”, and “pear”, then to include just two levels, one for “apple” and one for “pear”, use any of nodematch(“fruit”, levels=(2:3)) , nodematch(“fruit”, levels=c(1,4)) , and nodematch(“fruit”, levels=c(“apple”, “pear”)) . Note: if you are using numeric values to specify the levels of a character variable, the levels will correspond to the alphabetically sorted character levels. This works for both diff=TRUE and diff=FALSE .
The argument keep is retained for backwards compatibility and may be removed in a future version. When both keep and levels are passed, levels overrides keep .

binary, dyadindependent, frequentlyused, directed, undirected, categorical nodal attribute

nodematch(attr, diff=FALSE, keep=NULL, levels=NULL, form=“sum”)
Uniform homophily and differential homophily: The attr argument specifies one or more attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). When diff=FALSE , this term adds one network statistic to the model, which counts the number of edges (i,j) for which attr(i)==attr(j) . This is also called ”uniform homophily,” because each group is assumed to have the same propensity for withingroup ties. When multiple attribute names are given, the statistic counts only ties for which all of the attributes match. When diff=TRUE , p network statistics are added to the model, where p is the number of unique values of the attr attribute. The kth such statistic counts the number of edges (i,j) for which attr(i) == attr(j) == value(k) , where value(k) is the kth smallest unique value of the attr attribute. This is also called ”differential homophily,” because each group is allowed to have a unique propensity for withingroup ties. Note that a statistical test of uniform vs. differential homophily should be conducted using the ANOVA function.
By default, matches on all levels k are counted. The optional levels argument controls which levels of the attribute should be included and which should be excluded. (See Specifying Vertex attributes and Levels (? nodal_attributes ) for details.) For example, if the “fruit” attribute has levels “orange”, “apple”, “banana”, and “pear”, then to include just two levels, one for “apple” and one for “pear”, use any of nodematch(“fruit”, levels=(2:3)) , nodematch(“fruit”, levels=c(1,4)) , and nodematch(“fruit”, levels=c(“apple”, “pear”)) . Note: if you are using numeric values to specify the levels of a character variable, the levels will correspond to the alphabetically sorted character levels. This works for both diff=TRUE and diff=FALSE .
The argument keep is retained for backwards compatibility and may be removed in a future version. When both keep and levels are passed, levels overrides keep .

valued, dyadindependent, directed, undirected, categorical nodal attribute

match()
Uniform homophily and differential homophily: The attr argument specifies one or more attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). When diff=FALSE , this term adds one network statistic to the model, which counts the number of edges (i,j) for which attr(i)==attr(j) . This is also called ”uniform homophily,” because each group is assumed to have the same propensity for withingroup ties. When multiple attribute names are given, the statistic counts only ties for which all of the attributes match. When diff=TRUE , p network statistics are added to the model, where p is the number of unique values of the attr attribute. The kth such statistic counts the number of edges (i,j) for which attr(i) == attr(j) == value(k) , where value(k) is the kth smallest unique value of the attr attribute. This is also called ”differential homophily,” because each group is allowed to have a unique propensity for withingroup ties. Note that a statistical test of uniform vs. differential homophily should be conducted using the ANOVA function.
By default, matches on all levels k are counted. The optional levels argument controls which levels of the attribute should be included and which should be excluded. (See Specifying Vertex attributes and Levels (? nodal_attributes ) for details.) For example, if the “fruit” attribute has levels “orange”, “apple”, “banana”, and “pear”, then to include just two levels, one for “apple” and one for “pear”, use any of nodematch(“fruit”, levels=(2:3)) , nodematch(“fruit”, levels=c(1,4)) , and nodematch(“fruit”, levels=c(“apple”, “pear”)) . Note: if you are using numeric values to specify the levels of a character variable, the levels will correspond to the alphabetically sorted character levels. This works for both diff=TRUE and diff=FALSE .
The argument keep is retained for backwards compatibility and may be removed in a future version. When both keep and levels are passed, levels overrides keep .

binary, directed, dyadindependent, undirected, categorical nodal attribute

nodemix(attr, base=NULL, b1levels=NULL, b2levels=NULL, levels=NULL, levels2=1)
Nodal attribute mixing: The attr argument specifies one or more categorical vertex attributes (see Specifying Vertex Attributes and Levels for details). By default, this term adds one network statistic to the model for each possible pairing of attribute values. The statistic equals the number of edges in the network in which the nodes have that pairing of values. (When multiple attributes are specified, a statistic is added for each combination of attribute values for those attributes.) In other words, this term produces one statistic for every entry in the mixing matrix for the attribute(s). By default, the ordering of the attribute values is lexicographic: alphabetical (for nominal categories) or numerical (for ordered categories), but this can be overridden using the levels arguments. The optional arguments levels , levels2 , b1levels , and b2levels control what statistics are included in the model, and the order in which they appear. levels2 apply to all networks; levels applies to unipartite networks; b1levels and b2levels apply to bipartite networks (see Specifying Vertex attributes and Levels (? nodal_attributes )).
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and levels2 are passed, levels2 overrides base .

binary, dyadindependent, frequentlyused, directed, undirected, categorical nodal attribute

nodemix(attr, base=NULL, b1levels=NULL, b2levels=NULL, levels=NULL, levels2=1, form=“sum”)
Nodal attribute mixing: The attr argument specifies one or more categorical vertex attributes (see Specifying Vertex Attributes and Levels for details). By default, this term adds one network statistic to the model for each possible pairing of attribute values. The statistic equals the number of edges in the network in which the nodes have that pairing of values. (When multiple attributes are specified, a statistic is added for each combination of attribute values for those attributes.) In other words, this term produces one statistic for every entry in the mixing matrix for the attribute(s). By default, the ordering of the attribute values is lexicographic: alphabetical (for nominal categories) or numerical (for ordered categories), but this can be overridden using the levels arguments. The optional arguments levels , levels2 , b1levels , and b2levels control what statistics are included in the model, and the order in which they appear. levels2 apply to all networks; levels applies to unipartite networks; b1levels and b2levels apply to bipartite networks (see Specifying Vertex attributes and Levels (? nodal_attributes )).
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and levels2 are passed, levels2 overrides base .

valued, dyadindependent, directed, undirected, categorical nodal attribute

nodeocov(attr)
Main effect of a covariate for outedges: The attr argument specifies one or more quantitative attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds a single network statistic for each quantitative attribute or matrix column to the model equaling the total value of attr(i) for all edges (i,j) in the network. This term may only be used with directed networks. For categorical attributes, see nodeofactor .
Note that ergm versions 3.9.4 and earlier used different arguments for this term. See the above section on versioning for invoking the old behavior.

binary, directed, dyadindependent, quantitative nodal attribute

nodeocov(attr, form=“sum”)
Main effect of a covariate for outedges: The attr argument specifies one or more quantitative attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds a single network statistic for each quantitative attribute or matrix column to the model equaling the total value of attr(i) for all edges (i,j) in the network. This term may only be used with directed networks. For categorical attributes, see nodeofactor .
Note that ergm versions 3.9.4 and earlier used different arguments for this term. See the above section on versioning for invoking the old behavior.

valued, directed, dyadindependent

nodeocovar(center, transform)
Covariance of outdyad values incident on each actor: This term adds one statistic equal to ∑{i,j,k} y{i,j}y_{i,k}/(n2). This can be viewed as a valued analog of the ostar(2) statistic. If center=TRUE , the y_{,}s are centered by their mean over the whole network before the calculation. Note that this makes the model nonlocal, but it may alleviate multimodailty. If transform=“sqrt” , y_{,}s are repaced by their square roots before the calculation. This makes sense for counts in particular. If center=TRUE as well, they are centered by the mean of the square roots.
Note that this term replaces nodeosqrtcovar , which has been deprecated in favor of nodeocovar(transform=“sqrt”) .

valued, directed

nodeofactor(attr, base=1, levels=1)
Factor attribute effect for outedges: The attr argument specifies one or more categorical attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds multiple network statistics to the model, one for each of (a subset of) the unique values of the attr attribute (or each combination of the attributes given). Each of these statistics gives the number of times a node with that attribute or those attributes appears as the node of origin of a directed tie.
The optional levels argument controls which levels of the attribute should be included and which should be excluded. (See Specifying Vertex attributes and Levels (? nodal_attributes ) for details.) For example, if the “fruit” attribute has levels “orange”, “apple”, “banana”, and “pear”, then to include just two levels, one for “apple” and one for “pear”, use any of nodeofactor(“fruit”, levels=(2:3)) , nodeofactor(“fruit”, levels=c(1,4)) , and nodeofactor(“fruit”, levels=c(“apple”, “pear”)) . Note: if you are using numeric values to specify the levels of a character variable, the levels will correspond to the alphabetically sorted character levels.
To include all attribute values is usually not a good idea, because the sum of all such statistics equals the number of edges and hence a linear dependency would arise in any model also including edges . The default, levels=1 , is therefore to omit the first (in lexicographic order) attribute level. To include all levels, pass either levels=TRUE (i.e., keep all levels) or levels=NULL (i.e., do not filter levels).
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and levels are passed, levels overrides base .
This term can only be used with directed networks.

binary, dyadindependent, directed, categorical nodal attribute

nodeofactor(attr, base=1, levels=1, form=“sum”)
Factor attribute effect for outedges: The attr argument specifies one or more categorical attributes (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds multiple network statistics to the model, one for each of (a subset of) the unique values of the attr attribute (or each combination of the attributes given). Each of these statistics gives the number of times a node with that attribute or those attributes appears as the node of origin of a directed tie.
The optional levels argument controls which levels of the attribute should be included and which should be excluded. (See Specifying Vertex attributes and Levels (? nodal_attributes ) for details.) For example, if the “fruit” attribute has levels “orange”, “apple”, “banana”, and “pear”, then to include just two levels, one for “apple” and one for “pear”, use any of nodeofactor(“fruit”, levels=(2:3)) , nodeofactor(“fruit”, levels=c(1,4)) , and nodeofactor(“fruit”, levels=c(“apple”, “pear”)) . Note: if you are using numeric values to specify the levels of a character variable, the levels will correspond to the alphabetically sorted character levels.
To include all attribute values is usually not a good idea, because the sum of all such statistics equals the number of edges and hence a linear dependency would arise in any model also including edges . The default, levels=1 , is therefore to omit the first (in lexicographic order) attribute level. To include all levels, pass either levels=TRUE (i.e., keep all levels) or levels=NULL (i.e., do not filter levels).
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and levels are passed, levels overrides base .
This term can only be used with directed networks.

valued, dyadindependent, categorical nodal attribute, directed

nsp(d)
Nonedgewise shared partners: This is just like the dsp and esp terms, except this term adds one network statistic to the model for each element in d where the ith such statistic equals the number of nonedges (that is, dyads that do not have an edge) in the network with exactly d[i] shared partners. This term can be used with directed and undirected networks.
For directed networks, only outgoing twopath (“OTP”) shared partners are counted. In other words, for a (directed) nonedge (i,j) in a directed graph, the number of shared partners counted by nsp is the number of nodes k that have edges i > k > j . (These may also be called homogeneous shared partners.) To count other types of shared partners instead, see dnsp .

binary, directed, undirected

odegrange(from, to=+Inf, by=NULL, homophily=FALSE, levels=NULL)
Outdegree range: The from and to arguments are vectors of distinct integers (or +Inf , for to (its default)). If one of the vectors has length 1, it is recycled to the length of the other. Otherwise, they must have the same length. This term adds one network statistic to the model for each element of from (or to ); the ith such statistic equals the number of nodes in the network of outdegree greater than or equal to from[i] but strictly less than to[i] , i.e. with outedge count in semiopen interval [from,to) . The optional argument by specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If this is specified and homophily is TRUE , then degrees are calculated using the subnetwork consisting of only edges whose endpoints have the same value of the by attribute. If by is specified and homophily is FALSE (the default), then separate degree range statistics are calculated for nodes having each separate value of the attribute.
This term can only be used with directed networks; for undirected networks (bipartite and not) see degrange . For degrees of specific modes of bipartite networks, see b1degrange and b2degrange . For indegrees, see idegrange .

binary, directed, categorical nodal attribute

odegree(d, by=NULL, homophily=FALSE, levels=NULL)
Outdegree: The d argument is a vector of distinct integers. This term adds one network statistic to the model for each element in d ; the ith such statistic equals the number of nodes in the network of outdegree d[i] , i.e. the number of nodes with exactly d[i] outedges. The optional argument by specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If this is specified and homophily is TRUE , then degrees are calculated using the subnetwork consisting of only edges whose endpoints have the same value of the by attribute. If by is specified and homophily is FALSE (the default), then separate degree statistics are calculated for nodes having each separate value of the attribute. This term can only be used with directed networks; for undirected networks see degree .

binary, directed, categorical nodal attribute, frequentlyused

odegree1.5()
Outdegree to the 3/2 power: This term adds one network statistic to the model equaling the sum over the actors of each actor’s outdegree taken to the 3/2 power (or, equivalently, multiplied by its square root). This term is analogous to the term of Snijders et al. (2010), equation (12). This term can only be used with directed networks.

binary, directed

odegreepopularity()
Outdegree popularity (deprecated): see odegree1.5 .

binary, directed, deprecated

opentriad()
Open triads: This term adds one statistic to the model equal to the number of 2stars minus three times the number of triangles in the network. It is currently only implemented for undirected networks.

binary, undirected, triadrelated

ostar(k, attr=NULL, levels=NULL)
kOutstars: The k argument is a vector of distinct integers. This term adds one network statistic to the model for each element in k . The ith such statistic counts the number of distinct k[i] outstars in the network, where a koutstar is defined to be a node N and a set of k different nodes {O[1], …, O[k]} such that the ties (N,O_j) exist for j=1, …, k. The optional argument attr specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If this is specified then the count is the number of koutstars where all nodes have the same value of the attribute. This term can only be used with directed networks; for undirected networks see kstar . Note that ostar(1) is equal to both istar(1) and edges .

binary, directed, categorical nodal attribute

receiver(base=1, nodes=1)
Receiver effect: This term adds one network statistic for each node equal to the number of inties for that node. This measures the popularity of the node. The term for the first node is omitted by default because of linear dependence that arises if this term is used together with edges , but its coefficient can be computed as the negative of the sum of the coefficients of all the other actors. That is, the average coefficient is zero, following the HollandLeinhardt parametrization of the \(p_1\) model (Holland and Leinhardt, 1981). The base and nodes arguments allow the user to determine which nodes’ statistics should be included or excluded (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). The argument nodes is preferred to base , although base carries a default value of 1 for backwards compatibility. (If both base and nodes are supplied, then nodes overrides base .) This term can only be used with directed networks. For undirected networks, see sociality .

binary, directed, dyadindependent

receiver(base=1, nodes=1, form=“sum”)
Receiver effect: This term adds one network statistic for each node equal to the number of inties for that node. This measures the popularity of the node. The term for the first node is omitted by default because of linear dependence that arises if this term is used together with edges , but its coefficient can be computed as the negative of the sum of the coefficients of all the other actors. That is, the average coefficient is zero, following the HollandLeinhardt parametrization of the \(p_1\) model (Holland and Leinhardt, 1981). The base and nodes arguments allow the user to determine which nodes’ statistics should be included or excluded (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). The argument nodes is preferred to base , although base carries a default value of 1 for backwards compatibility. (If both base and nodes are supplied, then nodes overrides base .) This term can only be used with directed networks. For undirected networks, see sociality .

valued, directed, dyadindependent

sender(base=1, nodes=1)
Sender effect: This term adds one network statistic for each node equal to the number of outties for that node. This measures the activity of the node. The term for the first node is omitted by default because of linear dependence that arises if this term is used together with edges , but its coefficient can be computed as the negative of the sum of the coefficients of all the other actors. That is, the average coefficient is zero, following the HollandLeinhardt parametrization of the \(p_1\) model (Holland and Leinhardt, 1981). The nodes arguments allow the user to determine which nodes’ statistics should be included or excluded (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details).
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and nodes are passed, nodes overrides base .
This term can only be used with directed networks. For undirected networks, see sociality .

binary, directed, dyadindependent

sender(base=1, nodes=1, form=“sum”)
Sender effect: This term adds one network statistic for each node equal to the number of outties for that node. This measures the activity of the node. The term for the first node is omitted by default because of linear dependence that arises if this term is used together with edges , but its coefficient can be computed as the negative of the sum of the coefficients of all the other actors. That is, the average coefficient is zero, following the HollandLeinhardt parametrization of the \(p_1\) model (Holland and Leinhardt, 1981). The nodes arguments allow the user to determine which nodes’ statistics should be included or excluded (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details).
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and nodes are passed, nodes overrides base .
This term can only be used with directed networks. For undirected networks, see sociality .

valued, directed, dyadindependent

simmelian()
Simmelian triads: This term adds one statistic to the model equal to the number of Simmelian triads, as defined by Krackhardt and Handcock (2007). This is a complete subgraph of size three. This term can only be used with directed networks.

binary, directed, triadrelated

simmelianties()
Ties in simmelian triads: This term adds one statistic to the model equal to the number of ties in the network that are associated with Simmelian triads, as defined by Krackhardt and Handcock (2007). Each Simmelian has six ties in it but, because Simmelians can overlap in terms of nodes (and associated ties), the total number of ties in these Simmelians is less than six times the number of Simmelians. Hence this is a measure of the clustering of Simmelians (given the number of Simmelians). This term can only be used with directed networks.

binary, triadrelated, directed

smalldiff(attr, cutoff)
Number of ties between actors with similar (but not necessarily identical) attribute values: The attr argument specifies a quantitative vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). This term adds one statistic, having as its value the number of edges in the network for which the incident actors’ attribute values differ less than cutoff ; that is, number of edges between i to j such that abs(attr[i]attr[j])<cutoff .

binary, dyadindependent, directed, undirected, quantitative nodal attribute

sociality(attr=NULL, base=1, levels=NULL, nodes=1)
Undirected degree: This term adds one network statistic for each node equal to the number of ties of that node. This term can only be used with undirected networks. For directed networks, see sender and receiver . By default, nodes=1 means that the statistic for the first node will be omitted, but this argument may be changed to control which statistics are included just as for the nodes argument of sender and receiver terms.
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and nodes are passed, nodes overrides base .
The optional attr argument is deprecated and will be replaced with a more elegant implementation in a future release. In the meantime, it specifies a categorical vertex attribute (see Specifying Vertex Attributes and Levels for details). If provided, this term only counts ties between nodes with the same value of the attribute (an actorspecific version of the nodematch term), restricted to be one of the values specified by (also deprecated) levels if levels is not NULL .

binary, undirected, dyadindependent, categorical nodal attribute

sociality(attr=NULL, base=1, levels=NULL, nodes=1, form=“sum”)
Undirected degree: This term adds one network statistic for each node equal to the number of ties of that node. This term can only be used with undirected networks. For directed networks, see sender and receiver . By default, nodes=1 means that the statistic for the first node will be omitted, but this argument may be changed to control which statistics are included just as for the nodes argument of sender and receiver terms.
The argument base is retained for backwards compatibility and may be removed in a future version. When both base and nodes are passed, nodes overrides base .
The optional attr argument is deprecated and will be replaced with a more elegant implementation in a future release. In the meantime, it specifies a categorical vertex attribute (see Specifying Vertex Attributes and Levels for details). If provided, this term only counts ties between nodes with the same value of the attribute (an actorspecific version of the nodematch term), restricted to be one of the values specified by (also deprecated) levels if levels is not NULL .

valued, undirected, dyadindependent, categorical nodal attribute

sum(pow=1)
Sum of dyad values (optionally taken to a power): This term adds one statistic equal to the sum of dyad values taken to the power pow , which defaults to 1.

valued, directed, undirected

threetrail(keep=NULL, levels=NULL)
Threetrails: a.k.a. threepath . For an undirected network, this term adds one statistic equal to the number of 3trails, where a 3trail is defined as a “trail” of length three that traverses three distinct edges. Note that a 3trail need not include four distinct nodes; in particular, a triangle counts as three 3trails. For a directed network, this term adds four statistics (or some subset of these four specified by the levels argument), one for each of the four distinct types of directed threepaths. If the nodes of the path are written from left to right such that the middle edge points to the right (R), then the four types are RRR, RRL, LRR, and LRL. That is, an RRR 3trail is of the form i–>j–>k–>l, and RRL 3trail is of the form i–>j–>k<–l, etc. Like in the undirected case, there is no requirement that the nodes be distinct in a directed 3trail. However, the three edges must all be distinct. Thus, a mutual tie i<–>j does not count as a 3trail of the form i–>j–>i<–j; however, in the subnetwork i<–>j–>k, there are two directed 3trails, one LRR (k<–j–>i–>j) and one RRR (k<–j–>i–>j).
The argument keep is retained for backwards compatibility and may be removed in a future version. When both keep and levels are passed, levels overrides keep . This term used to be (inaccurately) called threepath . That name has been deprecated and may be removed in a future version.

binary, directed, undirected

transitive()
Transitive triads: This term adds one statistic to the model, equal to the number of triads in the network that are transitive. The transitive triads are those of type 120D , 030T , 120U , or 300 in the categorization of Davis and Leinhardt (1972). For details on the 16 possible triad types, see triad.classify in the sna package. Note the distinction from the ttriple term. This term can only be used with directed networks.

binary, directed, triadrelated

transitiveties(attr=NULL, levels=NULL)
Transitive ties: This term adds one statistic, equal to the number of ties i–>j such that there exists a twopath from i to j. (Related to the ttriple term.) The binary version takes a nodal attribute attr , and, if given, all three nodes involved (i, j, and the node on the twopath) must match on this attribute in order for i–>j to be counted.

binary, directed, undirected, triadrelated, categorical nodal attribute

transitiveties(threshold=0)
Transitive ties: This term adds one statistic, equal to the number of ties i–>j such that there exists a twopath from i to j. (Related to the ttriple term.) The binary version takes a nodal attribute attr , and, if given, all three nodes involved (i, j, and the node on the twopath) must match on this attribute in order for i–>j to be counted.

valued, directed, undirected, triadrelated

transitiveweights(twopath=“min”,combine=“max”,affect=“min”)
Transitive weights: This statistic implements the transitive weights statistic defined by Krivitsky (2012), Equation 13. The currently implemented options for twopath is the minimum of the constituent dyads (“min” ) or their geometric mean (“geomean” ); for combine , the maximum of the 2path strengths (“max” ) or their sum (“sum” ); and for affect , the minimum of the focus dyad and the combined strength of the two paths (“min” ) or their geometric mean (“geomean” ). For each of these options, the first (and the default) is more stable but also more conservative, while the second is more sensitive but more likely to induce a multimodal distribution of networks.

valued, directed, undirected, nonnegative, triadrelated

triadcensus(levels)
Triad census: For a directed network, this term adds one network statistic for each of an arbitrary subset of the 16 possible types of triads categorized by Davis and Leinhardt (1972) as 003, 012, 102, 021D, 021U, 021C, 111D, 111U, 030T, 030C, 201, 120D, 120U, 120C, 210, and 300 . Note that at least one category should be dropped; otherwise a linear dependency will exist among the 16 statistics, since they must sum to the total number of threenode sets. By default, the category 003 , which is the category of completely empty threenode sets, is dropped. This is considered category zero, and the others are numbered 1 through 15 in the order given above. By using the levels argument (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details), the user may specify a set of terms to add other than the default value of 1:15 . Each statistic is the count of the corresponding triad type in the network. For details on the 16 types, see ?triad.classify in the {sna} package, on which this code is based. For an undirected network, the triad census is over the four types defined by the number of ties (i.e., 0, 1, 2, and 3), and the default is to add 1:3 , which is to say that the 0 is dropped; however, this too may be controlled by changing the levels argument.

binary, triadrelated, directed, undirected

triangle(attr=NULL, diff=FALSE, levels=NULL)
Triangles: By default, this term adds one statistic to the model equal to the number of triangles in the network. For an undirected network, a triangle is defined to be any set {(i,j), (j,k), (k,i)} of three edges. For a directed network, a triangle is defined as any set of three edges (i,j) and (j,k) and either (k,i) or (i,k). The former case is called a “transitive triple” and the latter is called a “cyclic triple”, so in the case of a directed network, triangle equals ttriple plus ctriple — thus at most two of these three terms can be in a model. The optional argument attr specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If attr is specified and diff is FALSE , then the count is restricted to those triples of nodes with equal values of the vertex attribute specified by attr . If attr is specified and diff is TRUE , then one statistic is added for each value of attr (or each value specified by levels if that argument is passed), equal to the number of triangles where all three nodes have that value of the attribute.

binary, frequentlyused, triadrelated, directed, undirected, categorical nodal attribute

tripercent(attr=NULL, diff=FALSE, levels=NULL)
Triangle percentage: By default, this term adds one statistic to the model equal to 100 times the ratio of the number of triangles in the network to the sum of the number of triangles and the number of 2stars not in triangles (the latter is considered a potential but incomplete triangle). In case the denominator equals zero, the statistic is defined to be zero. For the definition of triangle, see triangle . The optional argument attr specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If attr is specified and diff is FALSE , the counts (both numerator and denominator) are restricted to those triples of nodes with equal values of the vertex attribute specified by attr . If attr is specified and diff is TRUE , then one statistic is added for each value of attr (or each value specified by levels if that argument is passed), where the counts (both numerator and denominator) are restricted to those triples of nodes with that value of the vertex attribute specified by attr . This is often called the mean correlation coefficient. This term can only be used with undirected networks; for directed networks, it is difficult to define the numerator and denominator in a consistent and meaningful way.

binary, undirected, triadrelated, categorical nodal attribute

ttriple(attr=NULL, diff=FALSE, levels=NULL)
Transitive triples: By default, this term adds one statistic to the model, equal to the number of transitive triples in the network, defined as a set of edges {(i,j), (j,k), (i,k)}. Note that triangle equals ttriple+ctriple for a directed network, so at most two of the three terms can be in a model. The optional argument attr specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If attr is specified and diff is FALSE , then the count is over the number of transitive triples where all three nodes have the same value of the attribute. If attr is specified and diff is TRUE , then one statistic is added for each value of attr (or each value of attr specified by levels if that argument is passed), equal to the number of transitive triples where all three nodes have that value of attr . This term can only be used with directed networks.

binary, directed, triadrelated, categorical nodal attribute

ttriad()
Transitive triples: By default, this term adds one statistic to the model, equal to the number of transitive triples in the network, defined as a set of edges {(i,j), (j,k), (i,k)}. Note that triangle equals ttriple+ctriple for a directed network, so at most two of the three terms can be in a model. The optional argument attr specifies a vertex attribute (see Specifying Vertex attributes and Levels (? nodal_attributes ) for details). If attr is specified and diff is FALSE , then the count is over the number of transitive triples where all three nodes have the same value of the attribute. If attr is specified and diff is TRUE , then one statistic is added for each value of attr (or each value of attr specified by levels if that argument is passed), equal to the number of transitive triples where all three nodes have that value of attr . This term can only be used with directed networks.

binary, directed, triadrelated, categorical nodal attribute

twopath()
2Paths: This term adds one statistic to the model, equal to the number of 2paths in the network. For a directed network this is defined as a pair of edges (i,j), (j,k), where i and j must be distinct. That is, it is a directed path of length 2 from i to k via j. For directed networks a 2path is also a mixed 2star but the interpretation is usually different; see m2star . For undirected networks a twopath is defined as a pair of edges {i,j}, {j,k}. That is, it is an undirected path of length 2 from i to k via j, also known as a 2star.

binary, directed, undirected
