diff options
-rw-r--r-- | tests/testthat/setup_script.R | 13 | ||||
-rw-r--r-- | tests/testthat/test_plot.R | 42 |
2 files changed, 28 insertions, 27 deletions
diff --git a/tests/testthat/setup_script.R b/tests/testthat/setup_script.R index 9ec91425..be4e4658 100644 --- a/tests/testthat/setup_script.R +++ b/tests/testthat/setup_script.R @@ -57,26 +57,19 @@ DFOP_SFO <- mkinmod(parent = mkinsub("DFOP", to = "m1"), # Avoid warning when fitting a dataset where zero value is removed FOCUS_D <- subset(FOCUS_2006_D, value != 0) -# We do not want warnings about non-normality of residuals here -suppressWarnings( f_sfo_sfo_desolve <- mkinfit(SFO_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE) -) -suppressWarnings( + f_sfo_sfo_eigen <- mkinfit(SFO_SFO, FOCUS_D, solution_type = "eigen", quiet = TRUE) -) -suppressWarnings( + f_sfo_sfo.ff <- mkinfit(SFO_SFO.ff, FOCUS_D, quiet = TRUE) -) SFO_lin_a <- synthetic_data_for_UBA_2014[[1]]$data DFOP_par_c <- synthetic_data_for_UBA_2014[[12]]$data -# We also suppress the warning about non-normality of residuals here, the data -# were generated with a different error model, so no wonder! -f_2_mkin <- suppressWarnings(mkinfit("DFOP", DFOP_par_c, quiet = TRUE)) +f_2_mkin <- mkinfit("DFOP", DFOP_par_c, quiet = TRUE) f_2_nls <- nls(value ~ SSbiexp(time, A1, lrc1, A2, lrc2), data = subset(DFOP_par_c, name == "parent")) f_2_anova <- lm(value ~ as.factor(time), data = subset(DFOP_par_c, name == "parent")) diff --git a/tests/testthat/test_plot.R b/tests/testthat/test_plot.R index c7eaf428..bafcd561 100644 --- a/tests/testthat/test_plot.R +++ b/tests/testthat/test_plot.R @@ -12,19 +12,8 @@ test_that("Plotting mkinfit and mmkin objects is reproducible", { mmkin_SFO <- function() plot(fits["SFO",]) fit_D_obs_eigen <- suppressWarnings(mkinfit(SFO_SFO, FOCUS_2006_D, error_model = "obs", quiet = TRUE)) fit_C_tc <- mkinfit("SFO", FOCUS_2006_C, error_model = "tc", quiet = TRUE) - - plot_errmod_fit_D_obs_eigen <- function() plot_err(fit_D_obs_eigen, sep_obs = FALSE) plot_errmod_fit_C_tc <- function() plot_err(fit_C_tc) - plot_biphasic_mmkin <- function() plot(mixed(mmkin_biphasic)) - plot_biphasic_nlme <- function() plot(nlme_biphasic) - plot_biphasic_saem_s <- function() plot(saem_biphasic_s) - plot_biphasic_saem_m <- function() plot(saem_biphasic_m) - - plot_res_sfo_sfo <- function() plot_res(f_sfo_sfo_desolve) - plot_err_sfo_sfo <- function() plot_err(f_sfo_sfo_desolve) - plot_errmod_fit_obs_1 <- function() plot_err(fit_obs_1, sep_obs = FALSE) - plot_errmod_fit_tc_1 <- function() plot_err(fit_tc_1, sep_obs = FALSE) skip_if(getRversion() >= "4.1.0") vdiffr::expect_doppelganger("mkinfit plot for FOCUS C with defaults", plot_default_FOCUS_C_SFO) @@ -36,16 +25,35 @@ test_that("Plotting mkinfit and mmkin objects is reproducible", { vdiffr::expect_doppelganger("mmkin plot for FOCUS C", mmkin_FOCUS_C) vdiffr::expect_doppelganger("mmkin plot for SFO (FOCUS C and D)", mmkin_SFO) vdiffr::expect_doppelganger("plot_errmod with FOCUS C tc", plot_errmod_fit_C_tc) - skip_on_travis() # Still not working on Travis, maybe because of deSolve producing + + plot_res_sfo_sfo <- function() plot_res(f_sfo_sfo_desolve) + vdiffr::expect_doppelganger("plot_res for FOCUS D", plot_res_sfo_sfo) + + plot_err_sfo_sfo <- function() plot_err(f_sfo_sfo_desolve) + vdiffr::expect_doppelganger("plot_err for FOCUS D", plot_err_sfo_sfo) + + plot_errmod_fit_obs_1 <- function() plot_err(fit_obs_1, sep_obs = FALSE) + vdiffr::expect_doppelganger("plot_errmod with SFO_lin_a_tc", plot_errmod_fit_tc_1) + + plot_errmod_fit_tc_1 <- function() plot_err(fit_tc_1, sep_obs = FALSE) + vdiffr::expect_doppelganger("plot_errmod with SFO_lin_a_obs", plot_errmod_fit_obs_1) + + skip_on_travis() + + # Biphasic fits with lots of data and fits have lots of potential for differences + plot_biphasic_mmkin <- function() plot(mixed(mmkin_biphasic)) + plot_biphasic_nlme <- function() plot(nlme_biphasic) + plot_biphasic_saem_s <- function() plot(saem_biphasic_s) + plot_biphasic_saem_m <- function() plot(saem_biphasic_m) + vdiffr::expect_doppelganger("mixed model fit for mmkin object", plot_biphasic_mmkin) vdiffr::expect_doppelganger("mixed model fit for nlme object", plot_biphasic_nlme) vdiffr::expect_doppelganger("mixed model fit for saem object with saemix transformations", plot_biphasic_saem_s) vdiffr::expect_doppelganger("mixed model fit for saem object with mkin transformations", plot_biphasic_saem_m) - # different results when not working with a compiled model or eigenvalues + + # different results when working with eigenvalues + plot_errmod_fit_D_obs_eigen <- function() plot_err(fit_D_obs_eigen, sep_obs = FALSE) vdiffr::expect_doppelganger("plot_errmod with FOCUS D obs eigen", plot_errmod_fit_D_obs_eigen) - vdiffr::expect_doppelganger("plot_res for FOCUS D", plot_res_sfo_sfo) - vdiffr::expect_doppelganger("plot_err for FOCUS D", plot_err_sfo_sfo) - vdiffr::expect_doppelganger("plot_errmod with SFO_lin_a_tc", plot_errmod_fit_tc_1) - vdiffr::expect_doppelganger("plot_errmod with SFO_lin_a_obs", plot_errmod_fit_obs_1) + }) |