Skip to content

Epinowcast 0.2.1

Compare
Choose a tag to compare
@seabbs seabbs released this 02 May 10:45
· 103 commits to main since this release

In this release, we focused on improving the internal code structure, documentation, and development infrastructure of the package to make it easier to maintain and extend functionality in the future. We also fixed a number of bugs and made some minor improvements to the interface. These changes included extending test and documentation coverage across all package functions, improving internal data checking and internalization, and removing some deprecated functions.

While these changes are not expected to impact most users, we recommend that all users upgrade to this version. We also suggest that users who have fitted models with both random effects and random walks should refit these models and compare the output to previous fits in order to understand the impact of a bug in the specification of these models that was fixed in this release.

This release lays the groundwork for planned features in 0.3.0 and 0.4.0 including: support for non-parametric delays, non-daily data with a non-daily process model (i.e. weekly data with a weekly process model), additional flexibility specifying generation times and latent reporting delays, improved case studies, and adding support for forecasting.

Full details on the changes in this release can be found in the following sections or in the GitHub release notes. To see the development timeline of this release see the 0.2.1 project.

Contributors

@adrian-lison, @Bisaloo, @pearsonca, @FelixGuenther, @Lnrivas, @seabbs, @sbfnk, and @jhellewell14 made code contributions to this release.

@pearsonca, @Bisaloo, @adrian-lison, and @seabbs reviewed pull requests for this release.

@Gulfa, @WardBrian, @parkws3, @adrian-lison, @Bisaloo, @pearsonca, @FelixGuenther, @Lnrivas, @seabbs, @sbfnk and @jhellewell14 reported bugs, made suggestions, or contributed to discussions that led to improvements in this release.

Potentially breaking changes

  • enw_add_pooling_effect(): replaced string argument with ... argument, to enable passing arbitrary arguments to the finder_fn argument. The same general usage is supported, but now e.g. the default argument to supply is prefix = "somevalue" vs string = "somevalue" and argument positions have changed. This function is primarily for internal use and we expect only a small subset of advanced users who are creating models outside the currently supported formula interface to be impacted See #222 by @pearsonca and reviewed by @seabbs.
  • enw_dates_to_factors(): Deprecated and removed as no longer needed. We expect this function had little to no external use and so there should be little impact on users. See #216 by @seabbs and reviewed by @adrian-lison.

Bugs

  • Fixed a bug first highlighted by @Gulfa in #166 and localised during the investigation for #223 where random effects and random walks were being improperly constructed in enw_formula() so that their variances parameters were not shared between the correct parameters when used together. This only impacts models that used formulas with both random effects and random walks and for these models appears to have led to increased run-times, fitting issues, and potentially unreliable posterior estimates but to have had a less significant impact on actual nowcasts. We suggest refitting these models and comparing the output to previous fits in order to understand the impact on your usage. See #228 by @seabbs and self-reviewed.
  • Fixed a bug in enw_replace_priors() where the function could not deal with epinowcast summarised posterior estimates due to the new use of the pillar class. Added tests to catch if this issue reoccurs in the future. See #228 by @seabbs and self-reviewed.
  • Fixed an issue (#198) with the interface for scoringutils. For an unknown reason our example data contained pillar classes (likely due to an upstream change). This caused an issue with internal scoringutils that was using implicit type conversion (see here). See #201 by @seabbs and reviewed by @pearsonca.
  • Fixed a bug in enw_plot_quantiles() where the documented default for log was FALSE but the actual default was TRUE. See #209 by @seabbs and self-reviewed.
  • Fixed a bug in enw_expectation() where when models were specified with zero intercept a initial condition was still being specified for the intercept of the growth rate (expr_r_int, #246). This was not flagged as an issue by cmdstan 2.31.0 but as of cmdstan 2.32.0, due to improvements in how initial conditions were being read in (stan-dev/stan#3182), it throws an error causing models to fail. Solution suggested by @WardBrian, implemented in #255 by @seabbs, and reviewed by @pearsonca.

Depreciations

  • enw_incidence_to_cumulative(): Deprecated with a warning in favour of enw_add_cumulative(). This renaming is to better reflect the function's purpose. enw_incidence_to_cumulative() will be removed in 0.3.0. See #247 by @seabbs and reviewed by @pearsonca.
  • enw_cumulative_to_incidence(): Deprecated with a warning in favour of enw_add_incidence(). This renaming is to better reflect the function's purpose. enw_cumulative_to_incidence() will be removed in 0.3.0. See #247 by @seabbs and reviewed by @pearsonca.

Package

  • Fixed some typos in README.md, NEWS.md, the model.Rmd vignette and convolution_matrix() documentation. The WORDLIST used by spelling has also been updated by eliminate false positives. See #221 by @Bisaloo and reviewed by @seabbs and @adrian-lison.
  • Added more non-default linters in .lintr configuration file. This file is used when lintr::lint_package() is run or in the new lint-changed-files.yaml GitHub Actions workflow. See #220 by @Bisaloo and reviewed by @pearsonca and @seabbs.
  • Switched to the lint-changed-files.yaml GitHub Actions workflow instead of the regular lint.yaml to avoid annotations unrelated to the changes made in the PR. See #220 by @Bisaloo and reviewed by @pearsonca and @seabbs.
  • Added tests for summary.epinowcast() and plot.epinowcast() methods. See #209 by @seabbs and reviewed by @pearsonca.
  • Added tests for enw_plot_obs() where not otherwise covered by plot.epinowcast() tests. See #209 by @seabbs and reviewed by @pearsonca.
  • Refactored to consolidate data checking and internalization into a single internal function coerce_dt(), addressing issues #242, #241, #214, and #149. This eliminates the need for add_group(), check_by(), and check_dates() (and associated documentation, tests - some of these were intermediate capabilities introduced within this minor version; see #208) which have all been removed. Also starts to enable internal versus external use of exposed methods with the copy = ... argument. See #239 by @pearsonca, reviewed by @seabbs.
  • Resolved the spurious test warnings for snapshot tests which were linked to unstated formatting requirements. See #208 by @seabbs and reviewed by @pearsonca.
  • Removed unused internal plot helpers. See #217 by @seabbs and reviewed by @adrian-lison.
  • Added tests for all internal check_ functions used to check inputs. See #217 by @seabbs and reviewed by @adrian-lison.
  • Removed the problematic double specification of default arguments for target_date in enw_metadata() as flagged in #212 by @pearsonca using formals() to instead detect the default values from the function specification. See #232 by @seabbs and self-reviewed.
  • In the words of Jenny Bryan: "there is no else, there is only if." Having else after return() of stop() increases the number of branches in the code, which makes it harder to read. It also translates into a higher cyclomatic complexity. We have removed all else statements after return() and stop() in the package. See #229 by @Bisaloo and reviewed by @seabbs.
  • Removed the internal definition of no_contrasts in enw_formula() as this was unused. Identified by @Bisaloo in #220 and raised in #223. See #228 by @seabbs and self-reviewed.
  • Added tests for enw_replace_priors() to check that it can handle epinowcast summarised posterior estimates. See #228 by @seabbs and self-reviewed.
  • Added a prefix (rw__) in enw_formula() and construct_rw() to indicate when a random effect variance is a random walk versus a random effect. See #228 by @seabbs and reviewed by.
  • Added support for using the same variable as both a random effect and a random walk. In most settings this is not advised. See #228 by @seabbs and self-reviewed.
  • Added an error message to construct_rw() when a random walk is specified for a variable that is not a numeric variable. See #228 by @seabbs and self-reviewed.
  • Added support for preprocessing and model fitting benchmarking using touchstone based on the implementation in EpiNow2 by @sbfnk. See #200 by @seabbs, @adrian-lison, @sbfnk, and self-reviewed.
  • Added a complete set of data converters to map between line list (i.e. each row is a case) and count data (i.e incidence and cumulative counts by reference and report date). In particular, this will help workflows where individual line list data is available as it can now be formatted ready for preprocessing using a single call to enw_linelist_to_incidence() which previously took several steps. See #247 by @seabbs and @jhellewell14 and reviewed by @pearsonca.
  • Dropped the use of the develop branch for development versions of the package. This change was discussed in #250 with the major motivator being that since the introduction of release only builds to R Universe we no longer need to have a stable main branch of GitHub to control our releases. See #256 by @seabbs and reviewed by @Bisaloo and @pearsonca.
  • Cleaned enw_formula_as_data_list() to better align with DRY principles. See #245 by @Lnrivas, reviewed by @pearsonca, @Bisaloo, and @seabbs.

Documentation

  • Added examples for summary.epinowcast() and plot.epinowcast() methods to the documentation. See #209 by @seabbs and reviewed by @pearsonca.
  • Extended documentation, examples, and tests for internal, preprocessing, and postprocessing functions. See #208 by @seabbs and reviewed by @pearsonca.
  • Added examples for all plot functions. See #209 by @seabbs and reviewed by @pearsonca.
  • Added an example for enw_replace_priors() showing how to use a nowcast posterior to update the default priors. See #228 by @seabbs and self-reviewed.
  • Updated the package citation and documentation to include all new authors as of the 0.2.1 release and to use the recommended bibentry() approach. See #236 and #237 by @seabbs and reviewed by @Bisaloo.
  • Added a package style guide (STYLE_GUIDE.md) to document the style conventions used in the package. See #64 by @seabbs and reviewed by @pearsonca and @Bisaloo.
  • Improved and extended documentation of discretized, parametric delay distributions. Changed structure of package vignettes (into two categories, model definition vignettes and case study vignettes). See #265 by @FelixGuenther and @adrian-lison and reviewed by @seabbs.
  • Improved and extended the README quick start after feedback from @parksw3 in #260. See #267 by @seabbs and reviewed by @adrian-lison and @parksw3.

Pull requests linked to this release

  • Fix linewidth usage in ggplot2 by @seabbs in #197
  • Fix linewidth in ggplot2 by @seabbs in #202
  • Force numeric for prediction and true value when scoring by @seabbs in #201
  • Add examples and tests for epinowcast methods and uncovered plots by @seabbs in #209
  • Extend documentation and tests for pre and post processing by @seabbs in #208
  • Depreciate enw_dates_to_factors by @seabbs in #216
  • Add unit tests for check_ functions and remove internal plots by @seabbs in #217
  • draft change: add_pooling_effect to more generic finder_fn by @pearsonca in #222
  • Streamline and tighten lintr checks by @Bisaloo in #220
  • Fix typos and update WORDLIST by @Bisaloo in #221
  • Disable lint workflow on pushes by @Bisaloo in #226
  • Add @Bisaloo as an author and @pratikunterwegs as a contributor by @seabbs in #225
  • Standardise use of c() for DESCRIPTION by @seabbs in #227
  • enw_metadata() target_date default be detected from the function specification by @seabbs in #232
  • Do not use else after stop() by @Bisaloo in #229
  • Random effects and random walks (issues #223 and #166) by @seabbs in #228
  • Updates citation file with new authors by @seabbs in #236
  • Update CITATION to use bibentry by @seabbs in #237
  • Seabbs/issue199 by @seabbs in #200
  • Issue 149: Duplicate coercion to copy datatable by @pearsonca in #239
  • Update issue templates by @seabbs in #251
  • Update PULL_REQUEST_TEMPLATE.md by @seabbs in #253
  • Issue 144: Data converters by @seabbs in #247
  • Issue 246: Correct initial conditions for r intercept + revert CI to latest cmdstan by @seabbs in #255
  • Issue 250: Ground work to shift development to main from develop by @seabbs in #256
  • Issue 250: Move development version to main by @seabbs in #257
  • Issue 245: Cleaning enw_formula_as_data_list() to align with DRY principles (#245) by @Lnrivas in #254
  • Issue 211: Style guide first draft by @seabbs in #264
  • Issue 129: Better document delay distribution modeling by @adrian-lison in #265
  • Issue 260: Refactoring the README by @seabbs in #267
  • 0.2.1 Release by @seabbs in #269
  • Review 0.2.1 by @seabbs in #270

New Contributors

Full Changelog: v0.2.0...v0.2.1