R: Difference

diff-ergmTerm {ergm} | R 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` | quantitative attribute (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` | character how to aggregate tie values in a valued ERGM

### 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.

[Package ergm version 4.2.2 Index]