aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat/test_dmta.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2022-03-07 12:03:40 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2022-03-07 14:55:21 +0100
commit7035cde3a53781721fe15a8893fdf328c789bdd2 (patch)
treea1e4929faf9d645caedc0ed4dcc5036252497c63 /tests/testthat/test_dmta.R
parent77c248ca40b82ec00a756cd82f12968131f78959 (diff)
Remove nlmixr interface for release of mkin 1.1.0
I am postponing my attempts to get the nlmixr interface to CRAN, given some problems with nlmixr using R-devel under Windows, see https://github.com/nlmixrdevelopment/nlmixr/issues/596 and https://github.com/r-hub/rhub/issues/512, which is fixed by the removal of nlmixr from the testsuite. For the tests to be more platform independent, the biphasic mixed effects models test dataset was defined in a way that fitting should be more robust (less ill-defined).
Diffstat (limited to 'tests/testthat/test_dmta.R')
-rw-r--r--tests/testthat/test_dmta.R66
1 files changed, 0 insertions, 66 deletions
diff --git a/tests/testthat/test_dmta.R b/tests/testthat/test_dmta.R
index 2927b711..7f0a3a67 100644
--- a/tests/testthat/test_dmta.R
+++ b/tests/testthat/test_dmta.R
@@ -32,20 +32,6 @@ test_that("Different backends get consistent results for DFOP tc, dimethenamid d
saem_saemix_dfop_tc_mkin <- saem(dmta_dfop_tc, transformations = "mkin")
ints_saemix_mkin <- intervals(saem_saemix_dfop_tc_mkin)
- # nlmixr saem
- saem_nlmixr_dfop_tc <- nlmixr(dmta_dfop_tc, est = "saem",
- control = nlmixr::saemControl(nBurn = 300, nEm = 100, nmc = 9, print = 0))
- ints_nlmixr_saem <- intervals(saem_nlmixr_dfop_tc)
-
- # nlmixr focei
- # We get three warnings about nudged etas, the initial optimization and
- # gradient problems with initial estimate and covariance
- # We need to capture output, otherwise it pops up in testthat output
- expect_warning(tmp <- capture_output(focei_nlmixr_dfop_tc <- nlmixr(
- dmta_dfop_tc, est = "focei",
- control = nlmixr::foceiControl(print = 0), all = TRUE)))
- ints_nlmixr_focei <- intervals(focei_nlmixr_dfop_tc)
-
# Fixed effects
## saemix vs. nlme
expect_true(all(ints_saemix$fixed[, "est."] >
@@ -59,18 +45,6 @@ test_that("Different backends get consistent results for DFOP tc, dimethenamid d
expect_true(all(ints_saemix_mkin$fixed[, "est."] <
backtransform_odeparms(ints_nlme$fixed[, "upper"], dmta_dfop$mkinmod)))
- ## nlmixr saem vs. nlme
- expect_true(all(ints_nlmixr_saem$fixed[, "est."] >
- backtransform_odeparms(ints_nlme$fixed[, "lower"], dmta_dfop$mkinmod)))
- expect_true(all(ints_nlmixr_saem$fixed[, "est."] <
- backtransform_odeparms(ints_nlme$fixed[, "upper"], dmta_dfop$mkinmod)))
-
- ## nlmixr focei vs. nlme
- expect_true(all(ints_nlmixr_focei$fixed[, "est."] >
- backtransform_odeparms(ints_nlme$fixed[, "lower"], dmta_dfop$mkinmod)))
- expect_true(all(ints_nlmixr_focei$fixed[, "est."] <
- backtransform_odeparms(ints_nlme$fixed[, "upper"], dmta_dfop$mkinmod)))
-
# Random effects
## for saemix with saemix transformations, the comparison would be complicated...
## saemix mkin vs. nlme
@@ -79,18 +53,6 @@ test_that("Different backends get consistent results for DFOP tc, dimethenamid d
expect_true(all(ints_saemix$fixed[, "est."] <
backtransform_odeparms(ints_nlme$fixed[, "upper"], dmta_dfop$mkinmod)))
- ## nlmixr saem vs. nlme
- expect_true(all(ints_nlmixr_saem$random[, "est."] >
- backtransform_odeparms(ints_nlme$reStruct$ds[, "lower"], dmta_dfop$mkinmod)))
- expect_true(all(ints_nlmixr_saem$random[, "est."] <
- backtransform_odeparms(ints_nlme$reStruct$ds[, "upper"], dmta_dfop$mkinmod)))
-
- ## nlmixr focei vs. nlme
- expect_true(all(ints_nlmixr_focei$random[, "est."] >
- backtransform_odeparms(ints_nlme$reStruct$ds[, "lower"], dmta_dfop$mkinmod)))
- expect_true(all(ints_nlmixr_focei$random[, "est."] <
- backtransform_odeparms(ints_nlme$reStruct$ds[, "upper"], dmta_dfop$mkinmod)))
-
# Variance function
# Some of these tests on error model parameters fail on Travis and Winbuilder
skip_on_travis()
@@ -106,21 +68,6 @@ test_that("Different backends get consistent results for DFOP tc, dimethenamid d
ints_nlme$varStruct[, "lower"]))
expect_true(all(ints_saemix_mkin[[3]][, "est."] <
ints_nlme$varStruct[, "upper"]))
-
- # nlmixr saem vs. nlme
- expect_true(all(ints_nlmixr_saem[[3]][, "est."] >
- ints_nlme$varStruct[, "lower"]))
- expect_true(all(ints_nlmixr_saem[[3]][, "est."] <
- ints_nlme$varStruct[, "upper"]))
-
- # nlmixr focei vs. nlme
- # We only test for the proportional part (rsd_high), as the
- # constant part (sigma_low) obtained with nlmixr/FOCEI is below the lower
- # bound of the confidence interval obtained with nlme
- expect_true(ints_nlmixr_focei[[3]]["rsd_high", "est."] >
- ints_nlme$varStruct["prop", "lower"])
- expect_true(ints_nlmixr_focei[[3]]["rsd_high", "est."] <
- ints_nlme$varStruct["prop", "upper"])
})
# Compared to the 2020 paper https://doi.org/10.3390/environments8080071
@@ -148,19 +95,6 @@ test_that("Different backends get consistent results for SFO-SFO3+, dimethenamid
"Iteration 5, LME step.*not converge")
ints_nlme_mets <- intervals(nlme_sfo_sfo3p_tc, which = "fixed")
- # The saem fit with nlmixr takes only about 15 seconds
- tmp <- capture.output(
- saem_nlmixr_sfo_sfo3p_tc <- nlmixr(dmta_sfo_sfo3p_tc, est = "saem",
- control = nlmixr::saemControl(print = 0)))
- ints_nlmixr_saem_mets <- intervals(saem_nlmixr_sfo_sfo3p_tc)
-
- # We need to exclude the ilr transformed formation fractions in these
- # tests, as they do not have a one to one relation in the transformations
- expect_true(all(ints_nlmixr_saem_mets$fixed[, "est."][-c(6, 7, 8)] >
- backtransform_odeparms(ints_nlme_mets$fixed[, "lower"][-c(6, 7, 8)], sfo_sfo3p)))
- expect_true(all(ints_nlmixr_saem_mets$fixed[, "est."][-c(6, 7, 8)] <
- backtransform_odeparms(ints_nlme_mets$fixed[, "upper"], sfo_sfo3p)[-c(6, 7, 8)]))
-
skip("Fitting this ODE model with saemix takes about 15 minutes on my system")
# As DFOP is overparameterised and leads to instabilities and errors, we
# need to use SFO.

Contact - Imprint