aboutsummaryrefslogtreecommitdiff
path: root/pkg/tests/testthat/test_SFO_actual_twa.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2015-06-11 15:23:22 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2015-06-11 15:23:22 +0200
commit3aa5fb86772c28402047c7ebd07841061dbcdbba (patch)
tree524b67e02e6eee8584bf85211bc522e4918e8708 /pkg/tests/testthat/test_SFO_actual_twa.R
parentd3daa7b73fa5d0508ff51a843247d126c2a11691 (diff)
Add facilities to calculate decline curves
Diffstat (limited to 'pkg/tests/testthat/test_SFO_actual_twa.R')
-rw-r--r--pkg/tests/testthat/test_SFO_actual_twa.R13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/tests/testthat/test_SFO_actual_twa.R b/pkg/tests/testthat/test_SFO_actual_twa.R
new file mode 100644
index 0000000..b0a5537
--- /dev/null
+++ b/pkg/tests/testthat/test_SFO_actual_twa.R
@@ -0,0 +1,13 @@
+library(pfm)
+context("Actual and time weighted average concentrations for SFO kinetics")
+
+test_that("SFO_actual_twa calculates correctly", {
+ test_times <- c(0, 1, 7, 21, 42)
+ # This was calculated with the CRD spreadsheet for multiple applications
+ reference <- data.frame(
+ actual = c(10, 9.330, 6.156, 2.333, 0.544),
+ twa = c(NaN, 9.661, 7.923, 5.267, 3.248),
+ row.names = test_times)
+ result <- round(10 * SFO_actual_twa(10, times = test_times), 3)
+ expect_equal(result, reference)
+})

Contact - Imprint