aboutsummaryrefslogtreecommitdiff
path: root/inst
diff options
context:
space:
mode:
authorjranke <jranke@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>2010-05-31 21:17:58 +0000
committerjranke <jranke@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>2010-05-31 21:17:58 +0000
commitfb014522ddc1057e85d3c08ab2cd753bd79bd857 (patch)
treedd01e9cb32c8e1837ce5a4d7dd9f2b42bca17cee /inst
parenta4421eba19eae98a0bd00adb4e8c6d72cc49f9fb (diff)
- Added a test based on the KinGUI paper "complex case"
- Fix the DT50 calculation for the SFORB model - Added a bit more of a description git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@11 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
Diffstat (limited to 'inst')
-rw-r--r--inst/unitTests/runit.mkinfit.R35
1 files changed, 35 insertions, 0 deletions
diff --git a/inst/unitTests/runit.mkinfit.R b/inst/unitTests/runit.mkinfit.R
new file mode 100644
index 0000000..6dbd11f
--- /dev/null
+++ b/inst/unitTests/runit.mkinfit.R
@@ -0,0 +1,35 @@
+test.mkinmod.schaefer07_complex_example <- function()
+{
+ schaefer07_complex_model <- mkinmod(
+ parent = list(type = "SFO", to = c("A1", "B1", "C1"), sink = FALSE),
+ A1 = list(type = "SFO", to = "A2"),
+ B1 = list(type = "SFO"),
+ C1 = list(type = "SFO"),
+ A2 = list(type = "SFO"))
+
+ fit <- mkinfit(schaefer07_complex_model,
+ mkin_wide_to_long(schaefer07_complex_case, time = "time"),
+ parms.ini = c(0.1, 0.1, 0.1, 0.01, 0.1, 0.1, 0.1, 0.1))
+ s <- summary(fit)
+ attach(as.list(fit$par))
+ k_parent <- sum(k_parent_A1, k_parent_B1, k_parent_C1)
+ r <- schaefer07_complex_results
+ r$mkin <- c(
+ k_parent,
+ s$distimes["parent", "DT50"],
+ k_parent_A1/k_parent,
+ sum(k_A1_sink, k_A1_A2),
+ s$distimes["A1", "DT50"],
+ k_parent_B1/k_parent,
+ k_B1_sink,
+ s$distimes["B1", "DT50"],
+ k_parent_C1/k_parent,
+ k_C1_sink,
+ s$distimes["C1", "DT50"],
+ k_A1_A2/(k_A1_A2 + k_A1_sink),
+ k_A2_sink,
+ s$distimes["A2", "DT50"])
+ r$means <- (r$KinGUI + r$ModelMaker)/2
+ r$mkin.deviation <- abs(round(100 * ((r$mkin - r$means)/r$means), digits=1))
+ checkTrue(r$mkin.deviation < 10)
+}

Contact - Imprint