Clarify aggregate.dur behavior in tSnaStats: inconsistent documentation vs. implementation
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- r
- Domain
- documentation
Research direction
Start with the aggregate.dur entry in tSnaStats.Rd and run the reproducible networkDynamic example from the issue to confirm the documented behavior. Update the manual entry and corresponding online documentation to define the window, endpoint semantics, and aggregate.dur = 0 behavior; done means both documentation locations agree with the example.
Written by the indexing model from the issue text.
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)
- Dominant language
- R
- Stars
- 12
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from statnet/networkDynamic
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
statnet/networkDynamic#15 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
statnet/networkDynamic#14 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
statnet/networkDynamic#11 · 6 comments · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
statnet/networkDynamic#9 · 4 comments ·
All issues in statnet/networkDynamic
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
r-lib/pkgdepends#485 · 3 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
beginners blocker
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enviPathR OpenBuild Error Build OK Build Warning policies-accepted pre-review precheck-passed
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Bioconductor/BiocContributions#207 · 6 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
datacarpentry/semester-biology#1255 ·