Recent Releases of macpan2
macpan2 - COVID-19 Data
Data release
Data was sourced and prepped using the following script.
``` library(dplyr) library(tidyr)
Data Sources
covidcanadaurl <- "https://wzmli.github.io/COVID19-Canada/gitpush/clean.Rout.csv" googleurl <- "https://www.gstatic.com/covid19/mobility/GlobalMobilityReport.csv" appleurl <- "https://raw.githubusercontent.com/ActiveConclusion/COVID19mobility/master/apple_reports/applemobilitytrends.csv"
covidca <- read.csv(covidcanadaurl) apple <- read.csv(appleurl,check.names=FALSE) google <- read.csv(googleurl) macpan1.5calibration <- readRDS(url("https://github.com/canmod/macpan2/raw/a06e9195d93dc4fa22a9d747607eecb003546144/misc/experiments/wastewater/macpan1-5comparisoninfo.RDS"))
Data Prep
covidon <- (covidca %>% filter(Province=="ON") %>% select(Province,Date,Hospitalization,ICU,Ventilator,deceased,newConfirmations,newTests) %>% mutate(newDeaths=c(NA,diff(deceased)) ## ON hosp includes ICU, macpanbase model uses only acute care , Hospitalization=Hospitalization-ICU) %>% select(-deceased) %>% pivotlonger(namesto="var",-c(Date,Province)) %>% setNames(tolower(names(.))) %>% ungroup() %>% mutate(var=ifelse(var=="newConfirmations","report",if_else(var=="newDeaths","death",var))) )
mobility = ( (apple %>% filter(alternativename == "ON", transportationtype == "driving") %>% pivotlonger(cols=-c("geotype","region","transportationtype","alternativename","sub-region","country") , namesto="date",namestransform = as.Date) # create relative percent change (to match google data) %>% mutate(value = value - 100) %>% select(date, value) ) %>% fulljoin(google %>% filter(iso31662code == "CA-ON") %>% mutate(date = as.Date(date)) %>% select(date,startswith("retailandrecreation"),startswith("workplaces")) ) %>% arrange(date) # compute 7 day moving average %>% mutate(across(where(is.numeric),~ stats::filter(.x, filter = rep(1/7, 7), sides = 2))) # scale to have pre-pandemic value of 1 %>% mutate(across(where(is.numeric), ~ 1 + (.x/100))) # compute average of all mobility values %>% groupby(date) %>% summarize(mobilityind = mean(c_across(where(is.numeric)),na.rm = TRUE)) %>% ungroup() %>% na.omit() )
combine covid data from all sources
covidon = (covidon %>% mutate(date = as.Date(date)) # add wastewater data (reported incidence is already included in covidon) %>% bindrows((macpan1.5calibration$obs %>% filter(var == "W"))) # add mobility data %>% bindrows((mobility %>% rename(value = mobilityind ) %>% mutate(var = "mobilityindex"))) )
remove observed data from RDS object (this is included in covid_on), remaining elements are from macpan 1.5 calibration
covidonmacpan1.5calibration = within(macpan1.5calibration, rm(obs))
Final Datasets:
covid_on
covidwwmacpan1.5_calibration
```
- R
Published by jfree-man over 1 year ago
macpan2 - New approach
In this release we take a step towards making macpan2 less experimental.
- R
Published by stevencarlislewalker about 2 years ago
macpan2 - Simulation performance and validity messaging
- Optimize C++ simulation history storage by avoiding unnecessary allocations
- Use state and flow names in expression inserters
- Chattier validity checking
- Radial basis functions
- New starter models (thanks @mayaearn and @Flynn-Primrose )
macpan-base-- re-implementation of the McMaster group's COVID-19 model inmacpan2ww-- wastewater model (doesn't yet have a readme)- new readme for and clean up of previous models
- Report what expression broke on the C++ side
- Developer tools for switching between different C++ files and working directories
- Package reference organization cleanup (thanks @bbolker )
- Time-varying parameters vignette
- R
Published by stevencarlislewalker over 2 years ago
macpan2 - Optimization and simulation model updating
- Interface for optimization of TMB simulation objects
- TMB simulation model updating with caching
- Parameter transformations
- Get initial values of matrices in TMB simulation objects
- State and flow variable names can be used in expressions in some contexts
- Example model indexing (thank you @bbolker!)
- Engine function
rbind_timedefaults to row binding the full simulation history - Fix bug when the entire model has no inflows or no outflows
- Fix bugs in symbolic R-side manipulation of expressions
- Fix previously broken
argument_dotsoption in model definition files (thank you @Flynn-Primrose )
- R
Published by stevencarlislewalker almost 3 years ago
macpan2 - Initial Release
Gotta start somewhere!
- R
Published by stevencarlislewalker almost 3 years ago