Skip to content

Dev update epinow2 vers latest#351

Draft
micahwiesner67 wants to merge 24 commits intomainfrom
dev-update_epinow2_vers_latest
Draft

Dev update epinow2 vers latest#351
micahwiesner67 wants to merge 24 commits intomainfrom
dev-update_epinow2_vers_latest

Conversation

@micahwiesner67
Copy link
Copy Markdown
Collaborator

@micahwiesner67 micahwiesner67 commented Aug 14, 2025

Draft PR for CI purposes. Between the current version of EpiNow2 (1.6.1) and the latest non-dev version (1.7.1) some of the mechanics of how gp or horizon options are input has changed and thus code in the R/fit_model.R file needs to be adjusted accordingly. The documentation for EpiNow2 can help with this.

Initially, test-write_output.R had the most failing tests. This was due to the process_quantiles function now outputting an additional two columns (accumulate, breakpoint) which are not expected in the test-write_output.R tests. Also these columns contain NAs forcing other tests to also fail out.

Currently, we are passing all unit tests. An initial test run between current version (1.6.1) and latest version (1.7.1) shows slightly different results and version 1.7.1 shows diagnostic flags being triggered.
Update (8/15/25) this was partially improved by adjusting the rt prior sd to 1.0 from 0.2 (these are suggested defaults from EpiNow2 package)

Accomplished:

Refactored to address issue in rt_opts
Refactored to accomodate filter_leading_zeros new format in latest version
Refactored forecast / horizon syntax
Included "breakpoint" and "accumulate" (these are new columns added in 1.7.1.9000 dev version) in the process_samples and process_quantiles expected columns tests in test-write_output.R. Also necessary to remove these columns before testing columns for NAs as these populate with NAs
Adjusted adapt_delta in gostic_fit to lower p_divergent under diagnostic_flag; Also, adjusted rt prior mean to 2 for gostic_toy_rt
Switched confirm column in setup.R to use obs_incidence instead of incidence
Notes:
Default alpha_sd has been changed between versions (from 0.05 to 0.01)

Update (7/11/25): I diffed the fit.R file between version 1.6.1 and 1.7.1 and found few differences. I also diffed the opts.R file between the two versions and there are many areas of code which have been refactored, but none jump out to me as changing any default model parameters

Update (7/15/25):
Diagnostics extracted from a fit on the gostic_toy_rt data yields very similar results.
image

image
Diagnostics from re-running on 1.7.1 w/ new priors vs. 1.6.1 with old priors still shows 1.7.1 has more divergences (6 state:disease pairs, compared to 3 with 1.6.1s setup). After analyzing these diagnostic files, none of the state:disease pairs with divergences have other diagnostic_flags (none have high_rhat or exceeded max_treedepths)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Aug 14, 2025

Thank you for your contribution @micahwiesner67 🚀! Your pkgdown-site is ready for download 👉 here 👈!
(The artifact expires on 2026-02-16T15:20:14Z. You can re-generate it by re-running the workflow here.)

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.

2 participants