diff-ergmTerm-0b65ee46: Difference

diff-ergmTermR Documentation

Difference

Description

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 "t-h" and of sign.action(attr[j]-attr[i])^pow if "h-t" . 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.

Usage

# binary: diff(attr, pow=1, dir="t-h", sign.action="identity")

# valued: diff(attr, pow=1, dir="t-h", sign.action="identity", form ="sum")

Arguments

attr

a vertex attribute specification (see Specifying Vertex attributes and Levels (?nodal_attributes) for details.)

pow

exponent for the node difference

dir

determines which vertix's attribute is subtracted from which. Accepts: "t-h" (the default), "tail-head" , "b1-b2", "h-t" , "head-tail" , and "b2-b1" .

sign.action

one of "identity", "abs", "posonly", "negonly". 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

form

how to aggregate tie values in a valued ERGM: "sum" (the default) for a statistic of the form \sum_{i,j} x_{i,j} y_{i,j}, where y_{i,j} is the value of dyad (i,j) and x_{i,j} is the term's covariate associated with it; and "nonzero" with the edge considered to be present if its value is not 0. See ergmTerm for more information.

Note

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 lower-indexed vertex to the higher-indexed vertex.

See Also

ergmTerm for index of model terms currently visible to the package.

\Sexpr[results=rd,stage=render]{ergm:::.formatTermKeywords("ergmTerm", "diff", "subsection")}

statnet/ergm documentation built on Feb. 28, 2025, 7:05 p.m.