aboutsummaryrefslogtreecommitdiff
path: root/inst/unitTests
diff options
context:
space:
mode:
authorjranke <jranke@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>2012-03-15 15:54:14 +0000
committerjranke <jranke@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>2012-03-15 15:54:14 +0000
commit1718d434efae26de02754c6622c43f4dc9e624b9 (patch)
treec2dafe942f65e94cd43e1ba17933b667f284d154 /inst/unitTests
parent2b244ef7d3cbebaaa653d8c8ac87090e34525f7a (diff)
Update kinfit and mkin to the latest version published on BerliOS.
git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@17 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
Diffstat (limited to 'inst/unitTests')
-rw-r--r--inst/unitTests/runit.mkinfit.R28
-rw-r--r--inst/unitTests/runit.mkinmod.R61
2 files changed, 78 insertions, 11 deletions
diff --git a/inst/unitTests/runit.mkinfit.R b/inst/unitTests/runit.mkinfit.R
index df09cc64..831c0698 100644
--- a/inst/unitTests/runit.mkinfit.R
+++ b/inst/unitTests/runit.mkinfit.R
@@ -1,3 +1,23 @@
+# $Id: runit.mkinfit.R 68 2010-09-09 22:40:04Z jranke $
+
+# Copyright (C) 2010 Johannes Ranke
+# Contact: mkin-devel@lists.berlios.de
+
+# This file is part of the R package mkin
+
+# mkin is free software: you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+
+# You should have received a copy of the GNU General Public License along with
+# this program. If not, see <http://www.gnu.org/licenses/>
+
test.mkinmod.schaefer07_complex_example <- function()
{
schaefer07_complex_model <- mkinmod(
@@ -17,16 +37,16 @@ test.mkinmod.schaefer07_complex_example <- function()
r$mkin <- c(
k_parent,
s$distimes["parent", "DT50"],
- k_parent_A1/k_parent,
+ s$ff["parent_A1"],
sum(k_A1_sink, k_A1_A2),
s$distimes["A1", "DT50"],
- k_parent_B1/k_parent,
+ s$ff["parent_B1"],
k_B1_sink,
s$distimes["B1", "DT50"],
- k_parent_C1/k_parent,
+ s$ff["parent_C1"],
k_C1_sink,
s$distimes["C1", "DT50"],
- k_A1_A2/(k_A1_A2 + k_A1_sink),
+ s$ff["A1_A2"],
k_A2_sink,
s$distimes["A2", "DT50"])
r$means <- (r$KinGUI + r$ModelMaker)/2
diff --git a/inst/unitTests/runit.mkinmod.R b/inst/unitTests/runit.mkinmod.R
index 44d9ffb5..a0e89968 100644
--- a/inst/unitTests/runit.mkinmod.R
+++ b/inst/unitTests/runit.mkinmod.R
@@ -1,3 +1,23 @@
+# $Id: runit.mkinmod.R 64 2010-09-01 13:33:51Z jranke $
+
+# Copyright (C) 2010 Johannes Ranke
+# Contact: mkin-devel@lists.berlios.de
+
+# This file is part of the R package mkin
+
+# mkin is free software: you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+
+# You should have received a copy of the GNU General Public License along with
+# this program. If not, see <http://www.gnu.org/licenses/>
+
test.mkinmod.SFO <- function()
{
SFO.diffs <- c(
@@ -5,7 +25,9 @@ test.mkinmod.SFO <- function()
)
SFO.parms <- c("k_parent_sink")
SFO.map <- list(parent = c(SFO = "parent"))
- SFO <- list(diffs = SFO.diffs, parms = SFO.parms, map = SFO.map)
+ SFO.coefmat <- matrix("- k_parent_sink", dimnames = list("parent", "parent"))
+ SFO <- list(diffs = SFO.diffs, parms = SFO.parms, map = SFO.map,
+ coefmat = SFO.coefmat)
class(SFO) <- "mkinmod"
SFO.1 <- mkinmod(
parent = list(type = "SFO", to = NULL, sink = TRUE)
@@ -39,7 +61,13 @@ test.mkinmod.SFORB <- function()
)
SFORB.parms <- c("k_parent_free_sink", "k_parent_free_bound", "k_parent_bound_free")
SFORB.map <- list(parent = c(SFORB = "parent_free", SFORB = "parent_bound"))
- SFORB <- list(diffs = SFORB.diffs, parms = SFORB.parms, map = SFORB.map)
+ vars <- paste("parent", c("free", "bound"), sep="_")
+ SFORB.coefmat <- matrix(
+ c("- k_parent_free_sink - k_parent_free_bound", "k_parent_bound_free",
+ "k_parent_free_bound", "- k_parent_bound_free"), nrow=2, byrow=TRUE,
+ dimnames=list(vars, vars))
+ SFORB <- list(diffs = SFORB.diffs, parms = SFORB.parms,
+ map = SFORB.map, coefmat = SFORB.coefmat)
class(SFORB) <- "mkinmod"
SFORB.mkinmod <- mkinmod(
parent = list(type = "SFORB", to = NULL, sink=TRUE)
@@ -55,7 +83,12 @@ test.mkinmod.SFO_SFO <- function()
)
SFO_SFO.parms <- c("k_parent_sink", "k_m1_sink", "k_parent_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)
+ vars <- c("parent", "m1")
+ SFO_SFO.coefmat <- matrix(c("- k_parent_sink - k_parent_m1",
+ "0", "k_parent_m1", "- k_m1_sink"), nrow=2, byrow=TRUE,
+ dimnames=list(vars, vars))
+ SFO_SFO <- list(diffs = SFO_SFO.diffs, parms = SFO_SFO.parms,
+ map = SFO_SFO.map, coefmat = SFO_SFO.coefmat)
class(SFO_SFO) <- "mkinmod"
SFO_SFO.mkinmod <- mkinmod(
parent = list(type = "SFO", to = "m1", sink=TRUE),
@@ -73,7 +106,14 @@ test.mkinmod.SFO_SFO2 <- function()
)
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)
+ vars <- c("parent", "m1", "m2")
+ SFO_SFO2.coefmat <- matrix(
+ c("- k_parent_sink - k_parent_m1 - k_parent_m2", "0", "0",
+ "k_parent_m1", "- k_m1_sink", "0",
+ "k_parent_m2", "0", "- k_m2_sink"), nrow=3, byrow=TRUE,
+ dimnames=list(vars, vars))
+ SFO_SFO2 <- list(diffs = SFO_SFO2.diffs, parms = SFO_SFO2.parms,
+ map = SFO_SFO2.map, coefmat = SFO_SFO2.coefmat)
class(SFO_SFO2) <- "mkinmod"
SFO_SFO2.mkinmod <- mkinmod(
parent = list(type = "SFO", to = c("m1", "m2"), sink=TRUE),
@@ -90,9 +130,16 @@ test.mkinmod.FOMC_SFO2 <- function()
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)
+ 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.ff <- c(
+ m1 = "f_to_m1",
+ m2 = "(1 - f_to_m1) * f_to_m2")
+ FOMC_SFO2 <- list(diffs = FOMC_SFO2.diffs, parms = FOMC_SFO2.parms,
+ map = FOMC_SFO2.map, ff = FOMC_SFO2.ff)
class(FOMC_SFO2) <- "mkinmod"
FOMC_SFO2.mkinmod <- mkinmod(
parent = list(type = "FOMC", to = c("m1", "m2"), sink=TRUE),

Contact - Imprint