aboutsummaryrefslogtreecommitdiff
path: root/inst/unitTests/runit.mkinfit.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2015-04-17 16:42:33 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2015-04-17 16:54:42 +0200
commit558b96b4e3cfd1845677620976f09bad2c641ecb (patch)
tree7ad297cfb50b8da566ca2f6d0b4360ab4896a2b8 /inst/unitTests/runit.mkinfit.R
parentf9198dc35109df526607df213ebefee182b5b24f (diff)
Make compiled FOMC and DFOP models work
- Many thanks @karlines for the hint in ccSolve#1 how to declare the time variable and for writing the ccSolve package in the first place - Add tests for the compiled versions of the FOMC and DFOP models
Diffstat (limited to 'inst/unitTests/runit.mkinfit.R')
-rw-r--r--inst/unitTests/runit.mkinfit.R14
1 files changed, 13 insertions, 1 deletions
diff --git a/inst/unitTests/runit.mkinfit.R b/inst/unitTests/runit.mkinfit.R
index 8eefb995..01cbaf00 100644
--- a/inst/unitTests/runit.mkinfit.R
+++ b/inst/unitTests/runit.mkinfit.R
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2014 Johannes Ranke
+# Copyright (C) 2010-2015 Johannes Ranke
# Contact: jranke@uni-bremen.de
# This file is part of the R package mkin
@@ -112,6 +112,18 @@ test.FOCUS_2006_DFOP <- function()
dev.B.DFOP <- abs(round(100 * ((median.B.DFOP - fit.B.DFOP.r)/median.B.DFOP), digits=1))
# about 0.6% deviation for parameter f, the others are <= 0.1%
checkIdentical(dev.B.DFOP < 1, rep(TRUE, length(dev.B.DFOP)))
+
+ # Check the compiled version of possible FOCUS_2006_B
+ if (require(ccSolve)) {
+ checkTrue(!is.null(DFOP$compiled))
+ fit.B.DFOP.compiled <- mkinfit(DFOP, FOCUS_2006_B, solution_type = "deSolve", use_compiled = TRUE, quiet=TRUE)
+
+ fit.B.DFOP.compiled.r <- as.numeric(c(fit.B.DFOP.compiled$bparms.optim,
+ endpoints(fit.B.DFOP)$distimes[c("DT50", "DT90")]))
+ dev.B.DFOP.compiled <- abs(round(100 * ((median.B.DFOP - fit.B.DFOP.compiled.r)/median.B.DFOP), digits=1))
+ # about 0.6% deviation for parameter f, the others are <= 0.1%
+ checkIdentical(dev.B.DFOP.compiled < 1, rep(TRUE, length(dev.B.DFOP)))
+ }
} # }}}
# Test HS model to a relative tolerance of 1% excluding Mathematica values {{{

Contact - Imprint