Draft
Conversation
…ion to 1.25.0, and fix exposure rownames issue
…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.
- Removed redundant comments and sanity checks for better readability - Simplified as_diffnet call structure - Regenerated .rda files to match clean scripts
- new_diffnet() gains a -tod- argument (single-behavior vector) with validation (element-wise tod > toa, NA where toa is NA, length match). - When -tod- is supplied, cumadopt is reconstructed from the intervals [toa, tod - 1] via cumadopt_from_intervals() in R/adjmat.r. - New $transmission slot plus exported helpers as_transmission_tree() and get_transmissions() (R/transmission.R) storing the directed infection forest as a data.frame with columns date, source, target, source_exposure_date, virus_id, virus. Docs cite Lloyd-Smith et al. (2005) and White & Pagano (2008). - Tests cover interval reconstruction, validation errors, coercion, and the transmission slot round-trip. No new package dependencies.
Avoid masking epiworldR::get_transmissions() when both packages are loaded. No behavior change; exported name and docs renamed, tests updated accordingly. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds link_fun + link_pars arguments to exposure(). Supported named kernels: identity (default), linear (min(beta*w, 1)), sigmoid (plogis((w-h)/scale)), wells-riley (1 - exp(-beta*w)). Custom user functions are accepted with either signature function(w) or function(w, pars). Non-identity kernels force valued = TRUE with a warning. Default behavior unchanged; 639 pre-existing tests still pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ange weights (M3, #78) Adds four test_that blocks to tests/testthat/test-stochastic-exposure.R covering each link kernel under seconds-scale weights, the degree-denominator fix, and zero-weight self-loop handling. Small code changes in R/stats.R: (1) warn when stochastic mode sees post-kernel weights outside [0, 1] -- the sampler silently saturated before; (2) denominator now counts non-zero-weight neighbours instead of every stored entry, so link kernels that zero out some edges no longer inflate the normaliser. No NAMESPACE / Rd changes. 652 tests pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Drop the dual signature for user-supplied link_fun. The helper now
always calls `link_fun(W@x)` with a single argument; parameters are
expected to be baked into the closure. `link_pars` remains relevant
only for the named kernels ("linear", "sigmoid", "wells-riley").
Simpler API, simpler docs, simpler tests.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds adoption_model = c("threshold", "logit") and adoption_pars
arguments to rdiffnet(). In logit mode, node i adopts at step t with
probability plogis(beta0 + beta_expo * exposure_i), drawn from
runif() each step. Threshold stays the default so fixed-seed calls
that omit the new argument remain bit-identical.
15 new tests cover backward compatibility, parameter validation,
saturation / suppression extremes, and multi-behaviour runs. Full
suite: 665 pass, 0 fail.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #78.
This draft PR tracks the implementation of epidemiological analysis capabilities in
netdiffuseR, addressing the four gaps identified in the internal gap report:tod) / reinfection episodes.stochastic-transmissionbranch, now integrated here).This branch starts from
masterand has already integrated two upstream feature branches:issue-75-epigames-dynamic-attrs— dynamic behavioral attributes for Epigames.stochastic-transmission—mode = "stochastic"forexposure()/rdiffnet().No new dependencies will be added to
DESCRIPTION.Implementation milestones
\$todslot,\$transmissionslot, validators, coercionsR/diffnet-class.r,R/adjmat.r, newR/transmission.Rlink_funinexposure()R/stats.Rtests/testthat/adoption_model = \"logit\"inrdiffnet()R/rdiffnet.rR/epi_metrics.Rhazard_rate(),plot_adopters()under\$todR/stats.R,R/diffnet-methods.rrepr_number()+ plot methodR/epi_metrics.Rhistories.csv → \$transmissiondata-raw/vignettes/epidemiological-analysis.Rmdtests/testthat/,.github/workflows/