Covariates

Exogenous effects are inherited almost unchanged from Cox regression and from ERGM/SAOM practice. What the relational event literature added is an identification rule: a term that is the same for every dyad in an event's risk set cannot be estimated from an ordinal likelihood. It decides which of the effects below can enter which model.

using Revel

history = build_history(Event{Float64}[])      # covariate effects need no history
age = [30.0, 45.0, 52.0, 38.0]
4-element Vector{Float64}:
 30.0
 45.0
 52.0
 38.0

Actor covariates

A covariate is a vector indexed by actor ID, or a Covariate when it needs a name, categories or a time dimension.

EffectValue for s → rremstatsgoldfishrelevent
SendEffectx[s]send()ego()CovSnd
ReceiveEffectx[r]receive()alter()CovRec
SumEffectx[s] + x[r]CovInt
AverageEffect(x[s] + x[r])/2average()
MatchEffect1 if equalsame()same()
DiffEffectabs(x[s] − x[r])difference()diff()
SimEffect−abs(x[s] − x[r])sim()
MinimumEffect, MaximumEffectmin, maxminimum(), maximum()
ProductEffectx[s] · y[r]send():receive()egoAlterInt()
compute(SendEffect(age), history, 2, 1, 0.0)                          # 45.0
compute(DiffEffect(age), history, 2, 1, 0.0)                    # 15.0
compute(DiffEffect(age; absolute=false), history, 1, 2, 0.0)    # -15.0 — sender minus receiver
compute(AverageEffect(age), history, 2, 1, 0.0)                       # 37.5
37.5

Categories need no coding:

dept = Covariate(["ops", "legal", "ops", "legal"]; name="dept")
compute(MatchEffect(dept), history, 1, 3, 0.0)    # 1.0
name(MatchEffect(dept))                            # "same.dept"
"same.dept"

An actor the covariate does not cover is an ArgumentError, never a silent zero, and a numeric effect refuses a categorical covariate.

Covariates that change over time

A time-varying covariate is piecewise constant: one column of values per change time. The first column also applies before the first change time — it is carried backwards, not treated as missing.

rank = Covariate([0.0, 100.0], [1.0 2.0; 1.0 1.0; 3.0 3.0; 2.0 2.0]; name="rank")
compute(SendEffect(rank), history, 1, 2, 50.0)     # 1.0
compute(SendEffect(rank), history, 1, 2, 150.0)    # 2.0 — promoted at t = 100
2.0

Every covariate effect, and every effect built on a covariate (TertiusEffect, MatchedDegree), accepts one. A missing value is refused: an unobserved attribute is not a category, and treating it as one would make two missing values "match".

Dyadic covariates

TieEffect reads a matrix X[s, r] — a pre-existing tie, a reporting line, a distance, an alliance — static or changing over time:

reports_to = [0 1 0 0; 0 0 0 0; 0 1 0 0; 1 0 0 0]
compute(TieEffect(reports_to; name="reports_to"), history, 1, 2, 0.0)   # 1.0
1.0

Global covariates

GlobalEffect is a function of time alone: a weekday, a shift, a period after a shock. It is the same for every dyad, so its main effect is not identified by the ordinal likelihood, and fit_revel refuses a model that holds one outside an interaction. Its use is as a moderator (here with times in hours):

night = GlobalEffect(t -> mod(t, 24) >= 20 ? 1.0 : 0.0; name="night")
more_reciprocal_at_night = Interaction(night, Reciprocation())
Interaction(night:reciprocity)

Lembo, Juozaitienė, Vinciotti & Wit (2026) recover the main effects of global covariates with a partial likelihood whose controls are drawn at shifted times; that estimator is not implemented here.

What is identified where

TermFull risk setReceiver choice (riskset=:sender)Timing model
SendEffect(x)yesno — constant within every choice setyes, if x is static (a time-varying covariate changes between events)
ReceiveEffect(x), dyadic formsyesyesyes
GlobalEffect(f)no — refusedno — refusednot admissible (it changes between events)
Interaction(GlobalEffect(f), stat)yesyesnot admissible
Interaction(SendEffect(x), stat)yesyes — the only way a sender trait entersyes

statistic_collinearity reports a term with no variation inside the risk sets (an infinite variance inflation factor) before any model is fitted.

Covariates read through the network

Two effects combine a covariate with the history and belong to Interactions: TertiusEffect, an aggregate of a covariate over an actor's network neighbours, and MatchedDegree, a degree counted over third actors who resemble the other endpoint.

relevent's covariate effects and REM's

relevent's CovSnd, CovRec, CovInt and CovEvent are SendEffect, ReceiveEffect, SumEffect and TieEffect, and its actor fixed effects FESnd, FERec and FEInt are the same three effects on an indicator covariate, one per actor k in 2:n:

n = 5
fixed = [SendEffect((1:n) .== k; name="FESnd.$k") for k in 2:n]
name.(fixed)                           # ["FESnd.2", "FESnd.3", "FESnd.4", "FESnd.5"]
4-element Vector{String}:
 "FESnd.2"
 "FESnd.3"
 "FESnd.4"
 "FESnd.5"

All seven are pinned against relevent::rem.dyad by a golden fixture (see Coming from relevent). REM.jl's NodeAttribute statistics implement only REM's signature, so they mix with Revel's inside REM.fit_rem — where every Revel statistic works too — and fit_revel refuses them with an ArgumentError that says so.