-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* remove unused test datasets * add option to plot additional plot data to plot_foi and plot_seromodel methods * add test for the plot_foi method of the visualization module * update documentation for plot_foi and plot_seromodel. Add new simulated dataset serodata_simD and add test simulated data serodata_simD.R * add test test_plot_foi * change simulated foi data plot in plot_foi from scattered to line
- Loading branch information
Showing
15 changed files
with
994 additions
and
151 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
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
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
898 changes: 898 additions & 0 deletions
898
tests/testthat/_snaps/plot_foi/plot-arrange-simdata-foi.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,51 @@ | ||
test_that("individual models", { | ||
# So far we are skipping tests on these platforms until | ||
# we find an efficient way to update rstan testthat snapshots on all of them | ||
skip_on_os(c("windows", "mac")) | ||
skip_on_ci() | ||
source("testing_utils.R") | ||
set.seed(1234) # For reproducibility | ||
|
||
library(devtools) | ||
library(dplyr) | ||
library(vdiffr) | ||
|
||
#----- Read and prepare data | ||
data("serodata_simD") | ||
simdata <- serodata_simD %>% prepare_serodata() | ||
no_transm <- 0.0000000001 | ||
big_outbreak <- 1.5 | ||
foi_sim <- c(rep(no_transm, 32), rep(big_outbreak, 3), rep(no_transm, 15)) # 1 epidemics | ||
|
||
|
||
#----- Run models | ||
models_to_run <- c("constant", | ||
"tv_normal", | ||
"tv_normal_log") | ||
models_list <- lapply(models_to_run, | ||
run_seromodel, | ||
serodata = simdata, | ||
n_iters = 1000) | ||
|
||
#----- Results visualisation | ||
size_text <- 6 | ||
max_lambda <- 1.55 | ||
constant_plot <- plot_seromodel(models_list[[1]], | ||
size_text = size_text, | ||
max_lambda = max_lambda, | ||
foi_sim = foi_sim) | ||
tv_normal_plot <- plot_seromodel(models_list[[2]], | ||
size_text = size_text, | ||
max_lambda = max_lambda, | ||
foi_sim = foi_sim) | ||
tv_normal_log_plot <- plot_seromodel(models_list[[3]], | ||
size_text = size_text, | ||
max_lambda = max_lambda, | ||
foi_sim = foi_sim) | ||
plot_arrange <- cowplot::plot_grid(constant_plot, | ||
tv_normal_plot, | ||
tv_normal_log_plot, | ||
ncol = 3, labels = "AUTO") | ||
vdiffr::expect_doppelganger("plot_arrange_simdata_foi", plot_arrange) | ||
|
||
}) |