aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat/test_mhmkin.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2022-08-10 12:58:35 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2022-08-10 12:58:35 +0200
commit9e346fabe99de71b21ef085be102027cfa774910 (patch)
tree9d483ad1a103b51e55a6f0b68886a9d9c2af8a8c /tests/testthat/test_mhmkin.R
parentbf8f22838eb2b414f0171a176873b4373d3a497f (diff)
Batch processing for hierarchical fits
- 'R/mhmkin.R': New method for performing multiple hierarchical mkin fits in one function call, optionally in parallel. - 'R/saem.R': 'logLik' and 'update' methods for 'saem.mmkin' objects. - 'R/illparms.R': Add methods for 'saem.mmkin' and 'mhmkin' objects. tests: Use 2 cores on travis, should work according to docs
Diffstat (limited to 'tests/testthat/test_mhmkin.R')
-rw-r--r--tests/testthat/test_mhmkin.R31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/testthat/test_mhmkin.R b/tests/testthat/test_mhmkin.R
new file mode 100644
index 00000000..5243f971
--- /dev/null
+++ b/tests/testthat/test_mhmkin.R
@@ -0,0 +1,31 @@
+context("Batch fitting and diagnosing hierarchical kinetic models")
+
+test_that("Multiple hierarchical kinetic models can be fitted and diagnosed", {
+
+ skip_on_cran()
+ fits_synth_const <- suppressWarnings(
+ mmkin(c("SFO", "FOMC"), ds_sfo[1:6], cores = n_cores, quiet = TRUE))
+
+ fits_synth_tc <- suppressWarnings(
+ update(fits_synth_const, error_model = "tc"))
+
+ expect_known_output(
+ convergence(fits_synth_const),
+ "convergence_fits_synth_const.txt")
+
+ hfits <- mhmkin(list(fits_synth_const, fits_synth_tc))
+
+ expect_known_output(
+ convergence(hfits),
+ "convergence_hfits_synth.txt")
+
+ expect_known_output(
+ illparms(hfits),
+ "illparms_hfits_synth.txt")
+
+ expect_equal(which.min(AIC(hfits)), 3)
+
+ hfit_sfo_tc <- update(hfits[["SFO", "tc"]],
+ covariance.model = diag(c(0, 1)))
+ expect_equal(illparms(hfit_sfo_tc), character(0))
+})

Contact - Imprint