diff --git a/DESCRIPTION b/DESCRIPTION index 7b188c601..22f69d506 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -10,7 +10,11 @@ Authors@R: person(given = "Sam Abbott", role = c("aut"), email = "contact@samabbott.co.uk", - comment = c(ORCID = "0000-0001-8057-8037"))) + comment = c(ORCID = "0000-0001-8057-8037")), + person(given = "Adam Howes", + role = c("aut"), + email = "adamthowes@gmail.com", + comment = c(ORCID = "0000-0003-2386-4031"))) Description: Understanding and accurately estimating epidemiological delay distributions is important for public health policy. These estimates directly influence epidemic situational awareness, control strategies, and resource allocation. In this package, we provide methods to address the key challenges in estimating these distributions, including truncation, interval censoring, and dynamical biases. Despite their importance, these issues are frequently overlooked, often resulting in biased conclusions. diff --git a/R/fitting-and-postprocessing.R b/R/fitting-and-postprocessing.R index 800c7d04d..be1531bbb 100644 --- a/R/fitting-and-postprocessing.R +++ b/R/fitting-and-postprocessing.R @@ -204,7 +204,7 @@ primary_censoring_bias_correction <- function(draws) { draws <- data.table::copy(draws) draws[, mean := mean - runif(.N, min = 0, max = 1)] draws[, meanlog := log(mean^2 / sqrt(sd^2 + mean^2))] - draw[, sdlog := sqrt(log(1 + (sd^2 / mean^2)))] + draws[, sdlog := sqrt(log(1 + (sd^2 / mean^2)))] return(draws[]) } diff --git a/R/observe.R b/R/observe.R index 28f751f23..7df01e621 100644 --- a/R/observe.R +++ b/R/observe.R @@ -82,7 +82,7 @@ pad_zero <- function(data, pad = 1e-3) { #' @export drop_zero <- function(data) { data <- data.table::copy(data) - data[delay_daily != 0] + data <- data[delay_daily != 0] return(data) } diff --git a/R/plot-helpers.R b/R/plot-helpers.R index 437392aab..3ef5e9022 100644 --- a/R/plot-helpers.R +++ b/R/plot-helpers.R @@ -9,7 +9,7 @@ calculate_cohort_mean <- function(data, type = c("cohort", "cumulative"), mean = mean(delay_daily), n = .N), by = c("ptime_daily", by)] - out[order(rank(ptime_daily))] + out <- out[order(rank(ptime_daily))] if (type == "cumulative") { out[, mean := cumsum(mean * n) / cumsum(n), by = by] diff --git a/R/preprocess.R b/R/preprocess.R index df6c38055..8a21e720d 100644 --- a/R/preprocess.R +++ b/R/preprocess.R @@ -142,7 +142,7 @@ event_to_incidence <- function(data, by = c()) { dd <- data.table::copy(data) dd[, .(cases = .N), by = c("ptime_daily", by)] - dd[order(ptime_daily)] + dd <- dd[order(ptime_daily)] setnames(dd, old = c("ptime_daily"), new = c("time"))