aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat/test_from_max_mean.R
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testthat/test_from_max_mean.R')
-rw-r--r--tests/testthat/test_from_max_mean.R17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/testthat/test_from_max_mean.R b/tests/testthat/test_from_max_mean.R
new file mode 100644
index 00000000..8e5953b9
--- /dev/null
+++ b/tests/testthat/test_from_max_mean.R
@@ -0,0 +1,17 @@
+context("Test fitting the decline of metabolites from their maximum")
+
+test_that("Fitting from maximum mean value works", {
+ SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"),
+ m1 = mkinsub("SFO"))
+ expect_error(mkinfit(SFO_SFO, FOCUS_2006_D, from_max_mean = TRUE))
+
+ # We can either explicitly create a model for m1, or subset the data
+ SFO_m1 <- mkinmod(m1 = mkinsub("SFO"))
+ f.1 <- mkinfit(SFO_m1, FOCUS_2006_D, from_max_mean = TRUE, quiet = TRUE)
+ expect_equivalent(endpoints(f.1)$distimes["m1", ], c(170.8, 567.5),
+ scale = 1, tolerance = 0.1)
+
+ f.2 <- mkinfit("SFO", subset(FOCUS_2006_D, name == "m1"), from_max_mean = TRUE, quiet = TRUE)
+ expect_equivalent(endpoints(f.2)$distimes["m1", ], c(170.8, 567.5),
+ scale = 1, tolerance = 0.1)
+})

Contact - Imprint