-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added unit test for as_epidist from issue #327
- Loading branch information
1 parent
faef96e
commit a190296
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
test_that("as_epidist works for infectious period (issue #327)", { | ||
# {epireview} is not a dependency so only run if already on system | ||
skip_if_not_installed("epireview") | ||
# suppress warning and message about loading data | ||
ebola <- suppressWarnings( | ||
suppressMessages( | ||
epireview::load_epidata("ebola") | ||
) | ||
) | ||
ebola_params <- ebola$params | ||
ebola_infectiousness <- ebola_params[ | ||
ebola_params$parameter_type == "Human delay - infectious period", | ||
] | ||
ebola_infectiousness <- ebola_infectiousness[ | ||
ebola_infectiousness$article_label == "Lau 2017 (1)", | ||
] | ||
# suppress warning and message about citation | ||
ebola_infectiousness_epidist <- suppressWarnings( | ||
suppressMessages( | ||
as_epidist(ebola_infectiousness) | ||
) | ||
) | ||
expect_s3_class(ebola_infectiousness_epidist, class = "epidist") | ||
# Lau 2017 has information to parameterise an exponential distribution | ||
expect_s3_class( | ||
ebola_infectiousness_epidist$prob_dist, | ||
class = "distribution" | ||
) | ||
# populate mean summary statistics | ||
expect_true(all(!is.na(ebola_infectiousness_epidist$summary_stats[1:3]))) | ||
}) |