Add SEIR network model using epiworldR#5
Conversation
Co-authored-by: gvegayon <893619+gvegayon@users.noreply.github.com>
| # Check if epiworldR is available | ||
| epiworld_available <- requireNamespace("epiworldR", quietly = TRUE) | ||
|
|
||
| if (!epiworld_available) { | ||
| cat("Note: epiworldR package not available. Using simulation for demonstration.\n") | ||
| cat("To install epiworldR: remotes::install_github('UofUEpiBio/epiworldR')\n\n") | ||
| } |
There was a problem hiding this comment.
You can assume that the package is available. Any package added (R or Python) should be available at the model of compiling.
There was a problem hiding this comment.
Removed the package availability check and fallback code. The example now assumes epiworldR is available as requested. (80e67f0)
| print(paste("Population size:", n_population)) | ||
| print(paste("Average degree:", avg_degree)) | ||
| print(paste("Transmission probability:", round(transmission_prob, 4))) | ||
| print(paste("Progression rate (σ):", round(progression_rate, 4))) | ||
| print(paste("Recovery rate (γ):", round(recovery_rate, 4))) |
There was a problem hiding this comment.
Generally, messages should be printed using message() instead of print().
There was a problem hiding this comment.
Changed print() statements to message() throughout the code for better R practices. (80e67f0)
| } else { | ||
| # Simulate SEIR dynamics for demonstration using a simplified network model | ||
| cat("Simulating SEIR dynamics (epiworldR not available)\n") |
There was a problem hiding this comment.
Again, assume whatever software we are using is available.
There was a problem hiding this comment.
Removed the entire fallback simulation code and simplified the implementation to assume epiworldR is always available. (80e67f0)
| # Note: epiworldR installation from GitHub requires network access | ||
| # and may need to be installed manually in development environments | ||
| # For this example, we use base R packages only for maximum compatibility |
There was a problem hiding this comment.
The epiworldR package can be installed from CRAN. For the moment, don't worry too much if you can't build the container. Let's have the CI testing it.
There was a problem hiding this comment.
Added epiworldR and igraph installation to the Containerfile using install2.r. Left CI to test the build as suggested. (80e67f0)
Co-authored-by: gvegayon <893619+gvegayon@users.noreply.github.com>
All feedback has been addressed in commit 80e67f0:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
This PR implements a comprehensive SEIR (Susceptible-Exposed-Infected-Recovered) epidemiological model example using the epiworldR package in R, addressing the request for network-based epidemiological modeling examples.
What's Added
01-epiworldr_seir_network/containing a complete Quarto documentModel Characteristics
Technical Implementation
The example follows the repository's established structure with:
message()for output instead ofprint()The devcontainer has been updated to include epiworldR and igraph installation, and the main README now includes this as the first example in the repository.
Testing
Fixes #4.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.