-
Notifications
You must be signed in to change notification settings - Fork 1
Description
The aggregate.dur argument in networkDynamic::tSnaStats() is described in the CRAN manual as
“optional numeric value giving the duration of time bin to aggregate over for each evaluation (default 0). See network.collapse”
but this brief description is ambiguous about interval endpoints, window placement, and whether the window is half-open or closed. It does not match the actual implementation, which aggregates edges over the half-open interval [t, t + aggregate.dur).
Actual behavior:
In practice, tSnaStats(nd, snafun="gden", time.interval=5, aggregate.dur=1) does the following for each sampling time t (0, 5, 10, …):
- Defines a half-open window [t, t + 1).
- Collects all dynamic edges whose start_time (and end_time) fall within that window.
- Collapses multiple spikes of the same dyad into a single static edge.
- Computes global density as (number of unique dyads) / (N*(N-1)).
By contrast, the documentation leaves users wondering:
-
Is the window [t, t + aggregate.dur) or (t − aggregate.dur/2, t + aggregate.dur/2]?
-
Are both endpoints included?
-
What happens when aggregate.dur = 0?
Suggested documentation update
Please revise the manual entry for aggregate.dur in both tSnaStats.Rd and online documentation to read something like:
- aggregate.dur: optional numeric value giving the duration of time bin to aggregate over for each evaluation (default 0).
+ aggregate.dur: numeric; for each evaluation at time t, collapse all dynamic edges whose activity intervals overlap
+ the half-open window [t, t + aggregate.dur).
+ - Default = 0: instantaneous snapshot at t (no time window).
+ - aggregate.dur > 0: window width = aggregate.dur (e.g., 1 gives [t, t+1)).
Reproducible example
library(network)
library(networkDynamic)
# Create a small example of instantaneous edge spells
edge_spells <- data.frame(
start_time = c(0.2, 0.7, 5.1, 5.6),
end_time = c(0.2, 0.7, 5.1, 5.6),
tail = c(1, 2, 3, 4),
head = c(2, 3, 4, 1)
)
nd <- networkDynamic(
base.net = network.initialize(4, directed = TRUE),
edge.spells = edge_spells
)
# Default aggregate.dur = 0: snapshots at t = 0, 5, ...
tSnaStats(nd, snafun="gden", time.interval=5, aggregate.dur=0)
# aggregate.dur = 1: windows [0,1), [5,6), …
tSnaStats(nd, snafun="gden", time.interval=5, aggregate.dur=1)