CDCgov / ww-inference-model

An in-development R package and a Bayesian hierarchical model jointly fitting multiple "local" wastewater data streams and "global" case count data to produce nowcasts and forecasts of both observations
https://cdcgov.github.io/ww-inference-model/
Apache License 2.0
16 stars 2 forks source link

Hot fix validate pmf #191

Closed kaitejohnson closed 2 weeks ago

kaitejohnson commented 2 weeks ago

This PR does two things, one which is necessary another which may be up for discussion but does appear to be necessary if we are passing in long pmfs through a config...

  1. Fix the validate_pmf() function. all.equal() needs to be wrapped in isTRUE() because it returns either TRUE or a character with difference (alternatively we could use that error message here, but I like our custom one). https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/all.equal
  2. Adds a test so that we catch something like this next time

The up for debate thing is that:

  1. Adjusting the tolerance. I loaded from the package data and passed to the config and I think passing things around leads to rounding error, so the long infection to hospital admissions delay has a difference of just above 1e-7. I think we should be a bit more flexible with this given we are setting this up for people to pass in delays via a config.

Open to other suggestions e.g. for the pipeline we could one off load the rda from the wwinference package, use the package default, or compute directly but in general I think we want the wwinference package to allow users to specify via a config a long delay so tolerance can be a bit higher IMO.

github-actions[bot] commented 2 weeks ago

Thank you for your contribution, @kaitejohnson :rocket:! Your page is ready to preview here