Skip to content

Fix Poisson approximation bug #179

@adamkucharski

Description

@adamkucharski

The below code generates the following error statement:

# Load Diamond Princess Data
covid_data <- read.csv("diamond_princess.csv")
covid_data$date <- as.Date(covid_data$date)

# Truncate real-time data to end Feb
covid_data_rt <- covid_data |> filter(date<"2020-03-01")

# Get onset-to-death distribution
onset_to_death_period_in <-
  epiparameter::epiparameter_db(
    disease = "covid",
    epi_name = "onset to death",
    single_epiparameter = TRUE
  )

# Calculate CFR and 95% CI
cfr_estimate <- cfr_rolling(
  data = covid_data_rt,
  delay_density = function(x) density(onset_to_death_period_in, x)
)
Some daily ratios of total deaths to total cases with known outcome are below 0.01%: some CFR estimates may be unreliable.FALSE
Error in if (total_cases < poisson_threshold || (p_mid >= 0.05)) { : 
  missing value where TRUE/FALSE needed

This suggests that the if statements may not be covering all edge cases currently. It may be worth considering removing all together given the limited efficiency benefits (see also issue #164 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions