amore

End-to-end simulation, sampling, feature engineering, model selection, and inference for relational event models (REMs) in R.

A Gillespie-style event simulator with three composable layers (exogenous, endogenous, time-varying global covariates), a parallel post-hoc feature engine that exposes the same 41-statistic endogenous catalogue — covering the full continuous / ordered / exp-decay / interrupted family from Juozaitienė & Wit (2024, JRSS-A) — and a one-call compare_models() helper that fits competing specifications and returns a tidy AIC table.

Three real-world REM datasets ship with the package, so the documented workflows run on real data out of the box.

30-second tour

library(amore)

# 1. Bundled datasets, ready to load
data(classroom_events)   # 691 events,    20 actors (McFarland 2001)
data(social_evolution_calls) # 439 events, 54 actors  (Madan et al. 2011)
data(radoslaw_email)     # 82,927 emails, 167 actors (Michalski et al. 2014)

# 2. Compute endogenous features post-hoc
feat <- compute_endogenous_features(
  classroom_events,
  stats = c("reciprocity_count", "reciprocity_time_recent_interrupted",
            "transitivity_count", "transitivity_time_recent_interrupted"))

# 3. Compare candidate specifications by AIC
compare_models(
  classroom_events,
  models = list(
    count       = c("reciprocity_count", "transitivity_count"),
    continuous  = c("reciprocity_time_recent", "transitivity_time_recent"),
    interrupted = c("reciprocity_time_recent_interrupted",
                    "transitivity_time_recent_interrupted")),
  seed = 11)

# 4. Simulate a stream with known endogenous structure
set.seed(2026)
sim <- simulate_relational_events(
  n_events = 1500,
  senders = LETTERS[1:8], receivers = LETTERS[1:8],
  baseline_rate = 1, allow_loops = FALSE,
  endogenous_stats   = c("reciprocity_count", "transitivity_count"),
  endogenous_effects = c(reciprocity_count = 0.4, transitivity_count = 0.2))

What’s inside

The endogenous catalogue

Same 41-stat catalogue is exposed by both the simulator and the post-hoc engine, organised by family × variant:

Family count/binary ordered exp-decay time (recent/first) interrupted time
Reciprocity
Transitivity
Cyclic
Sending balance
Receiving balance

The reciprocity interrupted column covers all five variants (binary / count / exp-decay / time-recent / time-first); the four closure families’ interrupted column covers the time-recent and time-first variants empirically preferred by Juozaitienė & Wit (2024) Table 3. See ?compute_endogenous_features for the full list.

Where to next

Reference

Juozaitienė R, Wit EC (2024). It’s about time: revisiting reciprocity and triadicity in relational event analysis. JRSS-A 188(4), 1246–1262. doi:10.1093/jrsssa/qnae132.