| Title: | Computes Statistics for Relational Event History Data |
|---|---|
| Description: | Computes a variety of statistics for relational event models (Meijerink et al., 2023, <doi:10.3758/s13428-022-01821-8>). Relational event models enable researchers to investigate exogenous and endogenous factors, and interactions, influencing the evolution of a time-ordered sequence of events. These models are categorized into tie-oriented models (Butts, C., 2008, <doi:10.1111/j.1467-9531.2008.00203.x>), where the probability of a dyad interacting next is modeled in a single step, and actor-oriented models (Stadtfeld, C., & Block, P., 2017, <doi:10.15195/v4.a14>), which first model the probability of a sender initiating an interaction and subsequently the probability of the sender's choice of receiver. The package is designed to compute a variety of statistics that summarize exogenous and endogenous influences on the event stream for both types of models. |
| Authors: | Giuseppe Arena [aut] (ORCID: <https://orcid.org/0000-0001-5204-3326>), Marlyne Meijerink-Bosman [aut], Joris Mulder [aut, cre], Diana Karimova [ctb], Rumana Lakdawala [ctb], Mahdi Shafiee Kamalabad [ctb], Fabio Generoso Vieira [ctb], Roger Leenders [ctb] |
| Maintainer: | Joris Mulder <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 4.0.0 |
| Built: | 2026-05-15 19:37:07 UTC |
| Source: | https://github.com/tilburgnetworkgroup/remstats |
Overview of statistics in the actor-oriented model, see Details.
actor_effects(step = NULL)actor_effects(step = NULL)
step |
outputs all statistics in the sender activity step (if 'step = sender') or receiver choice step (if 'step = receiver'). |
Overview of statistics in the actor-oriented model.
A list of available effects and their corresponding statistics for the sender activity rate step:
A list of available effects and their corresponding statistics for the receiver choice step:
receive()
tie()
same()
average()
inertia()
otp()
itp()
osp()
isp()
psABAB()
psABBA()
psABXA()
psABXB()
psABAY()
psABBY()
psABXY()
Returns a list of available effects and their corresponding statistics based on the specified 'step' (sender or receiver).
# List of available effects for both the sender and receiver step actor_effects() # List of available effects for the sender step actor_effects(step = "sender") # List of available effects for the receiver step actor_effects(step = "receiver")# List of available effects for both the sender and receiver step actor_effects() # List of available effects for the sender step actor_effects(step = "sender") # List of available effects for the receiver step actor_effects(step = "receiver")
Computes statistics for the sender activity rate step and receiver choice step in actor-oriented relational event models (e.g., see Stadtfeld & Block, 2017).
aomstats( reh, sender_effects = NULL, receiver_effects = NULL, attr_actors = NULL, attr_dyads = NULL, memory = c("full", "window", "decay", "interval"), memory_value = NA, start = 2, stop = Inf, display_progress = FALSE )aomstats( reh, sender_effects = NULL, receiver_effects = NULL, attr_actors = NULL, attr_dyads = NULL, memory = c("full", "window", "decay", "interval"), memory_value = NA, start = 2, stop = Inf, display_progress = FALSE )
reh |
an object of class |
sender_effects |
an object of class |
receiver_effects |
an object of class |
attr_actors |
optionally, an object of class
|
attr_dyads |
optionally, an object of class |
memory |
The memory to be used. See ‘Details’. |
memory_value |
Numeric value indicating the memory parameter. Default
is |
start |
an optional integer value, specifying the index of the first
time or event in the relational event history for which statistics must be
computed (see 'Details'). Default is |
stop |
an optional integer value, specifying the index of the last time or event in the relational event history for which statistics must be computed (see 'Details') |
display_progress |
should a progress bar for the computation of the endogenous statistics be shown (TRUE) or not (FALSE)? |
An object of class 'aomstats'. List with in the first element the
statistics for the sender activity rate step and in the second element the
statistics for the receiver choice step. Statistics are computed once per
unique time point (per-timepoint "pt" method), so the number of rows in the
output equals reh$M (the number of unique time points), which may be
less than the total number of observed events when simultaneous events are
present. The 'aomstats' object has the following attributes:
modelType of model that is estimated.
formulaModel formula(s), obtained from the formula(s) inputted to 'sender_effects' and/or 'receiver_effects'.
actorsThe set of actors used to construct the statistics, obtained from the remify object inputted to 'reh'.
The statistics to be computed are defined symbolically and should be
supplied to the sender_effects and/or receiver_effects
arguments in the form ~ effects. The terms are separated by +
operators. For example: receiver_effects = ~ inertia() + otp().
Interactions between two effects can be included with * or :
operators. For example: receivereffects = ~ inertia():otp(). A list
of available effects can be obtained with actor_effects().
The majority of the statistics can be scaled in some way, see
the documentation of the scaling argument in the separate effect
functions for more information on this.
For the computation of the exogenous statistics an attributes object
with the exogenous covariate information has to be supplied to the
attr_actors argument in either remstats() or in the separate
effect functions supplied to the ..._effects arguments (e.g., see
send). This attr_actors object should be constructed as
follows: A dataframe with rows referring to the attribute value of actor
i at timepoint t. A 'name' column is required that contains the
actor name (corresponding to the actor names in the relational event
history). A 'time' column is required that contains the time when attributes
change (set to zero if none of the attributes vary over time). Subsequent
columns contain the attributes that are called in the specifications of
exogenous statistics (column name corresponding to the string supplied to
the variable argument in the effect function). Note that the
procedure for the exogenous effects ‘tie’ and ‘event’ deviates from this,
here the exogenous covariate information has to be specified in a different
way, see tie and event.
For the computation of the dyad exogenous statistics with tie(), an attributes object with the exogenous covariates information per dyad has to be supplied. This is a data.frame or matrix containing attribute information for dyads. If attr_dyads is a data.frame, the first two columns should represent "actor1" and "actor2" (for directed events, "actor1" corresponds to the sender, and "actor2" corresponds to the receiver). Additional columns can represent dyads' exogenous attributes. If attributes vary over time, include a column named "time". If attr_dyads is a matrix, the rows correspond to "actor1", columns to "actor2", and cells contain dyads' exogenous attributes.
The default 'memory' setting is '"full"', which implies that at each time point $t$ the entire event history before $t$ is included in the computation of the statistics. Alternatively, when 'memory' is set to '"window"', only the past event history within a given time window is considered (see Mulders & Leenders, 2019). This length of this time window is set by the 'memory_value' parameter. For example, when 'memory_value = 100' and 'memory = "window"', at time point $t$ only the past events that happened at most 100 time units ago are included in the computation of the statistics. A third option is to set 'memory' to '"interval"'. In this case, the past event history within a given time interval is considered. For example, when '"memory_value" = c(50, 100)' and 'memory = "window"', at time point $t$ only the past events that happened between 50 and 100 time units ago are included in the computation of the statistics. Finally, the fourth option is to set 'memory' to '"decay"'. In this case, the weight of the past event in the computation of the statistics depend on the elapsed time between $t$ and the past event. This weight is determined based on an exponential decay function with half-life parameter 'memory_value' (see Brandes et al., 2009).
Note that if the relational event history contains a column that is named “weight”, it is assumed that these affect the endogenous statistics. These affect the computation of all endogenous statistics with a few exceptions that follow logically from their definition (e.g., the recenyContinue statistic does depend on time since the event and not on event weights).
Optionally, statistics can be computed for a slice of the relational event sequence - but based on the entire history. This is achieved by setting the start and stop values equal to the index of the first and last event for which statistics are requested. For example, start = 5 and stop = 5 computes the statistics for only the 5th event in the relational event sequence, based on the history that consists of events 1-4.
Stadtfeld, C., & Block, P. (2017). Interactions, actors, and time: Dynamic network actor models for relational events. Sociological Science, 4, 318–352. doi:10.15195/v4.a14
library(remstats) # Load the data data(history) data(info) # Prepare the data reh <- remify::remify(edgelist = history, model = "actor") # Define the sender effects seff <- ~ send("extraversion") # Define the receiver_effects reff <- ~ receive("agreeableness") + inertia() + otp() # Compute the statistics aomstats( reh = reh, sender_effects = seff, receiver_effects = reff, attr_actors = info )library(remstats) # Load the data data(history) data(info) # Prepare the data reh <- remify::remify(edgelist = history, model = "actor") # Define the sender effects seff <- ~ send("extraversion") # Define the receiver_effects reff <- ~ receive("agreeableness") + inertia() + otp() # Compute the statistics aomstats( reh = reh, sender_effects = seff, receiver_effects = reff, attr_actors = info )
Specifies the statistic for an "average" effect in the tie-oriented model or the receiver choice step of the actor-oriented model. An "average" effect refers to an exogenous actor attribute that affects dyad (i,j)'s rate of interacting (tie-oriented model) or actor j's probability of being chosen as a receiver for the event send by the active sender i at time t (actor-oriented model) based on the average of the values of actors i and j on this attribute.
average(variable, attr_actors = NULL, scaling = c("none", "std"), attr_data)average(variable, attr_actors = NULL, scaling = c("none", "std"), attr_data)
variable |
string with the name of the column in the
|
attr_actors |
optionally, an object of class
|
scaling |
the method for scaling the statistic. Default is to not scale the statistic. Alternatively, standardization of the statistic per time point can be requested with "std". |
attr_data |
Deprecated argument. Please use 'attr_actors' instead. |
The statistic at timepoint t for dyad (i,j) is equal to the average of the values of actor i and j on the attribute at timepoint t.
Construct the 'attr_actors' object as a data frame where each row represents the attribute value of actor i at timepoint t:
name: The actors' name.
time: The time when the attribute values change.
variable: The third column contains the attribute used in the
specification of the "difference" effect. The column name should correspond
to the string supplied to the variable argument in the 'difference()'
function.
Note that it is possible to omit the 'attr_actors' object in the call of
difference() and, instead, supply it in the call of remstats()
for multiple exogenous effects.
List with all information required by 'remstats::remstats()' to compute the statistic.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ average("extraversion") remstats(reh = reh_tie, tie_effects = effects, attr_actors = info) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects, attr_actors = info)reh_tie <- remify::remify(history, model = "tie") effects <- ~ average("extraversion") remstats(reh = reh_tie, tie_effects = effects, attr_actors = info) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects, attr_actors = info)
Specifies an intercept for the tie-oriented model or the sender activity
rate step of the actor-oriented model in the same manner as in
lm (see Details).
A baseline effect is automatically specified for the tie-oriented model and
the sender activity rate step of the actor-oriented model when the
ordinal argument in remstats, tomstats,
aomstats is set to FALSE (default) and automatically removed
when this argument is set to TRUE. Alternatively, a baseline effect can be
explicitly specified by adding '1' to the equation or explicitly removed by
adding '-1' to the equation.
The baseline effect refers to the baseline tendency to interact. In the tie-oriented model, the log-inverse of the estimated parameter translates to the average number of observed events per time unit per dyad. In the actor-oriented model, the log-inverse of the estimated parameter translates to the average number of observed events per time unit per actor. The statistic is equal to one for all dyads resp. actors in the riskset at all timepoints.
reh_tie <- remify::remify(history, model = "tie") remstats(reh = reh_tie, tie_effects = ~1) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, sender_effects = ~1)reh_tie <- remify::remify(history, model = "tie") remstats(reh = reh_tie, tie_effects = ~1) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, sender_effects = ~1)
Function to bind any number of remstats objects into one while duplicated statistics in the combined object are removed based on their name.
bind_remstats(...)bind_remstats(...)
... |
Any number of |
statistics array with the combined statistics, where rows
refer to time points, columns refer to potential relational event (i.e.,
potential edges) in the risk set and slices refer to statistics
library(remstats) # Load the data data(history) data(info) # Prepare the data reh <- remify::remify(edgelist = history, model = "actor") # Obtain two different statistics objects effects1 <- ~ inertia():receive("extraversion") + otp() stats1 <- remstats(receiver_effects = effects1, reh = reh, attr_actors = info) effects2 <- ~ reciprocity() stats2 <- remstats(receiver_effects = effects2, reh = reh, attr_actors = info) # Bind the two statistics objects statsC <- bind_remstats(stats1, stats2)library(remstats) # Load the data data(history) data(info) # Prepare the data reh <- remify::remify(edgelist = history, model = "actor") # Obtain two different statistics objects effects1 <- ~ inertia():receive("extraversion") + otp() stats1 <- remstats(receiver_effects = effects1, reh = reh, attr_actors = info) effects2 <- ~ reciprocity() stats2 <- remstats(receiver_effects = effects2, reh = reh, attr_actors = info) # Bind the two statistics objects statsC <- bind_remstats(stats1, stats2)
A data frame representing exogenous attributes of dyads in a social network in long format. Each row indicates whether a dyad consists of two male actors (sex=0) in the original matrix 'info_both_male_wide'.
data(both_male_long)data(both_male_long)
A data frame with the following columns:
Numeric id of the first actor in the dyad.
Numeric id of the second actor in the dyad.
Binary indicator (1 for male-male dyads, 0 otherwise).
Simulated exogenous information on actors in a social network.
tie for the function using this data, both_male_wide for the data in wide format, and info for an overview of the actor exogenous attributes.
data(both_male_long) head(both_male_long)data(both_male_long) head(both_male_long)
A matrix representing exogenous attributes of dyads in a social network. The matrix indicates whether a dyad consists of two male actors (sex=0). Rows and columns correspond to actor IDs, and cells contain binary values (1 for male-male dyads, 0 otherwise).
data(both_male_wide)data(both_male_wide)
A square matrix with dimensions equal to the number of unique actors.
Simulated exogenous information on actors in a social network.
tie for the function using this data, both_male_long for the data in long format, and info for an overview of the actor exogenous attributes.
data(both_male_wide) print(both_male_wide)data(both_male_wide) print(both_male_wide)
Generate boxplots for a specified effect in a aomstats object.
## S3 method for class 'aomstats' boxplot( x, effect, model, by = "timepoints", subset = NULL, outliers = TRUE, ... )## S3 method for class 'aomstats' boxplot( x, effect, model, by = "timepoints", subset = NULL, outliers = TRUE, ... )
x |
An object of class |
effect |
A string specifying the name of the effect in 'x' or an integer indicating the index of the effect to be plotted. |
model |
A string indicating whether the effect is in the 'sender' model or the 'receiver' model. |
by |
A string indicating whether the statistic is plotted across 'timepoints' (default) or 'actors'. |
subset |
An optional vector specifying a subset of timepoints or actors to be used for plotting. Per default, a maximum of 20 unique timepoints or actors are plotted. |
outliers |
A logical value specifying whether to include outliers in the plot. |
... |
additional arguments passed to bxp(). |
This function produces boxplots to visually represent the distribution of a
specified effect in a relational event network, as captured by a
aomstats object. The 'effect' parameter allows the user to
choose a specific effect for visualization, either by providing the effect's
name or its index within the 'aomstats' object. The 'model' parameter
indicates whether the respective effect is in the 'sender' model or the
'receiver' model. The 'by' parameter determines whether the boxplots are
created across different 'timepoints' or 'actors'. At the moment, by 'actors'
is only supported for the sender model. Additionally, an optional 'subset'
parameter allows the user to focus on specific timepoints or actors. If
'subset' is not specified, a default maximum of 20 unique timepoints or
actors are plotted. The 'outliers' argument, when set to TRUE, includes the
representation of outliers in the boxplots. If set to FALSE, outliers are
omitted from the visualization.
The boxplots are based on the following summary statistics of the data: The box in the middle represents the interquartile range (IQR) between the first (Q1) and third quartile (Q3), and the line inside the box represents the median. The whiskers extend from the box to the minimum and maximum values within 1.5 times the IQR below Q1 or above Q3. Outliers beyond the whiskers are plotted individually.
library(remstats) # Load data data(history) # Prepare data reh <- remify::remify(edgelist = history[,1:3], model = "actor") # Compute effects stats <- remstats(reh, sender_effects = ~ outdegreeSender()) # Plot the 'outdegreeSender' distribution for 20 timepoints boxplot(stats, effect = "outdegreeSender", model = "sender") # Plot the 'inertia' distribution for all 10 actors boxplot(stats, effect = "outdegreeSender", model = "sender", by = "actors")library(remstats) # Load data data(history) # Prepare data reh <- remify::remify(edgelist = history[,1:3], model = "actor") # Compute effects stats <- remstats(reh, sender_effects = ~ outdegreeSender()) # Plot the 'outdegreeSender' distribution for 20 timepoints boxplot(stats, effect = "outdegreeSender", model = "sender") # Plot the 'inertia' distribution for all 10 actors boxplot(stats, effect = "outdegreeSender", model = "sender", by = "actors")
Generate boxplots for a specified effect in a tomstats
object.
## S3 method for class 'tomstats' boxplot(x, effect, by = "timepoints", subset = NULL, outliers = TRUE, ...)## S3 method for class 'tomstats' boxplot(x, effect, by = "timepoints", subset = NULL, outliers = TRUE, ...)
x |
An object of class |
effect |
A character string specifying the name of the effect in 'x' or an integer indicating the index of the effect to be plotted. |
by |
A string indicating whether the statistic is plotted across 'timepoints' (default) or 'dyads'. |
subset |
An optional vector specifying a subset of timepoints or dyads to be used for plotting. Per default, a maximum of 20 unique timepoints or dyads are plotted. |
outliers |
A logical value specifying whether to include outliers in the plot. |
... |
Additional arguments passed to bxp(). |
This function produces boxplots to visually represent the distribution of a
specified effect in a relational event network, as captured by a
tomstats object. The 'effect' parameter allows the user to
choose a specific effect for visualization, either by providing the effect's
name or its index within the 'tomstats' object. The 'by' parameter determines
whether the boxplots are created across different 'timepoints' or 'dyads'.
Additionally, an optional 'subset' parameter allows the user to focus on
specific timepoints or dyads. If 'subset' is not specified, a default
maximum of 20 unique timepoints or dyads are plotted. The 'outliers'
argument, when set to TRUE, includes the representation of outliers in the
boxplots. If set to FALSE, outliers are omitted from the visualization.
The boxplots are based on the following summary statistics of the data: The box in the middle represents the interquartile range (IQR) between the first (Q1) and third quartile (Q3), and the line inside the box represents the median. The whiskers extend from the box to the minimum and maximum values within 1.5 times the IQR below Q1 or above Q3. Outliers beyond the whiskers are plotted individually.
no return value
library(remstats) # Load data data(history) # Prepare data reh <- remify::remify(edgelist = history[,1:3], model = "tie") # Compute effects stats <- remstats(reh, tie_effects = ~ inertia()) # Plot the 'inertia' distribution for 20 timepoints boxplot(stats, effect = "inertia") # Plot the 'inertia' distribution for 20 dyads boxplot(stats, effect = "inertia", by = "dyads") # Plot the 'inertia' distribution for dyads 2:5 boxplot(stats, effect = "inertia", by = "dyads", subset = 2:5)library(remstats) # Load data data(history) # Prepare data reh <- remify::remify(edgelist = history[,1:3], model = "tie") # Compute effects stats <- remstats(reh, tie_effects = ~ inertia()) # Plot the 'inertia' distribution for 20 timepoints boxplot(stats, effect = "inertia") # Plot the 'inertia' distribution for 20 dyads boxplot(stats, effect = "inertia", by = "dyads") # Plot the 'inertia' distribution for dyads 2:5 boxplot(stats, effect = "inertia", by = "dyads", subset = 2:5)
Specifies the statistic for a 'degreeDiff' effect in the tie-oriented model.
degreeDiff(scaling = c("none", "std"), consider_type = "ignore")degreeDiff(scaling = c("none", "std"), consider_type = "ignore")
scaling |
the method for scaling the degree statistic. Default is to not scale the statistic (scaling = "none"). Alternatively, standardization of the degree difference per time point can be requested with 'std'. |
consider_type |
character. Controls how event types are handled:
|
A degreeDiff effect refers to the tendency for dyads to increase their interaction rate if the absolute difference in degree for the two actors in the pair increases. The statistic at timepoint t for dyad (i,j) is equal to the difference between the following two values: the number of events before timepoint t that involved actor i and actor j, respectively. The degreeDiff effect is only defined for undirected events.
List with all information required by 'remstats::remstats()' to compute the statistic.
degreeMin, degreeMax or
totaldegreeDyad for other types of degree effects for
undirected events.
reh_tie <- remify::remify(history, model = "tie", directed = FALSE) effects <- ~ degreeDiff() remstats(reh = reh_tie, tie_effects = effects)reh_tie <- remify::remify(history, model = "tie", directed = FALSE) effects <- ~ degreeDiff() remstats(reh = reh_tie, tie_effects = effects)
Specifies the statistic for an 'degreeMax' effect in the tie-oriented model with undirected events.
degreeMax(scaling = c("none", "prop", "std"), consider_type = "ignore")degreeMax(scaling = c("none", "prop", "std"), consider_type = "ignore")
scaling |
the method for scaling the degree statistic. Default is to not scale the statistic (scaling = "none"). Alternatively, scaling of the raw degree counts by two times the number of past events at time t can be requested with 'prop' or standardization of the raw degree counts per time point can be requested with 'std'. |
consider_type |
character. Controls how event types are handled:
|
An degreeMax effect refers to the tendency for dyads to increase their interaction rate if the total degree of the most active actor in the pair increases. The statistic at timepoint t for dyad (i,j) is equal to the maximum of the following two values: the number of events before timepoint t that involved actor i and actor j, respectively. Note that the degreeMax effect is only defined for undirected events.
Optionally, a scaling method can be set with scaling. By scaling the
degree count by the total number of past events, the statistic refers to the
fraction of past events that the most active actor was involved in. At the
first time point, when no events did previously occur, it is assumed that
every actor is equally likely to be involved in an event and the statistic
is set equal to 1/n, where n refers to the number of actors.
List with all information required by 'remstats::remstats()' to compute the statistic.
degreeDiff, degreeMin or
totaldegreeDyad for other types of degree effects for
undirected events.
reh_tie <- remify::remify(history, model = "tie", directed = FALSE) effects <- ~ degreeMax() remstats(reh = reh_tie, tie_effects = effects)reh_tie <- remify::remify(history, model = "tie", directed = FALSE) effects <- ~ degreeMax() remstats(reh = reh_tie, tie_effects = effects)
Specifies the statistic for an 'degreeMin' effect in the tie-oriented model with undirected events.
degreeMin(scaling = c("none", "prop", "std"), consider_type = "ignore")degreeMin(scaling = c("none", "prop", "std"), consider_type = "ignore")
scaling |
the method for scaling the degree statistic. Default is to not scale the statistic (scaling = "none"). Alternatively, scaling of the raw degree counts by two times the number of past events at time t can be requested with 'prop' or standardization of the raw degree counts per time point can be requested with 'std'. |
consider_type |
character. Controls how event types are handled:
|
An degreeMin effect refers to the tendency for dyads to increase their interaction rate if the total degree of the least active actor in the pair increases. The statistic at timepoint t for dyad (i,j) is equal to the minimum of the following two values: the number of events before timepoint t that involved actor i and actor j, respectively. Note that the degreeMin effect is only defined for undirected events.
Optionally, a scaling method can be set with scaling. By scaling the
degree count by the total number of past events, the statistic refers to the
fraction of past events that the least active actor was involved in. At the
first time point, when no events did previously occur, it is assumed that
every actor is equally likely to be involved in an event and the statistic
is set equal to 1/n, where n refers to the number of actors.
List with all information required by 'remstats::remstats()' to compute the statistic.
degreeDiff, degreeMax or
totaldegreeDyad for other types of degree effects for
undirected events.
reh_tie <- remify::remify(history, model = "tie", directed = FALSE) effects <- ~ degreeMin() remstats(reh = reh_tie, tie_effects = effects)reh_tie <- remify::remify(history, model = "tie", directed = FALSE) effects <- ~ degreeMin() remstats(reh = reh_tie, tie_effects = effects)
Specifies the statistic for a "difference" effect in the tie-oriented model or the receiver choice step of the actor-oriented model. A difference effect refers to an exogenous actor attribute that affects dyad (i,j)'s rate of interacting (tie-oriented model) or actor j's probability of being chosen as a receiver for the event send by the active sender i at time t (actor-oriented model) based on the difference between the values of actors i and j on this attribute.
difference( variable, attr_actors = NULL, scaling = c("none", "std"), absolute = TRUE, attr_data )difference( variable, attr_actors = NULL, scaling = c("none", "std"), absolute = TRUE, attr_data )
variable |
string with the name of the column in the
|
attr_actors |
optionally, an object of class
|
scaling |
the method for scaling the statistic. Default is to not scale the statistic. Alternatively, standardization of the statistic per time point can be requested with "std". |
absolute |
Logical value indicating whether the difference values should be converted to the absolute difference (default is TRUE). |
attr_data |
Deprecated argument. Please use 'attr_actors' instead. |
The statistic at timepoint t is equal to the (absolute) difference between the values of actor i and j on the attribute at timepoint t.
Construct the 'attr_actors' object as a data frame where each row represents the attribute value of actor i at timepoint t:
name: The actors' name.
time: The time when the attribute values change.
variable: The third column contains the attribute used in the
specification of the "difference" effect. The column name should correspond
to the string supplied to the variable argument in the 'difference()'
function.
Note that it is possible to omit the 'attr_actors' object in the call of
difference() and, instead, supply it in the call of remstats()
for multiple exogenous effects.
Note that it is possible to omit the 'attr_actors' object in the call of
difference() and, instead, supply it in the call of remstats()
for multiple exogenous effects.
List with all information required by 'remstats::remstats()' to compute the statistic.
# Example for tie-oriented model reh_tie <- remify::remify(history, model = "tie") effects <- ~ difference("extraversion", absolute = TRUE) remstats(reh = reh_tie, tie_effects = effects, attr_actors = info) # Example for actor-oriented model reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects, attr_actors = info)# Example for tie-oriented model reh_tie <- remify::remify(history, model = "tie") effects <- ~ difference("extraversion", absolute = TRUE) remstats(reh = reh_tie, tie_effects = effects, attr_actors = info) # Example for actor-oriented model reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects, attr_actors = info)
Specifies the statistic for an "event" effect in the tie-oriented model. An "event" effect refers to an exogenous event attribute that affects the waiting time between events.
event(x, variableName = NULL)event(x, variableName = NULL)
x |
vector with the event attribute |
variableName |
optionally, a string indicating the variable name, used for the dimnames of the output statistics object |
The statistic at timepoint t is for all dyads in the risk set equal to the attribute of the event at timepoint t.
List with all information required by 'remstats::remstats()' to compute the statistic.
reh_tie <- remify::remify(history, model = "tie") data(history, package = "remstats") history$work <- ifelse(history$setting == "work", 1, 0) effects <- ~ event(x = history$work, variableName = "setting_is_work") remstats(reh = reh_tie, tie_effects = effects)reh_tie <- remify::remify(history, model = "tie") data(history, package = "remstats") history$work <- ifelse(history$setting == "work", 1, 0) effects <- ~ event(x = history$work, variableName = "setting_is_work") remstats(reh = reh_tie, tie_effects = effects)
Specifies the statistic for fixed effects for event types in the tie-oriented model.
FEtype()FEtype()
Fixed effects for event types capture the variation in event rate across different event types (e.g., see Butts, 2008). The specification of FEtype results in the creation of C-1 statistics, were C is the number of different event types in the riskset. Let one of the event types, e.g. c = 1, represent the reference category. Than, for every event type c = 2, ..., C, a statistic is created that at timepoint t for dyad (i,j,c) is equal to 1 if c is equal to the respective event type and equal to 0 otherwise (i.e., dummy variables are created). Note that specifying fixed effects for event types is only available when event types are modeled in the dependent variable.
List with all information required by 'remstats::remstats()' to compute the statistic.
history$type <- history$setting reh_tie <- remify::remify(history, model = "tie") effects <- ~ FEtype() remstats(reh = reh_tie, tie_effects = effects)history$type <- history$setting reh_tie <- remify::remify(history, model = "tie") effects <- ~ FEtype() remstats(reh = reh_tie, tie_effects = effects)
A dataset containing a small example of a relational event history. Data is simulated.
data(history)data(history)
A dataframe with 115 rows and 5 variables:
time of the event since onset of observation (e.g., in minutes)
the first actor involved in the event
the second actor involved in the event
the setting for the event
the intensity of the event (e.g., based on the duration)
Simulated relational event history for actors in a social network.
info for exogenous information on the actors in
the social network.
data(history)data(history)
Specifies the statistic for an 'indegreeReceiver' effect in the tie-oriented model or the receiver choice step of the actor-oriented model.
indegreeReceiver(scaling = c("none", "prop", "std"), consider_type = "ignore")indegreeReceiver(scaling = c("none", "prop", "std"), consider_type = "ignore")
scaling |
the method for scaling the degree statistic. Default is to not scale the statistic (scaling = "none"). Alternatively, scaling of the raw degree counts by the number of past events at time t can be requested with 'prop' or standardization of the raw degree counts per time point can be requested with 'std'. |
consider_type |
character. Controls how event types are handled:
|
An indegree of the receiver effect refers to the tendency for actors to receive events if they have received more past events. The statistic at timepoint t for dyad (i,j) (tie-oriented model) or receiver j (actor-oriented model) is equal to the number of events received by actor j before timepoint t. Note that the 'indegreeReceiver' effect is only defined for directed events.
Optionally, a scaling method can be set with scaling. By scaling the
degree count by the total number of past events, the statistic refers to the
fraction of past events that were received by actor j. At the first time
point, when no events did previously occur, it is assumed that every actor
is equally likely to receive a message and the statistic is set equal to 1/
n, where n refers to the number of actors.
List with all information required by 'remstats::remstats()' to compute the statistic.
indegreeSender, outdegreeSender,
outdegreeReceiver, totaldegreeSender, or
totaldegreeReceiver for other types of degree effects.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ indegreeReceiver() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)reh_tie <- remify::remify(history, model = "tie") effects <- ~ indegreeReceiver() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)
Specifies the statistic for an 'indegreeSender' effect in the tie-oriented model or the sender activity rate step of the actor-oriented model.
indegreeSender(scaling = c("none", "prop", "std"), consider_type = "ignore")indegreeSender(scaling = c("none", "prop", "std"), consider_type = "ignore")
scaling |
the method for scaling the degree statistic. Default is to not scale the statistic (scaling = "none"). Alternatively, scaling of the raw degree counts by the number of past events at time t can be requested with 'prop' or standardization of the raw degree counts per time point can be requested with 'std'. |
consider_type |
character. Controls how event types are handled:
|
An indegree of the sender effect refers to the tendency for actors to send events if they have received more past events. The statistic at timepoint t for dyad (i,j) (tie-oriented model) or sender i (actor-oriented model) is equal to the number of events received by actor i before timepoint t. Note that the 'indegreeSender' effect is only defined for directed events.
Optionally, a scaling method can be set with scaling. By scaling the
degree count by the total number of past events, the statistic refers to the
fraction of past events that were received by actor i. At the first time
point, when no events did previously occur, it is assumed that every actor
is equally likely to send a message and the statistic is set equal to 1/n,
where n refers to the number of actors.
List with all information required by 'remstats::remstats()' to compute the statistic.
indegreeReceiver, outdegreeSender,
outdegreeReceiver, totaldegreeSender, or
totaldegreeReceiver for other types of degree effects.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ indegreeSender() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, sender_effects = effects)reh_tie <- remify::remify(history, model = "tie") effects <- ~ indegreeSender() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, sender_effects = effects)
Specifies the statistic for an inertia effect in the tie-oriented model or the receiver choice step of the actor-oriented model.
inertia(scaling = c("none", "prop", "std"), consider_type = "ignore")inertia(scaling = c("none", "prop", "std"), consider_type = "ignore")
scaling |
the method for scaling the inertia statistic. Default is to not scale the statistic (scaling = "none"). Alternatively, the statistics can be scaled by specifying 'prop', in which raw counts are divided by the outdegree of the sender at time t (see 'details') or standardization of the raw counts per time point can be requested with 'std'. |
consider_type |
character. Controls how event types are handled:
|
An inertia effect refers to the tendency for dyads to repeatedly interact with each other (tie-oriented model) or for actors to repeatedly choose the same actor as receiver of their events (actor-oriented model). The statistic at timepoint t for dyad (i,j) resp. receiver j is equal to the number of (i,j) events before timepoint t.
Optionally, a scaling method can be set with scaling. By scaling the
inertia count by the outdegree of the sender ("prop"), the statistic refers
to the fraction of messages send by actor i that were send to actor j. If
actor i hasn't send any messages yet it can be assumed that every actor is
equally likely to receive a message from i and the statistic is set equal to
1/(n-1), where n refers to the number of actors. The resulting statistic is
similar to the "FrPSndSnd" statistic in the R package 'relevent', or the
persistence statistic in Section 2.2.2 of Butts (2008). Note that this
scaling method is only defined for directed events.
List with all information required by 'remstats::remstats()' to compute the statistic.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ inertia() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)reh_tie <- remify::remify(history, model = "tie") effects <- ~ inertia() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)
A dataset containing exogenous information on the actors in the social network of a relational event history. Data is simulated.
data(info)data(info)
A dataframe with 10 rows and 5 variables:
numeric id of the actor
numeric value, describes when the value of the covariate changes, if it changes
dichotomized age of the actor (e.g., 0 = below 25, 1 = 25 or older)
dichotomized sex of the actor (e.g., 0 = male, 1 = female)
standardized extraversion score of the actor
standardized agreeableness score of the actor
Simulated exogenous information on actors in a social network.
history for the relational event history.
data(info)data(info)
Specifies the statistic for an incoming shared partners effect.
isp(unique = FALSE, scaling = c("none", "std"), consider_type = "ignore")isp(unique = FALSE, scaling = c("none", "std"), consider_type = "ignore")
unique |
A logical value indicating whether to sum the minimum of events with third actors (FALSE, default) or the number of third actors that create a new, unique shared partner (TRUE). See details for more information. |
scaling |
the method for scaling the triad statistic. Default is to not scale the statistic but keep the raw 'counts'. Alternatively, standardization of the raw counts per time point can be requested with 'std'. |
consider_type |
character. Controls how event types are handled:
|
The incoming shared partners effect describes the propensity of dyads to interact based on the number of past incoming shared partners between them. By default, the statistic at timepoint t for the dyad (i,j) is computed as the sum of the minimum occurrences of past (h,i) and (h,j) events across all actors h.
When the unique parameter is set to TRUE, a different approach is taken. In this case, the statistic counts the number of actors h that contribute to the creation of a new, distinct shared partner between actors i and j.
Additionally, it is possible to specify a scaling method using the scaling parameter.
Please note that the incoming shared partners effect, 'isp', is exclusively defined for directed events.
List with all information required by 'remstats::remstats()' to compute the statistic.
Butts, C. (2008). A relational event framework for social action. Sociological Methodology.
otp, itp, or osp for
other types of triadic effects for directed relational events and
sp for triadic effects for undirected relational events.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ isp() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)reh_tie <- remify::remify(history, model = "tie") effects <- ~ isp() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)
Specifies the statistic for an incoming two-path effect.
itp(unique = FALSE, scaling = c("none", "std"), consider_type = "ignore")itp(unique = FALSE, scaling = c("none", "std"), consider_type = "ignore")
unique |
A logical value indicating whether to sum the minimum of events with third actors (FALSE, default) or the number of third actors that create a new, unique two-path (TRUE). See details for more information. |
scaling |
The method for scaling the triad statistic. The default value is "none", which means the statistic is not scaled. Alternatively, you can set it to "std" to request standardization of the raw counts per time point. |
consider_type |
character. Controls how event types are handled:
|
The incoming two-path effect describes the propensity of dyads to interact based on the number of past incoming two-paths between them. By default, the statistic at timepoint t for the dyad (i,j) is computed as the sum of the minimum occurrences of past (j,h) and (h,i) events across all actors h.
When the unique parameter is set to TRUE, a different approach is taken. In this case, the statistic counts the number of actors h that contribute to the creation of a new, distinct two-path between actors i and j.
Additionally, it is possible to specify a scaling method using the scaling parameter.
Please note that the incoming two-path effect, 'itp', is exclusively defined for directed events.
List with all information required by 'remstats::remstats()' to compute the statistic.
Butts, C. (2008). A relational event framework for social action. Sociological Methodology.
otp, osp, or isp for
other types of triadic effects for directed relational events and
sp for triadic effects for undirected relational events.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ itp() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)reh_tie <- remify::remify(history, model = "tie") effects <- ~ itp() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)
Specifies the statistic for a "maximum" effect in the tie-oriented model. A "maximum" effect refers to an exogenous actor attribute that affects dyad (i,j)'s rate of interacting based on the maximum of the values of actors i and j on this attribute.
maximum(variable, attr_actors = NULL, scaling = c("none", "std"), attr_data)maximum(variable, attr_actors = NULL, scaling = c("none", "std"), attr_data)
variable |
string with the name of the column in the
|
attr_actors |
optionally, an object of class
|
scaling |
the method for scaling the statistic. Default is to not scale the statistic. Alternatively, standardization of the statistic per time point can be requested with "std". |
attr_data |
Deprecated argument. Please use 'attr_actors' instead. |
The statistic at timepoint t for dyad (i,j) is equal to the maximum of the values of actor i and j on the attribute at timepoint t.
Construct the 'attr_actors' object as a data frame where each row represents the attribute value of actor i at timepoint t:
name: The actors' name.
time: The time when the attribute values change.
variable: The third column contains the attribute used in the
specification of the "difference" effect. The column name should correspond
to the string supplied to the variable argument in the 'difference()'
function.
Note that it is possible to omit the 'attr_actors' object in the call of
difference() and, instead, supply it in the call of remstats()
for multiple exogenous effects.
List with all information required by 'remstats::remstats()' to compute the statistic.
reh_tie <- remify::remify(history, model = "tie", directed = FALSE) effects <- ~ maximum("extraversion") remstats(reh = reh_tie, tie_effects = effects, attr_actors = info)reh_tie <- remify::remify(history, model = "tie", directed = FALSE) effects <- ~ maximum("extraversion") remstats(reh = reh_tie, tie_effects = effects, attr_actors = info)
Specifies the statistic for a "minimum" effect in the tie-oriented model. A "minimum" effect refers to an exogenous actor attribute that affects dyad (i,j)'s rate of interacting based on the minimum of the values of actors i and j on this attribute.
minimum(variable, attr_actors = NULL, scaling = c("none", "std"), attr_data)minimum(variable, attr_actors = NULL, scaling = c("none", "std"), attr_data)
variable |
string with the name of the column in the
|
attr_actors |
optionally, an object of class
|
scaling |
the method for scaling the statistic. Default is to not scale the statistic. Alternatively, standardization of the statistic per time point can be requested with "std". |
attr_data |
Deprecated argument. Please use 'attr_actors' instead. |
The statistic at timepoint t for dyad (i,j) is equal to the minimum of the values of actor i and j on the attribute at timepoint t.
Construct the 'attr_actors' object as a data frame where each row represents the attribute value of actor i at timepoint t:
name: The actors' name.
time: The time when the attribute values change.
variable: The third column contains the attribute used in the
specification of the "difference" effect. The column name should correspond
to the string supplied to the variable argument in the 'difference()'
function.
Note that it is possible to omit the 'attr_actors' object in the call of
difference() and, instead, supply it in the call of remstats()
for multiple exogenous effects.
List with all information required by 'remstats::remstats()' to compute the statistic.
reh_tie <- remify::remify(history, model = "tie", directed = FALSE) effects <- ~ minimum("extraversion") remstats(reh = reh_tie, tie_effects = effects, attr_actors = info)reh_tie <- remify::remify(history, model = "tie", directed = FALSE) effects <- ~ minimum("extraversion") remstats(reh = reh_tie, tie_effects = effects, attr_actors = info)
Specifies the statistic for an outgoing shared partners effect.
osp(unique = FALSE, scaling = c("none", "std"), consider_type = "ignore")osp(unique = FALSE, scaling = c("none", "std"), consider_type = "ignore")
unique |
A logical value indicating whether to sum the minimum of events with third actors (FALSE, default) or the number of third actors that create a new, unique shared partner (TRUE). See details for more information. |
scaling |
the method for scaling the triad statistic. Default is to not scale the statistic but keep the raw 'counts'. Alternatively, standardization of the raw counts per time point can be requested with 'std'. |
consider_type |
character. Controls how event types are handled:
|
The outgoing shared partners effect describes the propensity of dyads to interact based on the number of past outgoing shared partners between them. By default, the statistic at timepoint t for the dyad (i,j) is computed as the sum of the minimum occurrences of past (i,h) and (j,h) events across all actors h.
When the unique parameter is set to TRUE, a different approach is taken. In this case, the statistic counts the number of actors h that contribute to the creation of a new, distinct shared partner between actors i and j.
Additionally, it is possible to specify a scaling method using the scaling parameter.
Please note that the outgoing shared partners effect, 'osp', is exclusively defined for directed events.
List with all information required by 'remstats::remstats()' to compute the statistic.
Butts, C. (2008). A relational event framework for social action. Sociological Methodology.
otp, itp, or isp for
other types of triadic effects for directed relational events and
sp for triadic effects for undirected relational events.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ osp() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)reh_tie <- remify::remify(history, model = "tie") effects <- ~ osp() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)
Specifies the statistic for an outgoing two-path effect.
otp(unique = FALSE, scaling = c("none", "std"), consider_type = "ignore")otp(unique = FALSE, scaling = c("none", "std"), consider_type = "ignore")
unique |
A logical value indicating whether to sum the minimum of events with third actors (FALSE, default) or the number of third actors that create a new, unique two-path (TRUE). See details for more information. |
scaling |
The method for scaling the triad statistic. The default value is "none", which means the statistic is not scaled. Alternatively, you can set it to "std" to request standardization of the raw counts per time point. |
consider_type |
character. Controls how event types are handled:
|
The outgoing two-path effect describes the propensity of dyads to interact based on the number of past outgoing two-paths between them. By default, the statistic at timepoint t for the dyad (i,j) is computed as the sum of the minimum occurrences of past (i,h) and (h,j) events across all actors h.
When the unique parameter is set to TRUE, a different approach is taken. In this case, the statistic counts the number of actors h that contribute to the creation of a new, distinct two-path between actors i and j.
Additionally, it is possible to specify a scaling method using the scaling parameter.
Please note that the outgoing two-path effect, 'otp', is exclusively defined for directed events.
List with all information required by 'remstats::remstats()' to compute the statistic.
Butts, C. (2008). A relational event framework for social action. Sociological Methodology.
itp, osp, or isp for
other types of triadic effects for directed relational events and
sp for triadic effects for undirected relational events.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ otp() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)reh_tie <- remify::remify(history, model = "tie") effects <- ~ otp() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)
Specifies the statistic for an 'outdegreeReceiver' effect in the tie-oriented model or the receiver choice step of the actor-oriented model.
outdegreeReceiver(scaling = c("none", "prop", "std"), consider_type = "ignore")outdegreeReceiver(scaling = c("none", "prop", "std"), consider_type = "ignore")
scaling |
the method for scaling the degree statistic. Default is to not scale the statistic (scaling = "none"). Alternatively, scaling of the raw degree counts by the number of past events at time t can be requested with 'prop' or standardization of the raw degree counts per time point can be requested with 'std'. |
consider_type |
character. Controls how event types are handled:
|
An outdegree of the receiver effect refers to the tendency for actors to receive events if they have send more past events. The statistic at timepoint t for dyad (i,j) (tie-oriented model) or receiver j (actor-oriented model) is equal to the number of events send by actor j before timepoint t. Note that the 'outdegreeReceiver' effect is only defined for directed events.
Optionally, a scaling method can be set with scaling. By scaling the
degree count by the total number of past events, the statistic refers to the
fraction of past events that were send by actor j. At the first time
point, when no events did previously occur, it is assumed that every actor
is equally likely to receive a message and the statistic is set equal to
1/n, where n refers to the number of actors.
List with all information required by 'remstats::remstats()' to compute the statistic.
indegreeSender, indegreeReceiver,
outdegreeSender, totaldegreeSender, or
totaldegreeReceiver for other types of degree effects.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ outdegreeReceiver() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)reh_tie <- remify::remify(history, model = "tie") effects <- ~ outdegreeReceiver() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)
Specifies the statistic for an 'outdegreeSender' effect in the tie-oriented model or the sender activity rate step of the actor-oriented model.
outdegreeSender(scaling = c("none", "prop", "std"), consider_type = "ignore")outdegreeSender(scaling = c("none", "prop", "std"), consider_type = "ignore")
scaling |
the method for scaling the degree statistic. Default is to not scale the statistic (scaling = "none"). Alternatively, scaling of the raw degree counts by the number of past events at time t can be requested with 'prop' or standardization of the raw degree counts per time point can be requested with 'std'. |
consider_type |
character. Controls how event types are handled:
|
An outdegree of the sender effect refers to the tendency for actors to send events if they have send more past events. The statistic at timepoint t for dyad (i,j) (tie-oriented model) or sender i (actor-oriented model) is equal to the number of events send by actor i before timepoint t. Note that the 'outdegreeSender' effect is only defined for directed events.
Optionally, a scaling method can be set with scaling. By scaling the
degree count by the total number of past events, the statistic refers to the
fraction of past events that were send by actor i. At the first time
point, when no events did previously occur, it is assumed that every actor
is equally likely to send a message and the statistic is set equal to 1/n,
where n refers to the number of actors.
List with all information required by 'remstats::remstats()' to compute the statistic.
indegreeSender, indegreeReceiver,
outdegreeReceiver, totaldegreeSender, or
totaldegreeReceiver for other types of degree effects.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ outdegreeSender() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, sender_effects = effects)reh_tie <- remify::remify(history, model = "tie") effects <- ~ outdegreeSender() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, sender_effects = effects)
Generate line plots to visualize the trajectories of a specified effect in
the sender model of a aomstats object.
## S3 method for class 'aomstats' plot(x, effect, subset = NULL, ...)## S3 method for class 'aomstats' plot(x, effect, subset = NULL, ...)
x |
An object of class |
effect |
A character string specifying the name of the effect in 'x' or an integer indicating the index of the effect to be plotted. |
subset |
An optional vector specifying a subset of actors to be used for plotting. By default, a maximum of 5 unique actors are used for plotting. |
... |
Additional arguments passed to plot(). |
This function creates line plots to illustrate the temporal trajectories of a
specified effect in a relational event network, as captured in the sender
model by a aomstats object. The 'effect' parameter allows users
to choose a specific effect for visualization, either by providing the effect's
name or its index within the 'aomstats' object. An optional 'subset' parameter
enables users to focus on specific actors. If 'subset' is not specified, a
default maximum of 5 unique actors is plotted. These actors are randomly selected
to represent trajectories across the range of different endpoints for the effect
(excluding zero).
library(remstats) # Load data data(history) # Prepare data reh <- remify::remify(edgelist = history[,1:3], model = "actor") # Compute effects stats <- remstats(reh, sender_effects = ~ outdegreeSender()) # Plot the 'outdegreeSender' trajectories 5 actors plot(stats, effect = "outdegreeSender") # Plot the 'outdegreeSender' trajectory for a specific actor plot(stats, effect = "outdegreeSender", subset = 10)library(remstats) # Load data data(history) # Prepare data reh <- remify::remify(edgelist = history[,1:3], model = "actor") # Compute effects stats <- remstats(reh, sender_effects = ~ outdegreeSender()) # Plot the 'outdegreeSender' trajectories 5 actors plot(stats, effect = "outdegreeSender") # Plot the 'outdegreeSender' trajectory for a specific actor plot(stats, effect = "outdegreeSender", subset = 10)
Generate line plots to visualize the trajectories of a specified effect in a
tomstats object.
## S3 method for class 'tomstats' plot(x, effect, subset = NULL, ...)## S3 method for class 'tomstats' plot(x, effect, subset = NULL, ...)
x |
An object of class |
effect |
A character string specifying the name of the effect in 'x' or an integer indicating the index of the effect to be plotted. |
subset |
An optional vector specifying a subset of dyads to be used for plotting. By default, a maximum of 5 unique dyads are used for plotting. |
... |
Additional arguments passed to plot(). |
This function creates line plots to illustrate the temporal trajectories of a
specified effect in a relational event network, as captured by a
tomstats object. The 'effect' parameter allows users to choose a
specific effect for visualization, either by providing the effect's name or
its index within the 'tomstats' object. An optional 'subset' parameter enables
users to focus on specific dyads. If 'subset' is not specified, a default
maximum of 5 unique dyads is plotted. These dyads are randomly selected to
represent trajectories across the range of different endpoints for the effect
(excluding zero).
library(remstats) # Load data data(history) # Prepare data reh <- remify::remify(edgelist = history[,1:3], model = "tie") # Compute effects stats <- remstats(reh, tie_effects = ~ inertia()) # Plot the 'inertia' trajectories for 5 dyads plot(stats, effect = "inertia") # Plot the 'inertia' trajectory for a specific dyad plot(stats, effect = "inertia", subset = 60)library(remstats) # Load data data(history) # Prepare data reh <- remify::remify(edgelist = history[,1:3], model = "tie") # Compute effects stats <- remstats(reh, tie_effects = ~ inertia()) # Plot the 'inertia' trajectories for 5 dyads plot(stats, effect = "inertia") # Plot the 'inertia' trajectory for a specific dyad plot(stats, effect = "inertia", subset = 60)
Print a remstats object in a user-friendly format.
## S3 method for class 'remstats' print(x, ...)## S3 method for class 'remstats' print(x, ...)
x |
object of class |
... |
further arguments passed to or from other methods. |
The function prints formatted information about the remstats object to the console, presenting details about the relational event network statistics in a user-friendly format.
rehObject <- remify::remify(edgelist = history, model = "tie") remstatsObject <- remstats::remstats(reh = rehObject, tie_effects = ~ remstats::inertia()) print(remstatsObject) rehObject <- remify::remify(edgelist = history, model = "actor") remstatsObject <- remstats::remstats(reh = rehObject, receiver_effects = ~ inertia()) print(remstatsObject)rehObject <- remify::remify(edgelist = history, model = "tie") remstatsObject <- remstats::remstats(reh = rehObject, tie_effects = ~ remstats::inertia()) print(remstatsObject) rehObject <- remify::remify(edgelist = history, model = "actor") remstatsObject <- remstats::remstats(reh = rehObject, receiver_effects = ~ inertia()) print(remstatsObject)
Specifies the statistic for a participation shift AB-A in the sender step of the actor-oriented model.
psABA()psABA()
Refers to the tendency for the same actor to keep initiating events: The next sender is equal to the previous sender. For each timepoint t, the psABA statistic is equal to one for the actor that will create the participation shift if they would occur in the edgelist as the sender at time t and equal to zero for the actors that will not create this participation shift. If multiple events in the edgelist occur at the same time point, the order of these events determines whether the p-shift is observed.
List with all information required by 'remstats::remstats()' to compute the statistic.
psABB or psABX for exploring
alternative participation shifts in the sender step of the actor-oriented
model.
reh_actor <- remify::remify(history, model = "actor") remstats(sender_effects = ~ psABA(), reh = reh_actor)reh_actor <- remify::remify(history, model = "actor") remstats(sender_effects = ~ psABA(), reh = reh_actor)
Specifies the statistic for a pshift AB-AB effect.
psABAB(consider_type = "ignore")psABAB(consider_type = "ignore")
consider_type |
character. Controls how event types are handled:
|
Refers to the tendency for the same dyads to keep interacting. For directed events, the next sender and receiver are equal to the previous sender and receiver. For undirected events, the next actor pair is equal to the current actor pair. For each timepoint t, the psABAB statistic is equal to one for the dyads that will create the participation shift if they would occur in the edgelist at time t and equal to zero for the dyads that will not create this participation shift. If consider_type is set to TRUE, the type of the two subsequent AB events have to be equal. If it is set to FALSE, the participation shift is set to one for every AB event, regardless of the event type. If multiple events in the edgelist occur at the same time point, the order of these events determines whether the p-shift is observed.
List with all information required by 'remstats::remstats()' to compute the statistic.
psABBA, psABBY, psABXA,
psABXB, psABXY or psABAY for other dyadic participation shifts.
reh_tie <- remify::remify(history, model = "tie", directed = FALSE) effects <- ~ psABAB() remstats(tie_effects = effects, reh = reh_tie)reh_tie <- remify::remify(history, model = "tie", directed = FALSE) effects <- ~ psABAB() remstats(tie_effects = effects, reh = reh_tie)
Specifies the statistic for a participation shift AB-AY.
psABAY(consider_type = "ignore")psABAY(consider_type = "ignore")
consider_type |
character. Controls how event types are handled:
|
One of Gibson's (2003) dyadic participation shifts. The AB-AY participation shift refers to a tendency for turn continuing. For directed events, the sender (A) in the current event is the same as the sender in the previous event (A), and the receiver (Y) is different from the previous receiver (B). In undirected events, one of the current actors (A) matches one of the actors in the previous events (A or B), while the other actor (Y) is different.
To identify these shifts, a statistic 'psABAY' is calculated for each pair of actors at a given timepoint (t). If the pair's interaction follows the AB-AY pattern, the statistic is set equal to one; otherwise, it's set to zero.
Additionally, the types of the AB and AY events can be taken into account. If 'consider_type' is 'TRUE', the type of the AB event and the type of the AY event must match for the shift to occur. If 'consider_type' is 'FALSE', the shift happens for every AY event, regardless of the event type.
List with all information required by 'remstats::remstats()' to compute the statistic.
psABBA, psABBY, psABXA,
psABXB, psABXY or psABAB for other
dyadic participation shifts.
reh <- remify::remify(history, model = "tie") effects <- ~ psABAY() remstats(reh = reh, tie_effects = effects)reh <- remify::remify(history, model = "tie") effects <- ~ psABAY() remstats(reh = reh, tie_effects = effects)
Specifies the statistic for a participation shift AB-B in the sender step of the actor-oriented model.
psABB()psABB()
The AB-B participation shift refers to the tendency for immediate reciprocation (the next sender is the previous receiver). For each timepoint t, the psABBA statistic is equal to one for the actor (i.e, the previous event receiver) that will create the participation shift if it would occur as sender in the edgelist at time t and equal to zero for the actors that will not create this participation shift. If multiple events in the edgelist occur at the same time point, the order of these events determines whether the p-shift is observed.
List with all information required by 'remstats::remstats()' to compute the statistic.
psABA or psABX for exploring alternative participation shifts in the sender step of the actor-oriented model.
reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, sender_effects = ~ psABB())reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, sender_effects = ~ psABB())
Specifies the statistic for a participation shift AB-BA.
psABBA(consider_type = "ignore")psABBA(consider_type = "ignore")
consider_type |
character. Controls how event types are handled:
|
The AB-BA pshift effect refers to one of Gibson's (2003) dyadic participation shifts. The AB-BA pshift refers to the tendency for immediate reciprocation (the next sender is the previous receiver and the next receiver is the previous sender). For each timepoint t, the psABBA statistic is equal to one for the dyad that will create the participation shift if it would occur in the edgelist at time t and equal to zero for the dyads that will not create this participation shift. If consider_type is set to TRUE, the type of the AB event and the type of the BA event have to be equal. If it is set to FALSE, the participation shift is set to one for every BA event, regardless of the event type. If multiple events in the edgelist occur at the same time point, the order of these events determines whether the p-shift is observed. Note that the AB-BA pshift is only defined for directed events.
List with all information required by 'remstats::remstats()' to compute the statistic.
psABBY, psABXA, psABXB,
psABXY or psABAY for other dyadic participation
shifts.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ psABBA() remstats(reh = reh_tie, tie_effects = effects)reh_tie <- remify::remify(history, model = "tie") effects <- ~ psABBA() remstats(reh = reh_tie, tie_effects = effects)
Specifies the statistic for a participation shift AB-BY.
psABBY(consider_type = "ignore")psABBY(consider_type = "ignore")
consider_type |
character. Controls how event types are handled:
|
The AB-BY participation shift refers to one of Gibson's (2003) dyadic participation shifts. The AB-BY pshift refers to a tendency for turn receiving (here, the next sender is the previous receiver and the next receiver is not in the current previous). For each timepoint t, the psABBY statistic is equal to one for the dyads that will create the participation shift if they would occur in the edgelist at time t and equal to zero for the dyads that will not create this participation shift. If consider_type is set to TRUE, the type of the AB event and the type of the BY events have to be equal. If it is set to FALSE, the participation shift is set to one for every BY event, regardless of the event type. If multiple events in the edgelist occur at the same time point, the order of these events determines whether the p-shift is observed. Note that the AB-BY pshift is only defined for directed events.
List with all information required by 'remstats::remstats()' to compute the statistic.
psABBA, psABXA, psABXB,
psABXY or psABAY for other dyadic participation
shifts.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ psABBY() remstats(reh = reh_tie, tie_effects = effects)reh_tie <- remify::remify(history, model = "tie") effects <- ~ psABBY() remstats(reh = reh_tie, tie_effects = effects)
Specifies the statistic for a participation shift AB-X in the sender step of the actor-oriented model.
psABX()psABX()
The AB-X participation shift refers to a tendency for turn usurping (here, the next sender is not in the previous event). For each timepoint t, the psABX statistic is equal to one for the actors that will create the participation shift if they would occur as the sender in the edgelist at time t and equal to zero for the actors that will not create this participation shift. If multiple events in the edgelist occur at the same time point, the order of these events determines whether the p-shift is observed.
List with all information required by 'remstats::remstats()' to compute the statistic.
psABA or psABB for exploring
alternative participation shifts in the sender step of the actor-oriented
model.
reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, sender_effects = ~ psABX())reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, sender_effects = ~ psABX())
Specifies the statistic for a participation shift AB-XA.
psABXA(consider_type = "ignore")psABXA(consider_type = "ignore")
consider_type |
character. Controls how event types are handled:
|
The AB-XA participation shift refers to one of Gibson's (2003) dyadic participation shifts. The AB-XA pshift refers to a tendency for turn usurping (here, the next sender is not in the previous event and the next receiver is the previous sender). For each timepoint t, the psABXA statistic is equal to one for the dyads that will create the participation shift if they would occur in the edgelist at time t and equal to zero for the dyads that will not create this participation shift. If consider_type is set to TRUE, the type of the AB event and the type of the XA events have to be equal. If it is set to FALSE, the participation shift is set to one for every XA event, regardless of the event type. If multiple events in the edgelist occur at the same time point, the order of these events determines whether the pshift is observed. Note that the AB-XA pshift is only defined for directed events.
List with all information required by 'remstats::remstats()' to compute the statistic.
psABBA, psABBY, psABXB, psABXY or psABAY for other dyadic participation shifts.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ psABXA() remstats(reh = reh_tie, tie_effects = effects)reh_tie <- remify::remify(history, model = "tie") effects <- ~ psABXA() remstats(reh = reh_tie, tie_effects = effects)
Specifies the statistic for a participation shift AB-XB.
psABXB(consider_type = "ignore")psABXB(consider_type = "ignore")
consider_type |
character. Controls how event types are handled:
|
The AB-XB participation shift refers to one of Gibson's (2003) dyadic participation shifts. The AB-XB pshift refers to a tendency for turn usurping (here, the next sender is not in the previous event and the next receiver is the previous receiver). For each timepoint t, the psABXB statistic is equal to one for the dyads that will create the participation shift if they would occur in the edgelist at time t and equal to zero for the dyads that will not create this participation shift. If consider_type is set to TRUE, the type of the AB event and the type of the XB events have to be equal. If it is set to FALSE, the participation shift is set to one for every XB event, regardless of the event type. If multiple events in the edgelist occur at the same time point, the order of these events determines whether the p-shift is observed. Note that the AB-XB pshift is only defined for directed events.
List with all information required by 'remstats::remstats()' to compute the statistic.
psABBA, psABBY, psABXA,
psABXY or psABAY for other dyadic participation
shifts.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ psABXB() remstats(reh = reh_tie, tie_effects = effects)reh_tie <- remify::remify(history, model = "tie") effects <- ~ psABXB() remstats(reh = reh_tie, tie_effects = effects)
Specifies the statistic for a participation shift AB-XY.
psABXY(consider_type = "ignore")psABXY(consider_type = "ignore")
consider_type |
character. Controls how event types are handled:
|
The AB-XY participation shift refers to one of Gibson's (2003) dyadic participation shifts. The AB-XY pshift refers to a tendency for turn usurping (here, the next sender and the next receiver are not in the previous event). For each timepoint t, the psABXY statistic is equal to one for the dyads that will create the participation shift if they would occur in the edgelist at time t and equal to zero for the dyads that will not create this participation shift. If consider_type is set to TRUE, the type of the AB event and the type of the XY events have to be equal. If it is set to FALSE, the participation shift is set to one for every XY event, regardless of the event type. If multiple events in the edgelist occur at the same time point, the order of these events determines whether the p-shift is observed. Note that the AB-XY pshift is only defined for directed events.
List with all information required by 'remstats::remstats()' to compute the statistic.
psABBA, psABBY, psABXA,
psABXB or psABAY for other dyadic participation
shifts.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ psABXY() remstats(reh = reh_tie, tie_effects = effects)reh_tie <- remify::remify(history, model = "tie") effects <- ~ psABXY() remstats(reh = reh_tie, tie_effects = effects)
Specifies the statistic for a "receive" effect in the tie-oriented model or the receiver choice step of the actor-oriented model. A "receive" effect refers to an exogenous actor attribute that affects actor i's rate of receiving events.
receive(variable, attr_actors = NULL, scaling = c("none", "std"), attr_data)receive(variable, attr_actors = NULL, scaling = c("none", "std"), attr_data)
variable |
string with the name of the column in the
|
attr_actors |
optionally, an object of class
|
scaling |
the method for scaling the statistic. Default is to not scale the statistic. Alternatively, standardization of the statistic per time point can be requested with "std". |
attr_data |
Deprecated argument. Please use 'attr_actors' instead. |
The statistic at timepoint t is equal to the value of the exogenous attribute for actor i at time t for all dyads in the riskset that have actor i as receiver. Note that a "receive" effect is only defined for directed relational events.
Construct the 'attr_actors' object as a data frame where each row represents the attribute value of actor i at timepoint t:
name: The actors' name.
time: The time when the attribute values change.
variable: The third column contains the attribute used in the
specification of the "difference" effect. The column name should correspond
to the string supplied to the variable argument in the 'difference()'
function.
Note that it is possible to omit the 'attr_actors' object in the call of
difference() and, instead, supply it in the call of remstats()
for multiple exogenous effects.
List with all information required by 'remstats::remstats()' to compute the statistic.
data(history) data(info) # Tie-oriented model reh_tie <- remify::remify(history, model = "tie") effects <- ~ receive("extraversion") remstats(reh = reh_tie, tie_effects = effects, attr_actors = info) # Actor-oriented model reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects, attr_actors = info)data(history) data(info) # Tie-oriented model reh_tie <- remify::remify(history, model = "tie") effects <- ~ receive("extraversion") remstats(reh = reh_tie, tie_effects = effects, attr_actors = info) # Actor-oriented model reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects, attr_actors = info)
Specifies the statistic for a recency continue effect in the
effects argument of tomstats or the
receiver_effects argument of aomstats.
recencyContinue(consider_type = "ignore")recencyContinue(consider_type = "ignore")
consider_type |
character. Controls how event types are handled:
|
The recencyContinue effect refers to a recency statistic similar to what is described in Vu et al. (2017) and Mulder and Leenders (2019). For each timepoint t, for directed dyad (i,j) the statistic is equal to 1/(the time that has past since the dyad was last active + 1).
List with all information required by 'remstats::remstats()' to compute the statistic.
rrankSend, rrankReceive,
recencySendSender, recencyReceiveSender,
recencyReceiveSender and recencyReceiveReceiver
for other type of recency effects
effects <- ~ recencyContinue() reh_tie <- remify::remify(history, model = "tie") remstats(tie_effects = effects, reh = reh_tie) reh_actor <- remify::remify(history, model = "actor") remstats(receiver_effects = effects, reh = reh_actor)effects <- ~ recencyContinue() reh_tie <- remify::remify(history, model = "tie") remstats(tie_effects = effects, reh = reh_tie) reh_actor <- remify::remify(history, model = "actor") remstats(receiver_effects = effects, reh = reh_actor)
Specifies the statistic for a recency receive of receiver effect in the
effects argument of tomstats or the
receiver_effects argument of aomstats.
recencyReceiveReceiver(consider_type = "ignore")recencyReceiveReceiver(consider_type = "ignore")
consider_type |
character. Controls how event types are handled:
|
The recencyReceiveReceiver effect refers to a recency statistic similar to what is described in Vu et al. (2017) and Mulder and Leenders (2019). For each timepoint t, for directed dyad (i,j) the statistic is equal to 1/(the time that has past since receiver j was last active as receiver + 1). Note that the 'recencyReceiveReceiver' effect is only defined for directed events.
List with all information required by 'remstats::remstats()' to compute the statistic.
rrankSend, rrankReceive,
recencySendSender, recencyReceiveSender,
recencyReceiveSender and recencyContinue for
other type of recency effects
effects <- ~ recencyReceiveReceiver() reh_tie <- remify::remify(history, model = "tie") remstats(tie_effects = effects, reh = reh_tie) reh_actor <- remify::remify(history, model = "actor") remstats(receiver_effects = effects, reh = reh_actor)effects <- ~ recencyReceiveReceiver() reh_tie <- remify::remify(history, model = "tie") remstats(tie_effects = effects, reh = reh_tie) reh_actor <- remify::remify(history, model = "actor") remstats(receiver_effects = effects, reh = reh_actor)
Specifies the statistic for a recency receive of sender effect in the
effects argument of tomstats or the
sender_effects argument of aomstats.
recencyReceiveSender(consider_type = "ignore")recencyReceiveSender(consider_type = "ignore")
consider_type |
character. Controls how event types are handled:
|
The recencyReceiveSender effect refers to a recency statistic similar to what is described in Vu et al. (2017) and Mulder and Leenders (2019). For each timepoint t, for directed dyad (i,j) the statistic is equal to 1/(the time that has past since sender i was last active as receiver + 1). Note that the 'recencyReceiveSender' effect is only defined for directed events.
List with all information required by 'remstats::remstats()' to compute the statistic.
rrankSend, rrankReceive,
recencySendSender, recencySendReceiver,
recencyReceiveReceiver and recencyContinue for
other type of recency effects
effects <- ~ recencyReceiveSender() reh_tie <- remify::remify(history, model = "tie") remstats(tie_effects = effects, reh = reh_tie) reh_actor <- remify::remify(history, model = "actor") remstats(sender_effects = effects, reh = reh_actor)effects <- ~ recencyReceiveSender() reh_tie <- remify::remify(history, model = "tie") remstats(tie_effects = effects, reh = reh_tie) reh_actor <- remify::remify(history, model = "actor") remstats(sender_effects = effects, reh = reh_actor)
Specifies the statistic for a recency send of receiver effect in the
effects argument of tomstats or the
receiver_effects argument of aomstats.
recencySendReceiver(consider_type = "ignore")recencySendReceiver(consider_type = "ignore")
consider_type |
character. Controls how event types are handled:
|
The recencySendReceiver effect refers to a recency statistic similar to what is described in Vu et al. (2017) and Mulder and Leenders (2019). For each timepoint t, for directed dyad (i,j) the statistic is equal to 1/(the time that has past since receiver j was last active as sender + 1). Note that the 'recencySendReceiver' effect is only defined for directed events.
List with all information required by 'remstats::remstats()' to compute the statistic.
rrankSend, rrankReceive,
recencySendSender, recencyReceiveSender,
recencyReceiveReceiver and recencyContinue for
other type of recency effects
effects <- ~ recencySendReceiver() reh_tie <- remify::remify(history, model = "tie") remstats(tie_effects = effects, reh = reh_tie) reh_actor <- remify::remify(history, model = "actor") remstats(receiver_effects = effects, reh = reh_actor)effects <- ~ recencySendReceiver() reh_tie <- remify::remify(history, model = "tie") remstats(tie_effects = effects, reh = reh_tie) reh_actor <- remify::remify(history, model = "actor") remstats(receiver_effects = effects, reh = reh_actor)
Specifies the statistic for a recency send of sender effect in the
effects argument of tomstats or the sender_effects
argument of aomstats.
recencySendSender(consider_type = "ignore")recencySendSender(consider_type = "ignore")
consider_type |
character. Controls how event types are handled:
|
The recencySendSender effect refers to a recency statistic similar to what is described in Vu et al. (2017) and Mulder and Leenders (2019). For each timepoint t, for directed dyad (i,j) the statistic is equal to 1/(the time that has past since sender i was last active as sender + 1). Note that the 'recencySendSender' effect is only defined for directed events.
List with all information required by 'remstats::remstats()' to compute the statistic.
rrankSend, rrankReceive,
recencySendReceiver, recencyReceiveSender,
recencyReceiveReceiver and recencyContinue for
other type of recency effects
effects <- ~ recencySendSender() reh_tie <- remify::remify(history, model = "tie") remstats(tie_effects = effects, reh = reh_tie) reh_actor <- remify::remify(history, model = "actor") remstats(sender_effects = effects, reh = reh_actor)effects <- ~ recencySendSender() reh_tie <- remify::remify(history, model = "tie") remstats(tie_effects = effects, reh = reh_tie) reh_actor <- remify::remify(history, model = "actor") remstats(sender_effects = effects, reh = reh_actor)
Specifies the statistic for a reciprocity effect in the tie-oriented model or the receiver choice step of the actor-oriented model.
reciprocity(scaling = c("none", "prop", "std"), consider_type = "ignore")reciprocity(scaling = c("none", "prop", "std"), consider_type = "ignore")
scaling |
the method for scaling the reciprocity statistic. Default is to not scale the statistic but keep the raw 'counts'. Alternatively, the statistics can be scaled by 'prop', in which raw counts are divided by the indegree of the sender at time t (see 'details') or standardization of the raw counts per time point can be requested with 'std'. |
consider_type |
character. Controls how event types are handled:
|
A reciprocity effect refers to the tendency for actors to reciprocate past interactions. The statistic at timepoint t for dyad (i,j) (tie-oriented model) or receiver j (actor-oriented model) is equal to the number of (j,i) events before timepoint t. Note that a reciprocity effect is only defined for directed events.
Optionally, a scaling method can be set with scaling. By scaling the
reciprocity count by the indegree of the sender, the statistic refers to the
fraction of messages received by actor i that were received from actor j. If
actor i hasn't received any messages yet it can be assumed that actor i is
equally likely to receive a message from every actor and the statistic is
set equal to 1/(n-1), where n refers to the number of actors. The resulting
statistic is similar to the "FrRecSnd" statistic in the R package 'relevent'.
List with all information required by 'remstats::remstats()' to compute the statistic.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ reciprocity() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)reh_tie <- remify::remify(history, model = "tie") effects <- ~ reciprocity() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)
Computes statistics for modeling relational events with a tie-oriented or actor-oriented approach.
remstats( reh, tie_effects = NULL, sender_effects = NULL, receiver_effects = NULL, attr_actors = NULL, attr_dyads = NULL, memory = c("full", "window", "decay", "interval"), memory_value = NA, start = 2, stop = Inf, display_progress = FALSE, sampling = FALSE, samp_num = NULL, seed = NULL )remstats( reh, tie_effects = NULL, sender_effects = NULL, receiver_effects = NULL, attr_actors = NULL, attr_dyads = NULL, memory = c("full", "window", "decay", "interval"), memory_value = NA, start = 2, stop = Inf, display_progress = FALSE, sampling = FALSE, samp_num = NULL, seed = NULL )
reh |
an object of class |
tie_effects |
an object of class |
sender_effects |
an object of class |
receiver_effects |
an object of class |
attr_actors |
optionally, an object of class
|
attr_dyads |
optionally, an object of class |
memory |
The memory to be used. See ‘Details’. |
memory_value |
Numeric value indicating the memory parameter. Default
is |
start |
an optional integer value, specifying the index of the first
time or event in the relational event history for which statistics must be
computed (see 'Details'). Default is |
stop |
an optional integer value, specifying the index of the last time or event in the relational event history for which statistics must be computed (see 'Details') |
display_progress |
should a progress bar for the computation of the endogenous statistics be shown (TRUE) or not (FALSE)? |
sampling |
Logical. If |
samp_num |
Integer. Number of dyads to include per event when
|
seed |
Optional integer. Random seed used for dyad sampling. Setting
this ensures reproducible sampling across calls. If |
An object of class 'remstats'. In case of the
tie-oriented model, an array with the computed statistics, where rows refer
to time points, columns refer to potential relational event (i.e., potential
edges) in the risk set and slices refer to statistics. In case of the
actor-oriented model, list with in the first element the statistics for the
sender activity rate step and in the second element the statistics for the
receiver choice step, where rows refer to time points, columns refer to
potential senders or receivers, respectively. Statistics are computed once
per unique time point (per-timepoint "pt" method), so the number of rows in
the output equals reh$M (the number of unique time points), which may
be less than the total number of observed events when simultaneous events
are present. The 'remstats' object has the following attributes:
modelType of model that is estimated, obtained from the remify object inputted to 'reh'.
formulaModel formula, obtained from the formula inputted to 'tie_effects', 'sender_effects' and/or 'receiver_effects', depending on the model.
risksetFor the tie-oriented model, the risk set used to construct the statistics.
actorsFor the actor-oriented model, the set of actors used to construct the statistics, obtained from the remify object inputted to 'reh'.
The statistics to be computed are defined symbolically and should be
supplied to the tie_effects (for the tie-oriented model), or
sender_effects and/or receiver_effects (for the actor-oriented
model) argument in the form ~ effects. The terms are separated by +
operators. For example: effects = ~ inertia() + otp(). Interactions
between two effects can be included with * or : operators. For example:
effects = ~ inertia():otp(). A list of available effects
can be obtained with tie_effects() and
actor_effects().
The majority of the statistics can be scaled in some way, see
the documentation of the scaling argument in the separate effect
functions for more information on this.
The majority of the statistics can account for the event type
included as a dependent variable, see the documentation of the
consider_type argument in the separate effect functions for more
information on this. Note that this option is only available for the
tie-oriented model.
Note that events in the relational event history can be directed or undirected. Some statistics are only defined for either directed or undirected events (see the documentation of the statistics). Note that undirected events are only available for the tie-oriented model.
For the computation of the exogenous statistics an attributes
object with the exogenous covariate information has to be supplied to the
attr_actors argument in either remstats() or in the separate
effect functions supplied to the ..._effects arguments (e.g., see
send). This attr_actors object should be constructed as
follows: A dataframe with rows referring to the attribute value of actor
i at timepoint t. A 'name' column is required that contains the
actor name (corresponding to the actor names in the relational event
history). A 'time' column is required that contains the time when attributes
change (set to zero if none of the attributes vary over time). Subsequent
columns contain the attributes that are called in the specifications of
exogenous statistics (column name corresponding to the string supplied to
the variable argument in the effect function). Note that the
procedure for the exogenous effects ‘tie’ and ‘event’ deviates from this,
here the exogenous covariate information has to be specified in a different
way, see tie and event.
For the computation of the dyad exogenous statistics with
tie(), an attributes object with the exogenous covariates information
per dyad has to be supplied. This is a data.frame or matrix
containing attribute information for dyads. If attr_dyads is a
data.frame, the first two columns should represent "actor1" and
"actor2" (for directed events, "actor1" corresponds to the sender, and
"actor2" corresponds to the receiver). Additional columns can represent
dyads' exogenous attributes. If attributes vary over time, include a column
named "time". If attr_dyads is a matrix, the rows correspond
to "actor1", columns to "actor2", and cells contain dyads' exogenous
attributes.
The default 'memory' setting is '"full"', which implies that at each time point $t$ the entire event history before $t$ is included in the computation of the statistics. Alternatively, when 'memory' is set to '"window"', only the past event history within a given time window is considered (see Mulders & Leenders, 2019). This length of this time window is set by the 'memory_value' parameter. For example, when 'memory_value = 100' and 'memory = "window"', at time point $t$ only the past events that happened at most 100 time units ago are included in the computation of the statistics. A third option is to set 'memory' to '"interval"'. In this case, the past event history within a given time interval is considered. For example, when '"memory_value" = c(50, 100)' and 'memory = "window"', at time point $t$ only the past events that happened between 50 and 100 time units ago are included in the computation of the statistics. Finally, the fourth option is to set 'memory' to '"decay"'. In this case, the weight of the past event in the computation of the statistics depend on the elapsed time between $t$ and the past event. This weight is determined based on an exponential decay function with half-life parameter 'memory_value' (see Brandes et al., 2009).
Note that if the relational event history contains a column that is named “weight”, it is assumed that these affect the endogenous statistics. These affect the computation of all endogenous statistics with a few exceptions that follow logically from their definition (e.g., the recenyContinue statistic does depend on time since the event and not on event weights).
It is possible to compute statistics for a segment of the relational event sequence, based on the entire event history. This is done by specifying the 'start' and 'stop' values as the indices for the first and last event times for which statistics are needed. For instance, setting 'start = 5' and 'stop = 5' calculates statistics for the 5th event in the relational event sequence, considering events 1-4 in the history. Note that in cases of simultaneous events with the 'method' set to 'pt' (per timepoint), 'start' and 'stop' should correspond to the indices of the first and last unique event timepoints for which statistics are needed. For example, if 'start = 5' and 'stop = 5', statistics are computed for the 5th unique timepoint in the relational event sequence, considering all events occurring at unique timepoints 1-4.
Optionally, a previously computed adjacency matrix can be supplied. Note that the endogenous statistics will be computed based on this adjacency matrix. Hence, supplying a previously computed adjacency matrix can reduce computation time but the user should be absolutely sure the adjacency matrix is accurate.
Butts, C. T. (2008). A relational event framework for social action. Sociological Methodology, 38(1), 155–200. doi:10.1111/j.1467-9531.2008.00203.x, Stadtfeld, C., & Block, P. (2017). Interactions, actors, and time: Dynamic network actor models for relational events. Sociological Science, 4, 318–352. doi:10.15195/v4.a14
library(remstats) # Tie-oriented model eff <- ~ inertia():send("extraversion") + otp() reh_tie <- remify::remify(edgelist = history, model = "tie") remstats(reh = reh_tie, tie_effects = eff, attr_actors = info) # Actor-oriented model seff <- ~ send("extraversion") reff <- ~ receive("agreeableness") + inertia() + otp() reh_actor <- remify::remify(edgelist = history, model = "actor") remstats( reh = reh_actor, sender_effects = seff, receiver_effects = reff, attr_actors = info )library(remstats) # Tie-oriented model eff <- ~ inertia():send("extraversion") + otp() reh_tie <- remify::remify(edgelist = history, model = "tie") remstats(reh = reh_tie, tie_effects = eff, attr_actors = info) # Actor-oriented model seff <- ~ send("extraversion") reff <- ~ receive("agreeableness") + inertia() + otp() reh_actor <- remify::remify(edgelist = history, model = "actor") remstats( reh = reh_actor, sender_effects = seff, receiver_effects = reff, attr_actors = info )
Specifies the statistic for a recency rank receive effect in the
effects argument of tomstats or the
receiver_effects argument of aomstats.
rrankReceive(consider_type = "ignore")rrankReceive(consider_type = "ignore")
consider_type |
character. Controls how event types are handled:
|
The rrankSend effect refers to a rank-based recency effect, as described in section 2.2.5 of Butts (2008). For each timepoint t, for directed dyad (i,j) the statistic is equal to the inverse of the rank of receiver j among the actors from which sender i has most recently received past events. Note that the 'rrankReceive' effect is only defined for directed events.
List with all information required by 'remstats::remstats()' to compute the statistic.
rrankSend, recencySendSender,
recencySendReceiver, recencyReceiveSender,
recencyReceiveReceiver and recencyContinue for
other type of recency effects
reh_tie <- remify::remify(history, model = "tie") effects <- ~ rrankReceive() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(receiver_effects = effects, reh = reh_actor)reh_tie <- remify::remify(history, model = "tie") effects <- ~ rrankReceive() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(receiver_effects = effects, reh = reh_actor)
Specifies the statistic for a recency rank send effect in the
effects argument of tomstats or the
receiver_effects argument of aomstats.
rrankSend(consider_type = "ignore")rrankSend(consider_type = "ignore")
consider_type |
character. Controls how event types are handled:
|
The rrankSend effect refers to a rank-based recency effect, as described in section 2.2.5 of Butts (2008). For each timepoint t, for directed dyad (i,j) the statistic is equal to the inverse of the rank of receiver j among the actors to which sender i has most recently send past events. Note that the 'rrankSend' effect is only defined for directed events.
List with all information required by 'remstats::remstats()' to compute the statistic.
rrankReceive, recencySendSender,
recencySendReceiver, recencyReceiveSender,
recencyReceiveReceiver and recencyContinue for
other type of recency effects
reh_tie <- remify::remify(history, model = "tie") effects <- ~ rrankSend() remstats(tie_effects = effects, reh = reh_tie) reh_actor <- remify::remify(history, model = "actor") remstats(receiver_effects = effects, reh = reh_actor)reh_tie <- remify::remify(history, model = "tie") effects <- ~ rrankSend() remstats(tie_effects = effects, reh = reh_tie) reh_actor <- remify::remify(history, model = "actor") remstats(receiver_effects = effects, reh = reh_actor)
Specifies the statistic for a "same" effect in the tie-oriented model or the receiver choice step of the actor-oriented model. A "same" effect refers to an exogenous actor attribute that affects dyad (i,j)'s rate of interacting (tie-oriented model) or actor j's probability of being chosen as a receiver for the event send by the active sender i at time t (actor-oriented model) based on whether actors i and j have the same value (or not) on this attribute.
same(variable, attr_actors = NULL, attr_data)same(variable, attr_actors = NULL, attr_data)
variable |
string with the name of the column in the
|
attr_actors |
optionally, an object of class
|
attr_data |
Deprecated argument. Please use 'attr_actors' instead. |
The statistic at timepoint t is equal to one for dyads (i,j) that have the same value on the attribute at timepoint t (tie-oriented model) or one for receivers j that have the same value on the attribute as the active sender i at timepoint t (actor-oriented model) and equal to 0 for dyads and receivers that do not have the same value.
Construct the 'attr_actors' object as a data frame where each row represents the attribute value of actor i at timepoint t:
name: The actors' name.
time: The time when the attribute values change.
variable: The third column contains the attribute used in the
specification of the "difference" effect. The column name should correspond
to the string supplied to the variable argument in the 'difference()'
function.
Note that it is possible to omit the 'attr_actors' object in the call of
difference() and, instead, supply it in the call of remstats()
for multiple exogenous effects.
List with all information required by 'remstats::remstats()' to compute the statistic.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ same("age") remstats(reh = reh_tie, tie_effects = effects, attr_actors = info) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects, attr_actors = info)reh_tie <- remify::remify(history, model = "tie") effects <- ~ same("age") remstats(reh = reh_tie, tie_effects = effects, attr_actors = info) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects, attr_actors = info)
Specifies the statistic for a "send" effect in the tie-oriented model or the actor activity rate step of the actor-oriented model. A "send" effect refers to an exogenous actor attribute that affects actor i's rate of sending events.
send(variable, attr_actors = NULL, scaling = c("none", "std"), attr_data)send(variable, attr_actors = NULL, scaling = c("none", "std"), attr_data)
variable |
string with the name of the column in the
|
attr_actors |
optionally, an object of class
|
scaling |
the method for scaling the statistic. Default is to not scale the statistic. Alternatively, standardization of the statistic per time point can be requested with "std". |
attr_data |
Deprecated argument. Please use 'attr_actors' instead. |
The statistic at timepoint t is equal to the value of the exogenous attribute for actor i at time t for all dyads in the risk set that have actor i as sender. Note that a "send" effect is only defined for directed relational events.
Construct the 'attr_actors' object as a data frame where each row represents the attribute value of actor i at timepoint t:
name: The actors' name.
time: The time when the attribute values change.
variable: The third column contains the attribute used in the
specification of the "difference" effect. The column name should correspond
to the string supplied to the variable argument in the 'difference()'
function.
Note that it is possible to omit the 'attr_actors' object in the call of
difference() and, instead, supply it in the call of remstats()
for multiple exogenous effects.
List with all information required by 'remstats::remstats()' to compute the statistic.
data(history) data(info) # Tie-oriented model reh_tie <- remify::remify(history, model = "tie") effects <- ~ send("extraversion") remstats(reh = reh_tie, tie_effects = effects, attr_actors = info) # Actor-oriented model reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, sender_effects = effects, attr_actors = info)data(history) data(info) # Tie-oriented model reh_tie <- remify::remify(history, model = "tie") effects <- ~ send("extraversion") remstats(reh = reh_tie, tie_effects = effects, attr_actors = info) # Actor-oriented model reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, sender_effects = effects, attr_actors = info)
Specifies the statistic for a shared partners effect for undirected events.
sp(unique = FALSE, scaling = c("none", "std"), consider_type = "ignore")sp(unique = FALSE, scaling = c("none", "std"), consider_type = "ignore")
unique |
A logical value indicating whether to sum the minimum of events with third actors (FALSE, default) or the number of third actors that create a new, unique shared partner (TRUE). See details for more information. |
scaling |
the method for scaling the triad statistic. Default is to not scale the statistic but keep the raw 'counts'. Alternatively, standardization of the raw counts per time point can be requested with 'std'. |
consider_type |
character. Controls how event types are handled:
|
The shared partners effect describes the propensity of dyads to interact based on the number of past shared partners between them. By default, the statistic at timepoint t for the undirected dyad (i,j) is computed as the sum of the minimum occurrences of past undirected (i,h) and undirected (j,h) events across all actors h.
When the unique parameter is set to TRUE, a different approach is taken. In this case, the statistic counts the number of actors h that contribute to the creation of a new, distinct shared partner between actors i and j.
Additionally, it is possible to specify a scaling method using the scaling parameter.
Please note that the shared partners effect, 'sp', is exclusively defined for undirected events.
List with all information required by 'remstats::remstats()' to compute the statistic.
otp, itp, osp, or
isp for triadic effects for directed relational events.
reh_tie <- remify::remify(history, model = "tie", directed = FALSE) effects <- ~ sp() remstats(tie_effects = effects, reh = reh_tie)reh_tie <- remify::remify(history, model = "tie", directed = FALSE) effects <- ~ sp() remstats(tie_effects = effects, reh = reh_tie)
Stack a tomstats object into long format suitable for fitting with
standard R model functions. Each row corresponds to one dyad in the risk
set at one event time point.
stack_stats(stats, reh)stack_stats(stats, reh)
stats |
A |
reh |
A |
For interval timing (ordinal = FALSE), the stacked data can be
fitted with a Poisson GLM using log_interevent as an offset:
glm(obs ~ -1 + . - event - dyad - log_interevent,
offset = log_interevent, family = poisson, data = stacked$remstats_stack)
For ordinal timing (ordinal = TRUE), use conditional logistic
regression stratified by event:
survival::clogit(obs ~ -1 + . - event - dyad +
strata(event), data = stacked$remstats_stack)
A list with elements:
Data frame in long format with columns: event
(event index), dyad (dyad index 1..D), all statistic columns,
obs (1 = observed event, 0 = non-event), and
log_interevent (log inter-event time; only for interval timing).
Integer vector of length 2: first and last event index.
Number of dyads in the risk set.
Number of events (time points).
Logical: whether the ordinal likelihood applies.
Produce summaries of each statistic from a remstats object.
## S3 method for class 'remstats' summary(object, ...)## S3 method for class 'remstats' summary(object, ...)
object |
object of class |
... |
additional arguments affecting the summary produced. |
The summaries provide information for each statistic included in the remstats object, offering insights into the distribution and characteristics of the data.
rehObject <- remify::remify(edgelist = history, model = "tie") remstatsObject <- remstats::remstats(reh = rehObject, tie_effects = ~ remstats::inertia()) summary(remstatsObject) rehObject <- remify::remify(edgelist = history, model = "actor") remstatsObject <- remstats::remstats(reh = rehObject, receiver_effects = ~ inertia()) summary(remstatsObject)rehObject <- remify::remify(edgelist = history, model = "tie") remstatsObject <- remstats::remstats(reh = rehObject, tie_effects = ~ remstats::inertia()) summary(remstatsObject) rehObject <- remify::remify(edgelist = history, model = "actor") remstatsObject <- remstats::remstats(reh = rehObject, receiver_effects = ~ inertia()) summary(remstatsObject)
Specifies the statistic for a "tie" (or, "dyad") effect.
tie(variable, attr_dyads = NULL, scaling = c("none", "std"), x, variableName)tie(variable, attr_dyads = NULL, scaling = c("none", "std"), x, variableName)
variable |
A string specifying the attribute to compute the statistic. If |
attr_dyads |
A |
scaling |
The method for scaling the statistic. The default is no scaling. Alternatively, standardization of the statistic per time point can be requested with "std". |
x |
Deprecated argument. Please use 'attr_dyads' instead. |
variableName |
Deprecated argument. Please use 'variable' instead. |
The "tie" effect or "dyad" effect refers to an exogenous dyad attribute that influences dyad (i,j)'s interaction rate (in tie-oriented models) or the probability of actor j being chosen as a receiver for the event sent by the active sender i (in actor-oriented models). The statistic represents the value of the exogenous attribute for dyad (i,j) in the attr_dyads data.
List with all information required by 'remstats::remstats()' to compute the statistic.
data(history) data(both_male_long) effect <- ~ tie(variable = "both_male", attr_dyads = both_male_long) reh <- remify::remify(history, model = "tie") remstats(reh = reh, tie_effects = effect) data(both_male_wide) effect <- ~ tie(variable = "both_male", attr_dyads = both_male_wide) reh <- remify::remify(history, model = "tie") remstats(reh = reh, tie_effects = effect)data(history) data(both_male_long) effect <- ~ tie(variable = "both_male", attr_dyads = both_male_long) reh <- remify::remify(history, model = "tie") remstats(reh = reh, tie_effects = effect) data(both_male_wide) effect <- ~ tie(variable = "both_male", attr_dyads = both_male_wide) reh <- remify::remify(history, model = "tie") remstats(reh = reh, tie_effects = effect)
Overview of statistics in the tie-oriented model, see Details.
tie_effects(directed = NULL, endogenous = NULL)tie_effects(directed = NULL, endogenous = NULL)
directed |
logical value. The function outputs all statistics in the tie-oriented model for directed events if true, or all statistics in the tie-oriented model for undirected events if false. |
endogenous |
logical value. The function outputs all endogenous statistics in the tie-oriented model if true, or all exogenous statistics if false |
Overview of statistics in the tie-oriented model.
Baseline:
Exogenous statistics:
Endogenous statistics:
inertia()
otp()
itp()
osp()
isp()
sp()
psABBA()
psABBY()
psABXA()
psABXB()
psABXY()
psABAY()
psABAB()
FEtype()
Directed vs. undirected availability
The set of available effects depends on whether events are directed.
Use tie_effects(directed = TRUE) or
tie_effects(directed = FALSE) to obtain the authoritative list
for the current package version.
For undirected events (directed = FALSE), the available tie-model effects are:
Returns a list of available effects and their corresponding statistics.
# List of available effects tie_effects() # List of available effects for undirected networks tie_effects(directed = FALSE) # List of available endogenous effects for undirected networks tie_effects(directed = FALSE, endogenous = TRUE)# List of available effects tie_effects() # List of available effects for undirected networks tie_effects(directed = FALSE) # List of available endogenous effects for undirected networks tie_effects(directed = FALSE, endogenous = TRUE)
Computes statistics for modeling relational event history data with the tie-oriented relational event model.
tomstats( effects, reh, attr_actors = NULL, attr_dyads = NULL, memory = c("full", "window", "decay", "interval"), memory_value = NA, start = 2, stop = Inf, display_progress = FALSE, sampling = FALSE, samp_num = NULL, seed = NULL )tomstats( effects, reh, attr_actors = NULL, attr_dyads = NULL, memory = c("full", "window", "decay", "interval"), memory_value = NA, start = 2, stop = Inf, display_progress = FALSE, sampling = FALSE, samp_num = NULL, seed = NULL )
effects |
an object of class |
reh |
an object of class |
attr_actors |
optionally, an object of class
|
attr_dyads |
optionally, an object of class |
memory |
The memory to be used. See ‘Details’. |
memory_value |
Numeric value indicating the memory parameter. Default
is |
start |
an optional integer value, specifying the index of the first
time or event in the relational event history for which statistics must be
computed (see 'Details'). Default is |
stop |
an optional integer value, specifying the index of the last time or event in the relational event history for which statistics must be computed (see 'Details') |
display_progress |
should a progress bar for the computation of the endogenous statistics be shown (TRUE) or not (FALSE)? |
sampling |
Logical. If |
samp_num |
Integer. Number of dyads to include per event when
|
seed |
Optional integer. Random seed used for dyad sampling. Setting
this ensures reproducible sampling across calls. If |
An object of class 'tomstats'. Array with the computed statistics,
where rows refer to time points, columns refer to potential relational event
(i.e., potential edges) in the risk set and slices refer to statistics.
Statistics are computed once per unique time point (per-timepoint "pt"
method), so the number of rows in the output equals reh$M (the number
of unique time points), which may be less than the total number of observed
events when simultaneous events are present. The 'tomstats' object has the
following attributes:
modelType of model that is estimated.
formulaModel formula, obtained from the formula inputted to 'tie_effects'.
risksetThe risk set used to construct the statistics.
The statistics to be computed are defined symbolically and should be
supplied to the effects argument in the form ~ effects. The
terms are separated by + operators. For example:
effects = ~ inertia() + otp(). Interactions between two effects
can be included with * operators. For example:
effects = ~ inertia()*otp(). A list of available effects can be
obtained with tie_effects().
The majority of the statistics can be scaled in some way, see
the documentation of the scaling argument in the separate effect
functions for more information on this.
The majority of the statistics can account for the event type
included as a dependent variable, see the documentation of the
consider_type argument in the separate effect functions for more
information on this.
Note that events in the relational event history can be directed or undirected. Some statistics are only defined for either directed or undirected events (see the documentation of the statistics). Note that undirected events are only available for the tie-oriented model.
For the computation of the exogenous statistics an attributes object
with the exogenous covariate information has to be supplied to the
attr_actors argument in either remstats() or in the separate
effect functions supplied to the ..._effects arguments (e.g., see
send). This attr_actors object should be constructed as
follows: A dataframe with rows referring to the attribute value of actor
i at timepoint t. A 'name' column is required that contains the
actor name (corresponding to the actor names in the relational event
history). A 'time' column is required that contains the time when attributes
change (set to zero if none of the attributes vary over time). Subsequent
columns contain the attributes that are called in the specifications of
exogenous statistics (column name corresponding to the string supplied to
the variable argument in the effect function). Note that the
procedure for the exogenous effects ‘tie’ and ‘event’ deviates from this,
here the exogenous covariate information has to be specified in a different
way, see tie and event.
For the computation of the dyad exogenous statistics with tie(), an attributes object with the exogenous covariates information per dyad has to be supplied. This is a data.frame or matrix containing attribute information for dyads. If attr_dyads is a data.frame, the first two columns should represent "actor1" and "actor2" (for directed events, "actor1" corresponds to the sender, and "actor2" corresponds to the receiver). Additional columns can represent dyads' exogenous attributes. If attributes vary over time, include a column named "time". If attr_dyads is a matrix, the rows correspond to "actor1", columns to "actor2", and cells contain dyads' exogenous attributes.
The default 'memory' setting is '"full"', which implies that at each time point $t$ the entire event history before $t$ is included in the computation of the statistics. Alternatively, when 'memory' is set to '"window"', only the past event history within a given time window is considered (see Mulders & Leenders, 2019). This length of this time window is set by the 'memory_value' parameter. For example, when 'memory_value = 100' and 'memory = "window"', at time point $t$ only the past events that happened at most 100 time units ago are included in the computation of the statistics. A third option is to set 'memory' to '"interval"'. In this case, the past event history within a given time interval is considered. For example, when '"memory_value" = c(50, 100)' and 'memory = "window"', at time point $t$ only the past events that happened between 50 and 100 time units ago are included in the computation of the statistics. Finally, the fourth option is to set 'memory' to '"decay"'. In this case, the weight of the past event in the computation of the statistics depend on the elapsed time between $t$ and the past event. This weight is determined based on an exponential decay function with half-life parameter 'memory_value' (see Brandes et al., 2009).
Note that if the relational event history contains a column that is named “weight”, it is assumed that these affect the endogenous statistics. These affect the computation of all endogenous statistics with a few exceptions that follow logically from their definition (e.g., the recenyContinue statistic does depend on time since the event and not on event weights).
It is possible to compute statistics for a segment of the relational event sequence, based on the entire event history. This is done by specifying the 'start' and 'stop' values as the indices for the first and last event times for which statistics are needed. For instance, setting 'start = 5' and 'stop = 5' calculates statistics for the 5th event in the relational event sequence, considering events 1-4 in the history. Note that in cases of simultaneous events with the 'method' set to 'pt' (per timepoint), 'start' and 'stop' should correspond to the indices of the first and last unique event timepoints for which statistics are needed. For example, if 'start = 5' and 'stop = 5', statistics are computed for the 5th unique timepoint in the relational event sequence, considering all events occurring at unique timepoints 1-4.
Optionally, a previously computed adjacency matrix can be supplied. Note that the endogenous statistics will be computed based on this adjacency matrix. Hence, supplying a previously computed adjacency matrix can reduce computation time but the user should be absolutely sure the adjacency matrix is accurate.
Specifies the statistic for a 'totaldegreeDyad' effect.
totaldegreeDyad(scaling = c("none", "prop", "std"), consider_type = "ignore")totaldegreeDyad(scaling = c("none", "prop", "std"), consider_type = "ignore")
scaling |
the method for scaling the degree statistic. Default is to not scale the statistic (scaling = "none"). Alternatively, scaling of the raw degree counts by two times the number of past events at time t can be requested with 'prop' or standardization of the raw degree counts per time point can be requested with 'std'. |
consider_type |
character. Controls how event types are handled:
|
The 'totaldegreeDyad' effect refers to the tendency of pairs of actors (dyads) to increase their interaction rate as the total degree (number of interactions) of both actors in the pair goes up. To calculate this effect for a specific pair (i,j) at a given timepoint (t), we sum the degrees of the two actors in the dyad (i,j).
Additionally, there is an optional scaling method, which can be chosen using the 'scaling' method. When the 'prop' scaling method is applied, the degree count is divided by two times the total number of past events. This scaling converts the statistic into a fraction, representing the proportion of past events in which at least one actor in the dyad was involved. For the first timepoint, where no events have previously occurred, it is assumed that each actor is equally likely to be involved in an event. In this case, the statistic is set to 1 divided by the total number of actors (N).
The totaldegreeDyad effect is defined for the tie-oriented model and is applicable to both directed and undirected events.
List with all information required by 'remstats::remstats()' to compute the statistic.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ totaldegreeDyad() remstats(reh = reh_tie, tie_effects = effects)reh_tie <- remify::remify(history, model = "tie") effects <- ~ totaldegreeDyad() remstats(reh = reh_tie, tie_effects = effects)
Specifies the statistic for an 'totaldegreeReceiver' effect in the tie-oriented model or the receiver choice step of the actor-oriented model.
totaldegreeReceiver( scaling = c("none", "prop", "std"), consider_type = "ignore" )totaldegreeReceiver( scaling = c("none", "prop", "std"), consider_type = "ignore" )
scaling |
the method for scaling the degree statistic. Default is to not scale the statistic (scaling = "none"). Alternatively, scaling of the raw degree counts by two times the number of past events at time t can be requested with 'prop' or standardization of the raw degree counts per time point can be requested with 'std'. |
consider_type |
character. Controls how event types are handled:
|
A total degree of the receiver effect refers to the tendency for actors to receive events if they have send and received more past events. The statistic at timepoint t for dyad (i,j) (tie-oriented model) or receiver j (actor-oriented model) is equal to the number of events send and received by actor j before timepoint t. Note that the 'totaldegreeReceiver' effect is only defined for directed events.
Optionally, a scaling method can be set with scaling. By scaling the
degree count by the total number of past events times two, the statistic
refers to the fraction of past events times two that involved actor j. At
the first time point, when no events did previously occur, it is assumed
that every actor is equally likely to receive a message and the statistic is
set equal to 1/n, where n refers to the number of actors.
List with all information required by 'remstats::remstats()' to compute the statistic.
indegreeSender, indegreeReceiver,
outdegreeSender, outdegreeReceiver, or
totaldegreeSender for other types of degree effects.
reh_tie <- remify::remify(history, model = "tie") effects <- ~ totaldegreeReceiver() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)reh_tie <- remify::remify(history, model = "tie") effects <- ~ totaldegreeReceiver() remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, receiver_effects = effects)
Specifies the statistic for an 'totaldegreeSender' effect in the tie-oriented model or the sender activity rate step of the actor-oriented model.
totaldegreeSender(scaling = c("none", "prop", "std"), consider_type = "ignore")totaldegreeSender(scaling = c("none", "prop", "std"), consider_type = "ignore")
scaling |
the method for scaling the degree statistic. Default is to not scale the statistic (scaling = "none"). Alternatively, scaling of the raw degree counts by two times the number of past events at time t can be requested with 'prop' or standardization of the raw degree counts per time point can be requested with 'std'. |
consider_type |
character. Controls how event types are handled:
|
A total degree of the sender effect refers to the tendency for actors to send events if they have send and received more past events. The statistic at timepoint t for dyad (i,j) (tie-oriented model) or sender i (actor-oriented model) is equal to the number of events send and received by actor i before timepoint t. Note that the 'totaldegreeSender' effect is only defined for directed events.
Optionally, a scaling method can be set with scaling. By scaling the
degree count by the total number of past events times two, the statistic
refers to the fraction of past events times two that involved actor i. At
the first time point, when no events did previously occur, it is assumed
that every actor is equally likely to send a message and the statistic is
set equal to 1/n, where n refers to the number of actors.
List with all information required by 'remstats::remstats()' to compute the statistic.
indegreeSender, indegreeReceiver,
outdegreeSender, outdegreeReceiver, or
totaldegreeReceiver for other types of degree effects.
effects <- ~ totaldegreeSender() reh_tie <- remify::remify(history, model = "tie") remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, sender_effects = effects)effects <- ~ totaldegreeSender() reh_tie <- remify::remify(history, model = "tie") remstats(reh = reh_tie, tie_effects = effects) reh_actor <- remify::remify(history, model = "actor") remstats(reh = reh_actor, sender_effects = effects)
Allows the user to add its own pre-computed statistic to the statistics object and, optionally, interact this statistic with other statistics in the formula.
userStat(x, variableName = NULL)userStat(x, variableName = NULL)
x |
Matrix with number of rows equal to the number of events and number of columns equal to the number of dyads in the network (tie-oriented model) or the number of actors in the network (actor-oriented model) |
variableName |
Optionally, a string with the name of the statistic. |
List with all information required by 'remstats::remstats()' to compute the statistic.
reh <- remify::remify(history, model = "tie") actor101Events <- which(history$actor1 == "101" | history$actor2 == "101") actor101_stat <- t(sapply(seq_len(nrow(history)), function(i) { rep(i %in% actor101Events, reh$D) })) # Main effects only effects <- ~ userStat(x = actor101_stat, variableName = "actor101event") remstats(reh = reh, tie_effects = effects) # Model with interaction effects interaction_effects <- ~ inertia() * userStat(x = actor101_stat, variableName = "actor101event") remstats(reh = reh, tie_effects = interaction_effects)reh <- remify::remify(history, model = "tie") actor101Events <- which(history$actor1 == "101" | history$actor2 == "101") actor101_stat <- t(sapply(seq_len(nrow(history)), function(i) { rep(i %in% actor101Events, reh$D) })) # Main effects only effects <- ~ userStat(x = actor101_stat, variableName = "actor101event") remstats(reh = reh, tie_effects = effects) # Model with interaction effects interaction_effects <- ~ inertia() * userStat(x = actor101_stat, variableName = "actor101event") remstats(reh = reh, tie_effects = interaction_effects)