-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate adjust_infection_to_report()
, report_cases()
, and sample_approx_dist()
#597
Conversation
adjust_infection_to_report()
, report_cases()
, and a
djust_infection_reports()`adjust_infection_to_report()
, report_cases()
, and adjust_infection_reports()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff.
I think it would be good to point the user to how they would simulate_secondary
to reproduce the functionality of the deprecated functions - but that should wait until #504 is merged as otherwise the syntax will have to be updated again.
I'd suggest to address the comments/issues and then convert to a draft PR to revisit after #504 is merged.
Thanks for the review. I'll convert the PR to a draft now until #504 is merged. |
f5ab06c
to
c25965c
Compare
@jamesmbaazam I've now merged main which seems to pass tests. I think once we add some guidance to the user this is good to go. Not quite sure where this best lives but here is some code for cases <- data.table::copy(example_confirmed)[, cases := as.integer(confirm)]
delay_def <- lognorm_dist_def(
mean = 5, mean_sd = 1, sd = 3, sd_sd = 1,
max_value = 30, samples = 1, to_log = TRUE
)
report <- adjust_infection_to_report(
cases, delay_defs = delay, reporting_model = function(n) rpois(length(n), n)
)
print(report)
cases <- data.table::copy(example_confirmed)[, primary := as.integer(confirm)]
uncertain_delay <- LogNormal(mean = Normal(5, 1), sd = Normal(3, 1), max = 30)
delay <- fix_dist(uncertain_delay, strategy = "sample")
report <- simulate_secondary(
cases, delays = delay_opts(delay), obs = obs_opts(family = "poisson")
)
print(report) and cases <- example_confirmed[1:40]
cases <- cases[, cases := as.integer(confirm)]
cases <- cases[, confirm := NULL][, sample := 1]
reported_cases <- report_cases(
case_estimates = cases,
delays = delay_opts(example_incubation_period + example_reporting_delay),
type = "sample"
)
print(reported_cases$samples)
cases <- example_confirmed[1:40]
cases <- cases[, primary := as.integer(confirm)]
report <- simulate_secondary(
cases,
delays = delay_opts(
fix_dist(example_incubation_period + example_reporting_delay)
),
obs = obs_opts(family = "poisson")
)
print(report) |
We could add these to the example files of the deprecated functions and add a details argument to |
…simulate_secondary
adjust_infection_to_report()
, report_cases()
, and adjust_infection_reports()
adjust_infection_to_report()
, report_cases()
, and sample_approx_dist()
Great work! |
…le_approx_dist()` (#597) * Deprecate adjust_infection_to_report() * Deprecate sample_approx_dist() * Deprecate report_cases() * Generate .Rd file * Add NEWS item * Fix wrong function name in NEWS * Linting: turn off missing_argument_linter for deprecation warning * Linting: use file.path() to construct paths instead of paste0. * Remove unnecessary nolint tags * Remove trailing comma * Add more details to deprecation warning * Assign details argument explicitly * Add pointers to replacement functions in the deprecation warnings * Revise example in report_cases to show use of simulate_secondary() * Refer to the right function in warning message * Revise examples in adjust_infection_to_reports to demonstrate use of simulate_secondary * Remove trailing whitespace --------- Co-authored-by: Sebastian Funk <[email protected]>
…le_approx_dist()` (#597) * Deprecate adjust_infection_to_report() * Deprecate sample_approx_dist() * Deprecate report_cases() * Generate .Rd file * Add NEWS item * Fix wrong function name in NEWS * Linting: turn off missing_argument_linter for deprecation warning * Linting: use file.path() to construct paths instead of paste0. * Remove unnecessary nolint tags * Remove trailing comma * Add more details to deprecation warning * Assign details argument explicitly * Add pointers to replacement functions in the deprecation warnings * Revise example in report_cases to show use of simulate_secondary() * Refer to the right function in warning message * Revise examples in adjust_infection_to_reports to demonstrate use of simulate_secondary * Remove trailing whitespace --------- Co-authored-by: Sebastian Funk <[email protected]>
Description
This PR closes #520.
The functions
sample_approx_dist()
,report_cases()
, andadjust_infection_reports()
have been deprecated as the functionality they provide can now be achieved withsimulate_secondary()
.Initial submission checklist
devtools::test()
anddevtools::check()
).devtools::document()
).lintr::lint_package()
).After the initial Pull Request