Skip to content

Integrate dynamic behavioral attributes into epigamesDiffNet#77

Draft
aoliveram wants to merge 7 commits intomasterfrom
issue-75-epigames-dynamic-attrs
Draft

Integrate dynamic behavioral attributes into epigamesDiffNet#77
aoliveram wants to merge 7 commits intomasterfrom
issue-75-epigames-dynamic-attrs

Conversation

@aoliveram
Copy link
Copy Markdown
Member

This PR addresses Issue #75. It updates the epigamesDiffNet dataset construction pipeline to move behavioral attributes from static averages to dynamic time-varying attributes (vertex.dyn.attrs).

Changes

  • New Python processing logic to parse raw histories.csv logs.
  • Updated data-raw/epigamesDiffNet.R to import these dynamic series.
  • Inclusion of mask, med, and quarantine as dynamic variables within the epigamesDiffNet object.

By including dynamic attributes, exposure() will now correctly account for whether a node or its neighbors were using masks at the exact time of contact, rather than using a 15-day average.

…Issue #75)

- Add data-raw/epigames.R: bundles epigames_hourly + dynamic_attrs_hourly.csv
  into epigames list with new $dyn_attrs slot (long format, 201,366 rows)
- Add data-raw/epigamesDiffNet.R: collapses hourly attrs to 15 daily windows,
  populates vertex.dyn.attrs with mask/med/quarantine proportions per day
- Regenerate data/epigames.rda and data/epigamesDiffNet.rda

Dynamic attributes (mask, med, quarantine) now visible in print(epigamesDiffNet):
  Dynamic attributes: mask, med, quarantine (3)

Validated: exposure(epigamesDiffNet, attrs = 'mask') works with time-varying
data. Correlation with static proxy = 0.88, confirming dynamic attrs
capture additional temporal variation.
@aoliveram aoliveram force-pushed the issue-75-epigames-dynamic-attrs branch from c5bf4c5 to 6b56bf1 Compare April 7, 2026 18:33
@aoliveram aoliveram self-assigned this Apr 16, 2026
@aoliveram aoliveram requested a review from gvegayon April 16, 2026 21:20
@aoliveram
Copy link
Copy Markdown
Member Author

@gvegayon the package now presents a weighted non-cumulative version. The user can construct a simpler network running two lines. This is what the documentation says:

\code{diffnet} version of the Epi Games data

A directed dynamic graph with 594 vertices and 15 time periods. The attributes
in the graph are described in \code{\link{epigames}}.

By default, this \code{diffnet} object is **non-cumulative** (each slice represents 
ephemeral daily contacts) and **valued** (edge weights represent contact duration in seconds). 

To reconstruct the classic cumulative/binarized network, you can run:

\preformatted{
epigames_cumul <- epigamesDiffNet

# 1. Accumulate the history across time periods
epigames_cumul$graph <- Reduce("+", epigames_cumul$graph, accumulate = TRUE)

# 2. Apply a logical cut-off to binarize the network
epigames_cumul$graph <- lapply(epigames_cumul$graph, function(m) { m@x[] <- 1; m })
}

Non-adopters have \code{toa = NA}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant