aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2017-01-19 10:36:19 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2017-01-19 10:36:19 +0100
commitdd30f0d0ff1d8d0cc46aaef6e0917c51fe798f52 (patch)
treea954197c4e8e093d4b08c08eab14753b58602ff4 /tests
parent3ead7acba845b4f2552f555dfb29da889ed0cda8 (diff)
Move mkin::twa to pfm::max_twa.mkinfit
- Add max_twa.mkinfit() recently introduced to mkin as mkin::twa() but never released with it - Add a test to check max_twa.one_box() against analytical solutions in max_twa.mkinfit(). - Clean up R CMD check - Update docs
Diffstat (limited to 'tests')
-rw-r--r--tests/testthat/test_max_twa.R11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/testthat/test_max_twa.R b/tests/testthat/test_max_twa.R
new file mode 100644
index 0000000..82d20f7
--- /dev/null
+++ b/tests/testthat/test_max_twa.R
@@ -0,0 +1,11 @@
+library(pfm)
+context("Check max_twa for parent mkinfit models against analytical solutions")
+
+test_that("max_twa for simple decline curves is correct", {
+ fits <- mmkin(c("SFO", "FOMC", "DFOP"), list(FOCUS_2006_C), cores = 1, quiet = TRUE)
+ max_twa_21_analytical <- sapply(fits, max_twa, 21)
+ names(max_twa_21_analytical) <- rep("parent", 3)
+ preds <- lapply(fits, one_box)
+ max_twa_21_preds <- sapply(preds, function(x) max_twa(x, 21)[["max"]])
+ expect_equal(max_twa_21_analytical, max_twa_21_preds, tolerance = .03, scale = 1)
+})

Contact - Imprint