aboutsummaryrefslogtreecommitdiff
path: root/inst/unitTests
diff options
context:
space:
mode:
authorjranke <jranke@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>2010-05-18 12:58:38 +0000
committerjranke <jranke@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>2010-05-18 12:58:38 +0000
commit16f5b1d3c0136413e92b2be0f20d365e92e9cd1c (patch)
treeedab7b27ba4253b9dd45520e504c54851f65f26f /inst/unitTests
parent30cbb4092f6d2d3beff5800603374a0d009ad770 (diff)
Much more complete version that was just submitted to CRAN.
git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@9 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
Diffstat (limited to 'inst/unitTests')
-rw-r--r--inst/unitTests/runit.mkinmod.R70
1 files changed, 60 insertions, 10 deletions
diff --git a/inst/unitTests/runit.mkinmod.R b/inst/unitTests/runit.mkinmod.R
index b6ca6b8d..44d9ffb5 100644
--- a/inst/unitTests/runit.mkinmod.R
+++ b/inst/unitTests/runit.mkinmod.R
@@ -4,13 +4,25 @@ test.mkinmod.SFO <- function()
parent = "d_parent = - k_parent_sink * parent"
)
SFO.parms <- c("k_parent_sink")
- SFO.map <- list(parent = "parent")
+ SFO.map <- list(parent = c(SFO = "parent"))
SFO <- list(diffs = SFO.diffs, parms = SFO.parms, map = SFO.map)
class(SFO) <- "mkinmod"
- SFO.mkinmod <- mkinmod(spec = list(
- parent = list(type = "SFO", to = NA, sink=TRUE))
+ SFO.1 <- mkinmod(
+ parent = list(type = "SFO", to = NULL, sink = TRUE)
)
- checkIdentical(SFO, SFO.mkinmod)
+ checkIdentical(SFO, SFO.1)
+ SFO.2 <- mkinmod(
+ parent = list(type = "SFO", to = NULL)
+ )
+ checkIdentical(SFO, SFO.2)
+ SFO.3 <- mkinmod(
+ parent = list(type = "SFO", sink = TRUE)
+ )
+ checkIdentical(SFO, SFO.3)
+ SFO.4 <- mkinmod(
+ parent = list(type = "SFO")
+ )
+ checkIdentical(SFO, SFO.3)
}
test.mkinmod.SFORB <- function()
@@ -26,11 +38,11 @@ test.mkinmod.SFORB <- function()
"- k_parent_bound_free * parent_bound")
)
SFORB.parms <- c("k_parent_free_sink", "k_parent_free_bound", "k_parent_bound_free")
- SFORB.map <- list(parent = c("parent_free", "parent_bound"))
+ SFORB.map <- list(parent = c(SFORB = "parent_free", SFORB = "parent_bound"))
SFORB <- list(diffs = SFORB.diffs, parms = SFORB.parms, map = SFORB.map)
class(SFORB) <- "mkinmod"
- SFORB.mkinmod <- mkinmod(spec = list(
- parent = list(type = "SFORB", to = NA, sink=TRUE))
+ SFORB.mkinmod <- mkinmod(
+ parent = list(type = "SFORB", to = NULL, sink=TRUE)
)
checkIdentical(SFORB, SFORB.mkinmod)
}
@@ -42,12 +54,50 @@ test.mkinmod.SFO_SFO <- function()
m1 = "d_m1 = - k_m1_sink * m1 + k_parent_m1 * parent"
)
SFO_SFO.parms <- c("k_parent_sink", "k_m1_sink", "k_parent_m1")
- SFO_SFO.map <- list(parent = "parent", m1 = "m1")
+ SFO_SFO.map <- list(parent = c(SFO = "parent"), m1 = c(SFO = "m1"))
SFO_SFO <- list(diffs = SFO_SFO.diffs, parms = SFO_SFO.parms, map = SFO_SFO.map)
class(SFO_SFO) <- "mkinmod"
- SFO_SFO.mkinmod <- mkinmod(spec = list(
+ SFO_SFO.mkinmod <- mkinmod(
parent = list(type = "SFO", to = "m1", sink=TRUE),
- m1 = list(type = "SFO", to = NA, sink=TRUE))
+ m1 = list(type = "SFO", sink=TRUE)
)
checkIdentical(SFO_SFO, SFO_SFO.mkinmod)
}
+
+test.mkinmod.SFO_SFO2 <- function()
+{
+ SFO_SFO2.diffs <- c(
+ parent = "d_parent = - k_parent_sink * parent - k_parent_m1 * parent - k_parent_m2 * parent",
+ m1 = "d_m1 = - k_m1_sink * m1 + k_parent_m1 * parent",
+ m2 = "d_m2 = - k_m2_sink * m2 + k_parent_m2 * parent"
+ )
+ SFO_SFO2.parms <- c("k_parent_sink", "k_m1_sink", "k_m2_sink", "k_parent_m1", "k_parent_m2")
+ SFO_SFO2.map <- list(parent = c(SFO = "parent"), m1 = c(SFO = "m1"), m2 = c(SFO = "m2"))
+ SFO_SFO2 <- list(diffs = SFO_SFO2.diffs, parms = SFO_SFO2.parms, map = SFO_SFO2.map)
+ class(SFO_SFO2) <- "mkinmod"
+ SFO_SFO2.mkinmod <- mkinmod(
+ parent = list(type = "SFO", to = c("m1", "m2"), sink=TRUE),
+ m1 = list(type = "SFO", sink=TRUE),
+ m2 = list(type = "SFO", sink=TRUE)
+ )
+ checkIdentical(SFO_SFO2, SFO_SFO2.mkinmod)
+}
+
+test.mkinmod.FOMC_SFO2 <- function()
+{
+ FOMC_SFO2.diffs <- c(
+ parent = "d_parent = - (alpha/beta) * ((time/beta) + 1)^-1 * parent",
+ m1 = "d_m1 = - k_m1_sink * m1 + f_to_m1 * (alpha/beta) * ((time/beta) + 1)^-1 * parent",
+ m2 = "d_m2 = - k_m2_sink * m2 + (1 - f_to_m1) * f_to_m2 * (alpha/beta) * ((time/beta) + 1)^-1 * parent"
+ )
+ FOMC_SFO2.parms <- c("alpha", "beta", "k_m1_sink", "k_m2_sink", "f_to_m1", "f_to_m2")
+ FOMC_SFO2.map <- list(parent = c(FOMC = "parent"), m1 = c(SFO = "m1"), m2 = c(SFO = "m2"))
+ FOMC_SFO2 <- list(diffs = FOMC_SFO2.diffs, parms = FOMC_SFO2.parms, map = FOMC_SFO2.map)
+ class(FOMC_SFO2) <- "mkinmod"
+ FOMC_SFO2.mkinmod <- mkinmod(
+ parent = list(type = "FOMC", to = c("m1", "m2"), sink=TRUE),
+ m1 = list(type = "SFO"),
+ m2 = list(type = "SFO")
+ )
+ checkIdentical(FOMC_SFO2, FOMC_SFO2.mkinmod)
+}

Contact - Imprint