diff options
Diffstat (limited to 'tests/testthat/test_multistart.R')
-rw-r--r-- | tests/testthat/test_multistart.R | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/tests/testthat/test_multistart.R b/tests/testthat/test_multistart.R index 502cee98..3a511e06 100644 --- a/tests/testthat/test_multistart.R +++ b/tests/testthat/test_multistart.R @@ -9,26 +9,22 @@ test_that("multistart works for saem.mmkin models", { best(saem_sfo_s_multi), test = TRUE ) - # On winbuilder, sfo_saem_1 gives an AIC of 1310.8, while we get 1311.7 - # locally (using saemix 3.2, which likely makes the difference due to the - # error parameter patch) on Linux and Windows. The other, well-determined - # fits both give 1309.7. - expect_equal(round(anova_sfo, 1)["sfo_saem_1_reduced", "AIC"], 1309.7) - expect_equal(round(anova_sfo, 1)["best(saem_sfo_s_multi)", "AIC"], 1309.7) - expect_true(anova_sfo[3, "Pr(>Chisq)"] > 0.2) # Local: 1, CRAN: 0.4 + expect_equal(round(anova_sfo, 1)["sfo_saem_1_reduced", "AIC"], 1302.2) + expect_equal(round(anova_sfo, 1)["best(saem_sfo_s_multi)", "AIC"], 1302.2) + expect_true(anova_sfo[3, "Pr(>Chisq)"] > 0.2) # Local: 1, win-builder: 0.4 set.seed(123456) - saem_biphasic_m_multi <- multistart(saem_biphasic_m, n = 8, + saem_dfop_sfo_m_multi <- multistart(saem_dfop_sfo_m, n = 8, cores = n_cores) - expect_known_output(print(saem_biphasic_m_multi), - file = "print_multistart_biphasic.txt") + expect_known_output(print(saem_dfop_sfo_m_multi), + file = "print_multistart_dfop_sfo.txt") - anova_biphasic <- anova(saem_biphasic_m, - best(saem_biphasic_m_multi)) + anova_dfop_sfo <- anova(saem_dfop_sfo_m, + best(saem_dfop_sfo_m_multi)) # With the new starting parameters we do not improve # with multistart any more - expect_equal(anova_biphasic[2, "AIC"], anova_biphasic[1, "AIC"], + expect_equal(anova_dfop_sfo[2, "AIC"], anova_dfop_sfo[1, "AIC"], tolerance = 1e-4) skip_on_travis() # Plots are platform dependent @@ -37,10 +33,10 @@ test_that("multistart works for saem.mmkin models", { vdiffr::expect_doppelganger("llhist for sfo fit", llhist_sfo) vdiffr::expect_doppelganger("parplot for sfo fit", parplot_sfo) - llhist_biphasic <- function() llhist(saem_biphasic_m_multi) - parplot_biphasic <- function() parplot(saem_biphasic_m_multi, + llhist_dfop_sfo <- function() llhist(saem_dfop_sfo_m_multi) + parplot_dfop_sfo <- function() parplot(saem_dfop_sfo_m_multi, ylim = c(0.5, 2)) - vdiffr::expect_doppelganger("llhist for biphasic saemix fit", llhist_biphasic) - vdiffr::expect_doppelganger("parplot for biphasic saemix fit", parplot_biphasic) + vdiffr::expect_doppelganger("llhist for dfop sfo fit", llhist_dfop_sfo) + vdiffr::expect_doppelganger("parplot for dfop sfo fit", parplot_dfop_sfo) }) |