vignettes/goldfishEffects.Rmd
goldfishEffects.Rmd
This vignette summarizes effects that are implemented in
goldfish
and are thus available to be used with
actor-oriented DyNAM models and tie-oriented Relational Event
Models.
Effect functions have the following 5 arguments:
data.frame$attribute
), see documentation of
defineNodes()
for details.FALSE
, it means that updates involving self-ties
are ignore during the statistics update.FALSE
means additional ties are taken into account). The
default value is FALSE
. Only available for structural
effects.TRUE
means it
relies also on the number of ties). The default value is
FALSE
.Inf
meaning that no windows are applied to the effect. Window size can be
specified as a number in seconds (i.e. an hour is 3600 seconds), or as a
string stating the number of time units in the format “number unit”, for
example “30 seconds”, “1 minute”, “2 hours”, “3 days”, “4 weeks”, “5
months”, or “6 years”. Note: The time units are converted to
seconds using their most common lengths in seconds.weighted == TRUE
.tertius
and tertiusDiff
. The function used as
argument is applied to aggregated statistic.indegree
,
outdegree
and nodeTrans
in the case of a REM
model model = "REM"
. In the default case of
type = "alter"
, the effect returns change statistics for
the potential receivers. In the case where type = "ego"
,
the effect returns change statistics for the potential sender. This
argument does not apply in the case of the DyNAM models: the
DyNAM-choice submodel only considers change statistics for potential
receivers type = "alter"
, while the DyNAM-rate submodel
only considers change statistics for potential senders
type = "ego"
.The following table summaries whether the corresponding arguments can be used for the effects or not.
isTwoMode | ignoreRep | weighted | window | transformFun | aggregateFun | type | |||
---|---|---|---|---|---|---|---|---|---|
Node/actor statistics | Structural | indeg | √ | √ | √ | √ | √ | × | √ |
outdeg | √ | √ | √ | √ | √ | × | √ | ||
nodeTrans | × | √ | √ | √ | √ | × | √ | ||
Attribute | ego | √ | × | × | × | × | × | × | |
alter | √ | × | × | × | × | × | × | ||
Structural + attribute | tertius | √ | √ | √ | √ | √ | √ | √ | |
Dyadic statistics | Structural | tie | √ | √ | √ | √ | √ | × | × |
inertia | √ | √ | √ | √ | √ | × | × | ||
recip | √ | √ | √ | √ | √ | × | × | ||
Attribute | same | √ | × | × | × | √ | × | × | |
diff | √ | × | × | × | √ | × | × | ||
sim | √ | × | × | × | √ | × | × | ||
egoAlterInt | √ | × | × | × | √ | × | × | ||
Structural + attribute | tertiusDiff | √ | √ | √ | √ | √ | √ | × | |
Closure effects | trans | × | √ | × | √ | √ | × | × | |
cycle | × | √ | × | √ | √ | × | × | ||
commonSender | √ | √ | × | √ | √ | × | × | ||
commonReceiver | √ | √ | × | √ | √ | × | × | ||
four | √ | √ | × | √ | √ | × | × | ||
mixedTrans | × | √ | × | √ | √ | × | × | ||
mixedCycle | × | √ | × | √ | √ | × | × | ||
mixedCommonSender | × | √ | × | √ | √ | × | × | ||
mixedCommonReceiver | × | √ | × | √ | √ | × | × |
Note that the use of some effects (combinations) are
ill-advised. For example, using
tie(network, ignoreRep = FALSE)
, where the network refers
to the dependent network, will always result in a change statistic of
zero, and thus cannot be used.
TRUE
and 0 in other case.weighted = TRUE
, similarly we refer as the unweighted
statistics when weighted = FALSE
.isTwoMode
is used. In the default case when
isTwoMode = FALSE
self ties are excluded in the calculation
of the change statistics.effect | rate | choice | choice coordination |
---|---|---|---|
indeg | √ | √ | √ |
outdeg | √ | √ | × |
nodeTrans | √ | √ | √ |
Here we refer to ego type when type = "ego"
and alter
type when type = "alter"
.
indeg()
)
indeg(network,
isTwoMode = FALSE, weighted = FALSE, window = Inf,
ignoreRep = FALSE, type = c("alter", "ego"), transformFun = identity
)
type = "ego"
) or for receiver j
(type = "alter"
).defineNetwork(net, directed = FALSE)
.The degree can be transform with .
outdeg()
)
outdeg(network,
isTwoMode = FALSE, weighted = FALSE, window = Inf,
ignoreRep = FALSE, type = c("alter", "ego"), transformFun = identity
)
type
allows to choose whether to use the outdegree effect
for sender
(type = "ego"
) or for receiver
(type = "alter"
).nodeTrans()
)
nodeTrans(network,
isTwoMode = FALSE, window = Inf, ignoreRep = FALSE,
type = c("alter", "ego"), transformFun = identity
)
Embeddedness in transitive structures as a source node.
type
allows to choose
whether to use the node embeddedness transitivity effect for sender
(type = "ego"
) or for receiver
(type = "alter"
).The statistic can be transform with , there is not weighted version for this effect.
effect | rate | choice | choice coordination |
---|---|---|---|
ego | √ | × | × |
alter | × | √ | × |
effect | rate | choice | choice coordination |
---|---|---|---|
tertius | √ | √ | √ |
tertius()
)
tertius(network, attribute,
isTwoMode = FALSE, window = Inf,
ignoreRep = FALSE, type = c("alter", "ego"), transformFun = identity,
aggregateFun = function(x) mean(x, na.rm = TRUE)
)
aggregateFun
) value of its
in-neighbors
()
in a covariate network (‘ego’ type).aggregateFun
) value of its
in-neighbors
()
in a covariate network (‘alter’ type).aggregateFun
) value of its
in-neighbors in a covariate network. The argument type
allows to choose whether to use the tertius effect for sender
(type = "ego"
) or for receiver
(type = "alter"
).Note: When a node does not have in-neighbors, the tertius effect is impute as the average of the aggregate values of nodes with in-neighbors.
effect | rate | choice | choice coordination |
---|---|---|---|
tie | × | √ | √ |
inertia | × | √ | √ |
recip | × | √ | × |
tie()
)
tie(network,
weighted = FALSE, window = Inf, ignoreRep = FALSE,
transformFun = identity
)
Tendency to create an event
if the tie
exists in a covariate network. Parameter weighted
can be
set to TRUE
if the value in the covariate network for the
dyad
is to be taken as a statistic. It can be transformed by using
transformFun
(This might make sense when
weighted = TRUE
).
inertia()
)
inertia(network, weighted = FALSE, window = Inf, transformFun = identity)
Usually used as the “intercept” for the choice submodel,
inertia is the tendency to create an event
if the event
happened before. It can be interpreted as the differential tendency to
update existing ties rather than creating new ones. Thus,
inertia is similar to tie, but defined on the network
to which the dependent events relate. Parameter weighted
can be set to TRUE
if the count of past events
is to be taken as a statistic. It can be transformed by using
transformFun
(this might make sense when
weighted = TRUE
). Note:
inertia
can never be used in combination with a
ignoreRep = TRUE
parameter as this would replace all
positive statistics with zeros.
recip()
)
recip(network,
weighted = FALSE, window = Inf, ignoreRep = FALSE,
transformFun = identity
)
Effect of a tie j->i on event . Recip cannot be used with binary = T in undirected dependent network
Tendency to create an event
if one or several
happened before. Parameter weighted
can be set to
TRUE
if the count/weight of
events/ties is to be taken as a statistic. It can be transformed by
using transformFun
(this might make sense when
weighted = TRUE
). This effect cannot be used for two-mode
networks and for DyNAM-choice_coordination submodel.
effect | rate | choice | choice coordination |
---|---|---|---|
same | × | √ | √ |
diff | × | √ | √ |
sim | × | √ | √ |
egoAlterInt | × | √ | √ |
same()
)
same(attribute)
Homophily (same value). The tendency of an event to happen if actors i and j have the same attribute value. This effect cannot be used for two-mode networks and for the DyNAM-rate submodel.
diff()
)
diff(attribute, transformFun = abs)
Heterophily. The tendency of an event
to happen if actors i and j have different attribute values (high
absolute differences regarding attribute if
transformFun = abs
). This effect cannot be used for
two-mode networks.
sim()
)
sim(attribute, transformFun = abs)
Homophily (similar value). The tendency of an event
to happen if actors i and j have similar attribute
values
(low absolute differences regarding attribute
if
transformFun = abs
). This effect cannot be used for
two-mode networks.
egoAlterInt()
)
egoAlterInt(attribute = list(attribute1, attribute2))
In a model that includes an alter effect using
attribute2
, the ego alter interaction helps to study the
tendency to create an event
when
score high on attribute2
moderated by the score of ego on
attribute1
.
effect | rate | choice | choice coordination |
---|---|---|---|
tertiusDiff | × | √ | √ |
tertiusDiff()
)
tertiusDiff(network, attribute,
isTwoMode = FALSE, weighted = FALSE,
window = Inf, ignoreRep = FALSE, transformFun = abs,
aggregateFun = function(x) mean(x, na.rm = TRUE)
)
The tendency to create an event
when
has a similar value as
aggregate (aggregateFun
) value of its in-neighbors
().
Note: When the node
does not have in-neighbors, its value is imputed by the average of the
similarities computed for the pairs
,
for all
that has at least one in-neighbor.
effect | rate | choice | choice coordination |
---|---|---|---|
trans | × | √ | √ |
cycle | × | √ | × |
commonSender | × | √ | × |
commonReceiver | × | √ | × |
four | × | √ | √ |
mixedTrans | × | √ | √ |
mixedCycle | × | √ | × |
mixedCommonSender | × | √ | × |
mixedCommonReceiver | × | √ | × |
trans()
)
trans(network, window = Inf, ignoreRep = FALSE, transformFun = identity)
It is the tendency to create an event
when it closes more two-paths
()
observed in the past events in a covariate network
. It can
be transformed by using transformFun
. This effect cannot be
used for two-mode networks.
cycle()
)
cycle(network, window = Inf, ignoreRep = FALSE, transformFun = identity)
It is the tendency to create an event
when it closes more two-paths
()
observed in the past events in a covariate network
. It can
be transformed by using transformFun
. This effect cannot be
used for two-mode networks and DyNAM-choice_coordination.
commonSender()
)
commonSender(network, window = Inf, ignoreRep = FALSE, transformFun = identity)
It is the tendency to create an event
when it closes more two-paths
()
observed in the past events in a covariate network
. It can
be transformed by using transformFun
. This effect cannot be
used for two-mode networks and DyNAM-choice_coordination.
commonReceiver()
)
commonReceiver(network,
window = Inf, ignoreRep = FALSE,
transformFun = identity
)
It is the tendency to create an event
when it closes more two-paths
()
observed in the past events in a covariate network
. It can
be transformed by using transformFun
. This effect cannot be
used for two-mode networks and DyNAM-choice_coordination.
four()
)
four(network,
isTwoMode = FALSE, window = Inf, ignoreRep = FALSE,
transformFun = identity
)
Closure of three-paths. It is the tendency to create an event
when it closes more three-paths
()
observed in the past events in a covariate network
. It can
be transformed by using transformFun
. This effect cannot be
used for two-mode networks and DyNAM-choice_coordination.
mixedTrans()
)
mixedTrans(
network = list(network1, network2), window = Inf,
ignoreRep = FALSE, transformFun = identity
)
Transitivity within 2 networks. It is the tendency to create an event
when it closes more two-paths with events
()
in network1
and
()
in network2
observed in the past events in the covariate
networks. It can be transformed by using transformFun
. This
effect cannot be used for two-mode networks.
mixedCycle()
)
mixedCycle(
network = list(network1, network2), window = Inf,
ignoreRep = FALSE, transformFun = identity
)
Cycle within 2 networks. It is the tendency to create an event
when it closes more two-paths with events
()
in network1
and
()
in network2
observed in the past events in the covariate
networks. It can be transformed by using transformFun
. This
effect cannot be used for two-mode networks and
DyNAM-choice_coordination.
mixedCommonSender()
)
mixedCommonSender(
network = list(network1, network2), window = Inf,
ignoreRep = FALSE, transformFun = identity
)
Closure common sender within 2 networks. It is the tendency to create
an event
when it closes more two-paths with events
()
in network1
and
()
in network2
observed in the past events in the covariate
networks. It can be transformed by using transformFun
. This
effect cannot be used for two-mode networks and
DyNAM-choice_coordination.
mixedCommonReceiver()
)
mixedCommonReceiver(
network = list(network1, network2), window = Inf,
ignoreRep = FALSE, transformFun = identity
)
Closure receiver within 2 networks. It is the tendency to create an
event
when it closes more two-paths with events
()
in network1
and
()
in network2
observed in the past events in the covariate
networks. It can be transformed by using transformFun
. This
effect cannot be used for two-mode networks and
DyNAM-choice_coordination.