aboutsummaryrefslogtreecommitdiff
path: root/inst
diff options
context:
space:
mode:
Diffstat (limited to 'inst')
-rw-r--r--inst/doc/mkin.Rnw20
-rw-r--r--inst/doc/mkin.pdfbin172301 -> 176183 bytes
-rw-r--r--inst/unitTests/runit.mkinmod.R70
3 files changed, 66 insertions, 24 deletions
diff --git a/inst/doc/mkin.Rnw b/inst/doc/mkin.Rnw
index 84ede0f5..78b59e67 100644
--- a/inst/doc/mkin.Rnw
+++ b/inst/doc/mkin.Rnw
@@ -112,14 +112,14 @@ The next task is to define the model to be fitted to the data. In order to
facilitate this task, a convenience function \Robject{mkinmod} is available.
<<model_definition, echo=TRUE>>=
-SFO <- mkinmod(spec = list(parent = list(type = "SFO", to = NA, sink = TRUE)))
-SFORB <- mkinmod(spec = list(parent = list(type = "SFORB", to = NA, sink = TRUE)))
-SFO_SFO <- mkinmod(spec = list(
+SFO <- mkinmod(parent = list(type = "SFO"))
+SFORB <- mkinmod(parent = list(type = "SFORB"))
+SFO_SFO <- mkinmod(
parent = list(type = "SFO", to = "m1", sink = TRUE),
- m1 = list(type = "SFO", to = NA, sink = TRUE)))
-SFORB_SFO <- mkinmod(spec = list(
+ m1 = list(type = "SFO"))
+SFORB_SFO <- mkinmod(
parent = list(type = "SFORB", to = "m1", sink = TRUE),
- m1 = list(type = "SFO", to = NA, sink = TRUE)))
+ m1 = list(type = "SFO"))
@
\subsection{Fitting the model}
@@ -138,14 +138,6 @@ SFORB.fit <- mkinfit(SFORB, FOCUS_2006_C)
summary(SFORB.fit)
SFO_SFO.fit <- mkinfit(SFO_SFO, FOCUS_2006_D)
summary(SFO_SFO.fit)
-SFO_SFO.fit.2 <- mkinfit(SFO_SFO, FOCUS_2006_D,
- fixed_initials = c(FALSE, FALSE), fixed_parms = c(FALSE, TRUE, FALSE))
-summary(SFO_SFO.fit.2)
-SFO_SFO.fit.3 <- mkinfit(SFO_SFO, FOCUS_2006_D,
- fixed_initials = c(FALSE, FALSE), fixed_parms = c(FALSE, TRUE, FALSE), lower = -0.0000001)
-summary(SFO_SFO.fit.3)
-SFORB_SFO.fit <- mkinfit(SFORB_SFO, FOCUS_2006_D)
-summary(SFORB_SFO.fit)
@
\bibliographystyle{plainnat}
diff --git a/inst/doc/mkin.pdf b/inst/doc/mkin.pdf
index 95c8a690..bc72e740 100644
--- a/inst/doc/mkin.pdf
+++ b/inst/doc/mkin.pdf
Binary files differ
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