| Title: | Optimization Frameworks for Tie-Oriented and Actor-Oriented Relational Event Models |
|---|---|
| Description: | A comprehensive set of tools designed for optimizing likelihood within a tie-oriented (Butts, C., 2008, <doi:10.1111/j.1467-9531.2008.00203.x>) or an actor-oriented modelling framework (Stadtfeld, C., & Block, P., 2017, <doi:10.15195/v4.a14>) in relational event networks. The package accommodates both frequentist and Bayesian approaches. Maximum Likelihood Optimization (MLE) is supported. Bayesian estimation is done via Hamiltonian Monte Carlo (HMC). |
| Authors: | Giuseppe Arena [aut, cre] (ORCID: <https://orcid.org/0000-0001-5204-3326>), Rumana Lakdawala [aut], Fabio Generoso Vieira [aut], Joris Mulder [aut], Marlyne Meijerink-Bosman [ctb], Diana Karimova [ctb], Mahdi Shafiee Kamalabad [ctb], Roger Leenders [ctb] |
| Maintainer: | Giuseppe Arena <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 3.0.0 |
| Built: | 2026-05-15 19:37:28 UTC |
| Source: | https://github.com/tilburgnetworkgroup/remstimate |
Returns the AIC (Akaike's Information Criterion) value of a 'remstimate' object.
## S3 method for class 'remstimate' AIC(object, ...)## S3 method for class 'remstimate' AIC(object, ...)
object |
a |
... |
further arguments passed to |
AIC value.
A function that returns the AICC (Akaike's Information Corrected Criterion) value in a 'remstimate' object.
AICC(object, ...) ## S3 method for class 'remstimate' AICC(object, ...)AICC(object, ...) ## S3 method for class 'remstimate' AICC(object, ...)
object |
is a |
... |
further arguments to be passed to the 'AICC' method. |
AICC value of a 'remstimate' object.
AICC(remstimate): AICC (Akaike's Information Corrected Criterion) value of a 'remstimate' object
# ------------------------------------ # # tie-oriented model: "MLE" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", ncores = 1) # AICC AICC(tie_mle)# ------------------------------------ # # tie-oriented model: "MLE" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", ncores = 1) # AICC AICC(tie_mle)
A randomly generated sequence of relational events with 5 actors and 100 events. The event sequence is generated by following an actor-oriented modeling approach (for more information on the algorithm used for the generation, refer to help(topic = remulateActor, package = "remulate") or ?remulate::remulateActor).
data(ao_data)data(ao_data)
ao_data is a list object containing the following objects:
edgelista data.frame with the raw simulated edgelist. The columns of the data.frame are:
timethe timestamp indicating the time at which each event occurred
actor1the actor that generated the relational event
actor2the actor that received the relational event
seedthe seed value used in remulate::remulateActor() for generating the event sequence
true.parsa list of two vectors named "rate_model" and "choice_model", each containing the values of the parameters used in the generation of the event sequence
# (1) load the data into the workspace data(ao_data) # (2) process event sequence with \code{remify} ao_reh <- remify::remify(edgelist = ao_data$edgelist, model = "actor") # (3) define linear predictor and claculate stastistcs with \code{remstats} package ## linear predictor for the rate model rate_model <- ~ 1 + remstats::indegreeSender() ## linear predictror for the choice model choice_model <- ~ remstats::inertia() + remstats::reciprocity() ## calculate statistics ao_reh_stats <- remstats::remstats(reh = ao_reh, sender_effects = rate_model, receiver_effects = choice_model) # (4) estimate model using method = "MLE" and print out summary ## estimate model mle_ao <- remstimate::remstimate(reh = ao_reh, stats = ao_reh_stats, method = "MLE") ## print out a summary of the estimation summary(mle_ao)# (1) load the data into the workspace data(ao_data) # (2) process event sequence with \code{remify} ao_reh <- remify::remify(edgelist = ao_data$edgelist, model = "actor") # (3) define linear predictor and claculate stastistcs with \code{remstats} package ## linear predictor for the rate model rate_model <- ~ 1 + remstats::indegreeSender() ## linear predictror for the choice model choice_model <- ~ remstats::inertia() + remstats::reciprocity() ## calculate statistics ao_reh_stats <- remstats::remstats(reh = ao_reh, sender_effects = rate_model, receiver_effects = choice_model) # (4) estimate model using method = "MLE" and print out summary ## estimate model mle_ao <- remstimate::remstimate(reh = ao_reh, stats = ao_reh_stats, method = "MLE") ## print out a summary of the estimation summary(mle_ao)
Returns the BIC (Bayesian Information Criterion) value of a 'remstimate' object.
## S3 method for class 'remstimate' BIC(object, ...)## S3 method for class 'remstimate' BIC(object, ...)
object |
a |
... |
further arguments passed to |
BIC value.
remstimate objectCompute the diagnostics of a remstimate object
diagnostics(object, reh, stats, ...) ## S3 method for class 'remstimate' diagnostics(object, reh, stats, top_pct = 0.05, ...)diagnostics(object, reh, stats, ...) ## S3 method for class 'remstimate' diagnostics(object, reh, stats, top_pct = 0.05, ...)
object |
is a |
reh |
is a |
stats |
is a |
... |
further arguments to be passed to the 'diagnostics' method. |
top_pct |
numeric scalar in (0,1): threshold for the top-percentage recall summary (default 0.05). |
diagnostics(remstimate): diagnostics of a 'remstimate' object
remstimate objectProduces diagnostic plots from an object returned by
diagnostics(). Plot 1 (waiting-time Q-Q) and plot 2 (Schoenfeld
residuals) are computed from the diagnostics object alone. Plot 3 (recall
scatter) is also derived from the diagnostics object. Plots 4 and 5
(posterior density and trace plots) are HMC-only and additionally require
the original remstimate fit via object.
## S3 method for class 'diagnostics' plot( x, object = NULL, which = c(1:3), effects = NULL, sender_effects = NULL, receiver_effects = NULL, n_per_page = 4L, ... )## S3 method for class 'diagnostics' plot( x, object = NULL, which = c(1:3), effects = NULL, sender_effects = NULL, receiver_effects = NULL, n_per_page = 4L, ... )
x |
a |
object |
optional |
which |
integer vector of plots to produce. Default |
effects |
character vector of effect names to include (tie model).
|
sender_effects |
character vector of sender-model effects (actor model).
Pass |
receiver_effects |
character vector of receiver-model effects (actor
model). Pass |
n_per_page |
integer; maximum panels per page for multi-effect plots
(Schoenfeld, posterior density, trace). Default |
... |
further graphical arguments (currently unused). |
x invisibly.
remstimate objectsBackward-compatible wrapper that computes diagnostics()
when needed and delegates all plotting to plot.diagnostics.
Existing call signatures continue to work unchanged.
## S3 method for class 'remstimate' plot( x, reh, diagnostics = NULL, which = c(1:5), effects = NULL, sender_effects = NULL, receiver_effects = NULL, ... )## S3 method for class 'remstimate' plot( x, reh, diagnostics = NULL, which = c(1:5), effects = NULL, sender_effects = NULL, receiver_effects = NULL, ... )
x |
a |
reh |
a |
diagnostics |
optional pre-computed diagnostics object of class
|
which |
integer vector selecting plots (default |
effects |
character vector of effects to plot (tie model). |
sender_effects |
character vector of sender-model effects (actor model). |
receiver_effects |
character vector of receiver-model effects (actor model). |
... |
pass |
x invisibly.
remstimate objectA function that prints out the estimates returned by a 'remstimate' object.
## S3 method for class 'remstimate' print(x, ...)## S3 method for class 'remstimate' print(x, ...)
x |
is a |
... |
further arguments to be passed to the print method. |
no return value. Prints out the main characteristics of a 'remstimate' object.
# ------------------------------------ # # method 'print' for the # # ------------------------------------ # # loading data data(ao_data) # processing event sequence with remify ao_reh <- remify::remify(edgelist = ao_data$edgelist, model = "actor") # specifying linear predictor (for sender rate and receiver choice model) rate_model <- ~ 1 + remstats::indegreeSender() choice_model <- ~ remstats::inertia() + remstats::reciprocity() # calculating statistics ao_reh_stats <- remstats::remstats(reh = ao_reh, sender_effects = rate_model, receiver_effects = choice_model) # running estimation ao_mle <- remstimate::remstimate(reh = ao_reh, stats = ao_reh_stats, method = "MLE", nsim = 100, ncores = 1) # print ao_mle # ------------------------------------ # # for more examples check vignettes # # ------------------------------------ ## ------------------------------------ # # method 'print' for the # # ------------------------------------ # # loading data data(ao_data) # processing event sequence with remify ao_reh <- remify::remify(edgelist = ao_data$edgelist, model = "actor") # specifying linear predictor (for sender rate and receiver choice model) rate_model <- ~ 1 + remstats::indegreeSender() choice_model <- ~ remstats::inertia() + remstats::reciprocity() # calculating statistics ao_reh_stats <- remstats::remstats(reh = ao_reh, sender_effects = rate_model, receiver_effects = choice_model) # running estimation ao_mle <- remstimate::remstimate(reh = ao_reh, stats = ao_reh_stats, method = "MLE", nsim = 100, ncores = 1) # print ao_mle # ------------------------------------ # # for more examples check vignettes # # ------------------------------------ #
Estimates tie-oriented relational event model parameters using
Maximum Likelihood Estimation ("MLE") or Hamiltonian Monte Carlo
("HMC"). Supports both full statistics (tomstats) and
case-control sampled statistics (tomstats_sampled).
remstimate( reh, stats, method = c("MLE", "HMC"), ncores = 1L, nsim = 500L, nchains = 1L, burnin = 500L, thin = 10L, init = NULL, L = 50L, epsilon = 0.002, prior = NULL, seed = NULL, WAIC = FALSE, nsimWAIC = 100L, ... )remstimate( reh, stats, method = c("MLE", "HMC"), ncores = 1L, nsim = 500L, nchains = 1L, burnin = 500L, thin = 10L, init = NULL, L = 50L, epsilon = 0.002, prior = NULL, seed = NULL, WAIC = FALSE, nsimWAIC = 100L, ... )
reh |
a |
stats |
a |
method |
optimization method: |
ncores |
number of threads for parallelization (default 1). |
nsim |
[HMC only] number of MCMC iterations per chain after burnin. Default 500. |
nchains |
[HMC only] number of chains. Default 1. |
burnin |
[HMC only] burn-in iterations. Default 500. |
thin |
[HMC only] thinning interval. Default 10. |
init |
[HMC only] vector of initial parameter values. If NULL, MLE estimates are used as starting values. |
L |
[HMC only] number of leapfrog steps. Default 50. |
epsilon |
[HMC only] leapfrog step size. Default 0.002. |
prior |
[HMC only] list with elements |
seed |
[HMC only] random seed for reproducibility. |
WAIC |
logical. Compute WAIC? Default FALSE. Only supported for MLE for now. |
nsimWAIC |
number of draws from the (approximate) posterior distribution
used for the computation of the WAIC. Ignored if |
... |
further arguments (currently unused). |
a remstimate S3 object.
# ------------------------------------ # # tie-oriented model: "MLE" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", ncores = 1) # summary summary(tie_mle) # ------------------------------------ # # actor-oriented model: "MLE" # # ------------------------------------ # # loading data data(ao_data) # processing event sequence with remify ao_reh <- remify::remify(edgelist = ao_data$edgelist, model = "actor") # specifying linear predictor (for sender rate and receiver choice model) rate_model <- ~ 1 + remstats::indegreeSender() choice_model <- ~ remstats::inertia() + remstats::reciprocity() # calculating statistics ao_reh_stats <- remstats::remstats(reh = ao_reh, sender_effects = rate_model, receiver_effects = choice_model) # running estimation ao_mle <- remstimate::remstimate(reh = ao_reh, stats = ao_reh_stats, method = "MLE", ncores = 1) # summary summary(ao_mle) # ------------------------------------ # # for more examples check vignettes # # ------------------------------------ ## ------------------------------------ # # tie-oriented model: "MLE" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", ncores = 1) # summary summary(tie_mle) # ------------------------------------ # # actor-oriented model: "MLE" # # ------------------------------------ # # loading data data(ao_data) # processing event sequence with remify ao_reh <- remify::remify(edgelist = ao_data$edgelist, model = "actor") # specifying linear predictor (for sender rate and receiver choice model) rate_model <- ~ 1 + remstats::indegreeSender() choice_model <- ~ remstats::inertia() + remstats::reciprocity() # calculating statistics ao_reh_stats <- remstats::remstats(reh = ao_reh, sender_effects = rate_model, receiver_effects = choice_model) # running estimation ao_mle <- remstimate::remstimate(reh = ao_reh, stats = ao_reh_stats, method = "MLE", ncores = 1) # summary summary(ao_mle) # ------------------------------------ # # for more examples check vignettes # # ------------------------------------ #
remstimate objectA function that returns the summary of a remstimate object.
## S3 method for class 'remstimate' summary(object, ...)## S3 method for class 'remstimate' summary(object, ...)
object |
is a |
... |
further arguments to be passed to the 'summary' method. |
no return value. Prints out the summary of a 'remstimate' object. The output can be save in a list, which contains the information printed out by the summary method.
# ------------------------------------ # # method 'summary' for the # # tie-oriented model. # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", nsim = 100, ncores = 1) # summary summary(tie_mle) # ------------------------------------ # # method 'summary' for the # # actor-oriented model: "MLE" # # ------------------------------------ # # loading data data(ao_data) # processing event sequence with remify ao_reh <- remify::remify(edgelist = ao_data$edgelist, model = "actor") # specifying linear predictor (for sender rate and receiver choice model) rate_model <- ~ 1 + remstats::indegreeSender() choice_model <- ~ remstats::inertia() + remstats::reciprocity() # calculating statistics ao_reh_stats <- remstats::remstats(reh = ao_reh, sender_effects = rate_model, receiver_effects = choice_model) # running estimation ao_mle <- remstimate::remstimate(reh = ao_reh, stats = ao_reh_stats, method = "MLE", nsim = 100, ncores = 1) # summary summary(ao_mle) # ------------------------------------ # # for more examples check vignettes # # ------------------------------------ ## ------------------------------------ # # method 'summary' for the # # tie-oriented model. # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", nsim = 100, ncores = 1) # summary summary(tie_mle) # ------------------------------------ # # method 'summary' for the # # actor-oriented model: "MLE" # # ------------------------------------ # # loading data data(ao_data) # processing event sequence with remify ao_reh <- remify::remify(edgelist = ao_data$edgelist, model = "actor") # specifying linear predictor (for sender rate and receiver choice model) rate_model <- ~ 1 + remstats::indegreeSender() choice_model <- ~ remstats::inertia() + remstats::reciprocity() # calculating statistics ao_reh_stats <- remstats::remstats(reh = ao_reh, sender_effects = rate_model, receiver_effects = choice_model) # running estimation ao_mle <- remstimate::remstimate(reh = ao_reh, stats = ao_reh_stats, method = "MLE", nsim = 100, ncores = 1) # summary summary(ao_mle) # ------------------------------------ # # for more examples check vignettes # # ------------------------------------ #
A randomly generated sequence of relational events with 5 actors and 100 events. The event sequence is generated by following a tie-oriented modeling approach (for more information run on console help(topic = remulateTie, package = "remulate") or ?remulate::remulateTie).
data(tie_data)data(tie_data)
tie_data is a list object containing the following objects:
edgelista data.frame with the raw simulated edgelist. The columns of the data.frame are:
timethe timestamp indicating the time at which each event occurred
actor1the actor that generated the relational event
actor2the actor that received the relational event
seedthe seed value used in remulate::remulateTie() for generating the event sequence
true.parsa vector containing the values of the parameters used in the generation of the event sequence
# (1) load the data into the workspace data(tie_data) # (2) process event sequence with \code{remify} tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # (3) define linear predictor and claculate stastistcs with \code{remstats} package ## linear predictor tie_model <- ~ 1 + remstats::indegreeSender() + remstats::inertia() + remstats::reciprocity() ## calculate statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # (4) estimate model using method = "MLE" and print out summary ## estimate model mle_tie <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE") ## print out a summary of the estimation summary(mle_tie)# (1) load the data into the workspace data(tie_data) # (2) process event sequence with \code{remify} tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # (3) define linear predictor and claculate stastistcs with \code{remstats} package ## linear predictor tie_model <- ~ 1 + remstats::indegreeSender() + remstats::inertia() + remstats::reciprocity() ## calculate statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # (4) estimate model using method = "MLE" and print out summary ## estimate model mle_tie <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE") ## print out a summary of the estimation summary(mle_tie)
A function that returns the WAIC (Watanabe-Akaike's Information Criterion) value in a 'remstimate' object.
WAIC(object, ...) ## S3 method for class 'remstimate' WAIC(object, ...)WAIC(object, ...) ## S3 method for class 'remstimate' WAIC(object, ...)
object |
is a |
... |
further arguments to be passed to the 'WAIC' method. |
WAIC value of a 'remstimate' object.
WAIC(remstimate): WAIC (Watanabe-Akaike's Information Criterion) value of a 'remstimate' object
# No examples available at the moment# No examples available at the moment