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

Do not error when hosp_death_risk is NA without hospitalisation #144

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

joshwlambert
Copy link
Member

This PR addresses an issue whereby the sim_linelist() function would error when hosp_death_risk is NA and onset_to_death is specified as a delay distribution by the user (i.e. not NA). See example sim_linelist() call that would produce this error.

sim_linelist(
  contact_distribution = contact_distribution,
  infectious_period = infectious_period,
  onset_to_hosp = NA,
  onset_to_death = onset_to_death,
  onset_to_recovery = onset_to_recovery,
  hosp_risk = NA,
  hosp_death_risk = NA,
  non_hosp_death_risk = 0.3,
  prob_infection = 0.5
)

However, this is unwanted behaviour as in this parameterisation nobody in the simulation is hospitalised (onset_to_hosp = NA and hosp_risk = NA), so hosp_death_risk should be allowed to be NA. This PR resolves this by updating .cross_check_sim_input() to check whether hosp_risk is NA and if so not erroring.

Thanks to @CarmenTamayo for reporting this issue.

@joshwlambert joshwlambert merged commit a9daafe into main Jun 19, 2024
7 checks passed
@joshwlambert joshwlambert deleted the updt_cross_checking_input branch June 19, 2024 15:28
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

Successfully merging this pull request may close these issues.

1 participant