Skip to content
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

Rename estimate_reporting() to estimate_ascertainment() #66

Merged
merged 5 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by roxygen2: do not edit by hand

S3method(prepare_data,incidence2)
export(estimate_reporting)
export(estimate_ascertainment)
export(estimate_rolling)
export(estimate_static)
export(estimate_time_varying)
Expand Down
34 changes: 19 additions & 15 deletions R/estimate_reporting.R → R/estimate_ascertainment.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#' time-period
#'
#' @return A data.frame containing the MLE estimate and 95% confidence interval
#' of the corrected severity
#' of the corrected severity, named "ascertainment_me" (for the central estimate
#' ), and "ascertainment_lo" and "ascertainment_hi" for the lower and upper
#' interval limits.
#' @export
#'
#' @examples
Expand All @@ -48,7 +50,7 @@
#' author = "Linton_etal"
#' )
#'
#' estimate_reporting(
#' estimate_ascertainment(
#' data = df_covid_uk,
#' epi_dist = onset_to_death_covid,
#' type = "varying",
Expand All @@ -59,15 +61,17 @@
#' max_date = "2020-06-30"
#' )
#'
estimate_reporting <- function(data,
epi_dist = NULL,
type = c("static", "varying"),
severity_baseline = 0.014,
burn_in_value = get_default_burn_in(epi_dist),
smooth_inputs = FALSE,
smoothing_window = 1,
correct_for_delays = FALSE,
max_date = NULL) {
estimate_ascertainment <- function(data,
epi_dist = NULL,
type = c("static", "varying"),
severity_baseline = 0.014,
burn_in_value = get_default_burn_in(
epi_dist
),
smooth_inputs = FALSE,
smoothing_window = 1,
correct_for_delays = FALSE,
max_date = NULL) {
# input checking
checkmate::assert_data_frame(data)
checkmate::assert_names(
Expand Down Expand Up @@ -140,14 +144,14 @@ estimate_reporting <- function(data,
)

# re-convert to data.frame from list
# here, the estimate called "severity_me" translates to "reporting_me"
# and the estimate "severity_hi" translates to "reporting_lo"
# here, the estimate called "severity_me" translates to "ascertainment_me"
# and the estimate "severity_hi" translates to "ascertainment_lo"
# TODO: check if this is correct
df_out <- as.data.frame(df_out,
row.names = NULL,
col.names = c("reporting_me", "reporting_hi", "reporting_lo")
col.names = c("ascertainment_me", "ascertainment_hi", "ascertainment_lo")
)

# return data with columns in correct order
df_out[, c("reporting_me", "reporting_lo", "reporting_hi")]
df_out[, c("ascertainment_me", "ascertainment_lo", "ascertainment_hi")]
}
14 changes: 8 additions & 6 deletions man/estimate_reporting.Rd → man/estimate_ascertainment.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions tests/testthat/_snaps/estimate_ascertainment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# `estimate_ascertainment`: Basic expectations for static method

Code
ascertainment_estimate
Output
ascertainment_me ascertainment_lo ascertainment_hi
1 0.01465812 0.01432405 0.01519944

# `estimate_ascertainment`: Correct for delays for static method

Code
ascertainment_estimate
Output
ascertainment_me ascertainment_lo ascertainment_hi
1 0.01459854 0.014 0.01662708

# `estimate_ascertainment`: Smooth inputs for static method

Code
ascertainment_estimate
Output
ascertainment_me ascertainment_lo ascertainment_hi
1 0.01465812 0.01432405 0.01519944

# `estimate_ascertainment`: Automatic burn-in value

Code
ascertainment_estimate
Output
ascertainment_me ascertainment_lo ascertainment_hi
1 0.01465812 0.01432405 0.01519944

# `estimate_ascertainment`: Automatic burn-in value for static

Code
ascertainment_estimate
Output
ascertainment_me ascertainment_lo ascertainment_hi
1 0.01465812 0.01432405 0.01519944

# `estimate_ascertainment`: Basic expectations for time-varying

Code
ascertainment_estimate
Output
ascertainment_me ascertainment_lo ascertainment_hi
1 0.014 0.014 0.56

48 changes: 0 additions & 48 deletions tests/testthat/_snaps/estimate_reporting.md

This file was deleted.

Loading