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.
# binary: diff(attr, pow=1, dir="t-h", sign.action="identity")# valued: diff(attr, pow=1, dir="t-h", sign.action="identity", form ="sum")
a vertex attribute specification (see Specifying Vertex attributes and Levels (?nodal_attributes
) for details.)
exponent for the node difference
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"
.
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
character how to aggregate tie values in a valued ERGM
ergmTerm
for index of model terms currently visible to the package.
ergm:::.formatTermKeywords("ergmTerm", "diff", "subsection")