From dd30f0d0ff1d8d0cc46aaef6e0917c51fe798f52 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 19 Jan 2017 10:36:19 +0100 Subject: 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 --- tests/testthat/test_max_twa.R | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/testthat/test_max_twa.R (limited to 'tests') 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) +}) -- cgit v1.2.1