Skip to content

Fix Poisson approximation bug #179

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

Open
adamkucharski opened this issue Feb 6, 2025 · 1 comment
Open

Fix Poisson approximation bug #179

adamkucharski opened this issue Feb 6, 2025 · 1 comment

Comments

@adamkucharski
Copy link
Member

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 )

@CarmenTamayo
Copy link
Contributor

New related error message:

Error in if (any(is.infinite(p_mid_values) | p_mid_values < 1e-04)) { : missing value where TRUE/FALSE needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants