diff options
author | jranke <jranke@edb9625f-4e0d-4859-8d74-9fd3b1da38cb> | 2012-06-25 23:45:39 +0000 |
---|---|---|
committer | jranke <jranke@edb9625f-4e0d-4859-8d74-9fd3b1da38cb> | 2012-06-25 23:45:39 +0000 |
commit | 5f72a28432c024ab9d57b70e87186dcc607c0903 (patch) | |
tree | e7d30a3ef4c8c748487cbe38cb022c9f753d6df1 /inst | |
parent | 3a7751c62e369547db2048b7fc89c21b862010e9 (diff) |
- Document endpoints() function
- Fix unit tests that were broken by introduction of
the endpoints function
- Small documentation fixes
- Format output of backtransformed parameters
- Integrate snippet for making static documentation
using staticdocs by Hadley Wickham
git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@41 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
Diffstat (limited to 'inst')
-rw-r--r-- | inst/GUI/README | 1 | ||||
-rw-r--r-- | inst/unitTests/runit.mkinfit.R | 56 |
2 files changed, 29 insertions, 28 deletions
diff --git a/inst/GUI/README b/inst/GUI/README new file mode 100644 index 0000000..aa83ea6 --- /dev/null +++ b/inst/GUI/README @@ -0,0 +1 @@ +These code fragments do not provide a GUI for mkin. They are purely experimental. diff --git a/inst/unitTests/runit.mkinfit.R b/inst/unitTests/runit.mkinfit.R index e2fc8c3..26007e7 100644 --- a/inst/unitTests/runit.mkinfit.R +++ b/inst/unitTests/runit.mkinfit.R @@ -30,11 +30,11 @@ test.FOCUS_2006_SFO <- function() median.A.SFO <- as.numeric(lapply(subset(FOCUS_2006_SFO_ref_A_to_F, dataset == "A",
c(M0, k, DT50, DT90)), "median"))
- fit.A.SFO.1.r <- as.numeric(c(fit.A.SFO.1$parms.all, fit.A.SFO.1$distimes))
+ fit.A.SFO.1.r <- as.numeric(c(fit.A.SFO.1$parms.all, endpoints(fit.A.SFO.1)$distimes))
dev.A.SFO.1 <- abs(round(100 * ((median.A.SFO - fit.A.SFO.1.r)/median.A.SFO), digits=1))
checkIdentical(dev.A.SFO.1 < 1, rep(TRUE, length(dev.A.SFO.1)))
- fit.A.SFO.2.r <- as.numeric(c(fit.A.SFO.2$parms.all, fit.A.SFO.2$distimes))
+ fit.A.SFO.2.r <- as.numeric(c(fit.A.SFO.2$parms.all, endpoints(fit.A.SFO.2)$distimes))
dev.A.SFO.2 <- abs(round(100 * ((median.A.SFO - fit.A.SFO.2.r)/median.A.SFO), digits=1))
checkIdentical(dev.A.SFO.2 < 1, rep(TRUE, length(dev.A.SFO.2)))
@@ -44,11 +44,11 @@ test.FOCUS_2006_SFO <- function() median.C.SFO <- as.numeric(lapply(subset(FOCUS_2006_SFO_ref_A_to_F, dataset == "C",
c(M0, k, DT50, DT90)), "median"))
- fit.C.SFO.1.r <- as.numeric(c(fit.C.SFO.1$parms.all, fit.C.SFO.1$distimes))
+ fit.C.SFO.1.r <- as.numeric(c(fit.C.SFO.1$parms.all, endpoints(fit.C.SFO.1)$distimes))
dev.C.SFO.1 <- abs(round(100 * ((median.C.SFO - fit.C.SFO.1.r)/median.C.SFO), digits=1))
checkIdentical(dev.C.SFO.1 < 1, rep(TRUE, length(dev.C.SFO.1)))
- fit.C.SFO.2.r <- as.numeric(c(fit.C.SFO.2$parms.all, fit.C.SFO.2$distimes))
+ fit.C.SFO.2.r <- as.numeric(c(fit.C.SFO.2$parms.all, endpoints(fit.C.SFO.2)$distimes))
dev.C.SFO.2 <- abs(round(100 * ((median.C.SFO - fit.C.SFO.2.r)/median.C.SFO), digits=1))
checkIdentical(dev.C.SFO.2 < 1, rep(TRUE, length(dev.C.SFO.2)))
} # }}}
@@ -66,7 +66,7 @@ test.FOCUS_2006_FOMC <- function() median.A.FOMC <- as.numeric(lapply(subset(FOCUS_2006_FOMC_ref_A_to_F, dataset == "A",
c(M0, alpha, beta, DT50, DT90)), "median"))
- fit.A.FOMC.r <- as.numeric(c(fit.A.FOMC$parms.all, fit.A.FOMC$distimes))
+ fit.A.FOMC.r <- as.numeric(c(fit.A.FOMC$parms.all, endpoints(fit.A.FOMC)$distimes))
dev.A.FOMC <- abs(round(100 * ((median.A.FOMC - fit.A.FOMC.r)/median.A.FOMC), digits=1))
dev.A.FOMC <- dev.A.FOMC[c(1, 4, 5)]
checkIdentical(dev.A.FOMC < 1, rep(TRUE, length(dev.A.FOMC)))
@@ -77,7 +77,7 @@ test.FOCUS_2006_FOMC <- function() median.B.FOMC <- as.numeric(lapply(subset(FOCUS_2006_FOMC_ref_A_to_F, dataset == "B",
c(M0, alpha, beta, DT50, DT90)), "median"))
- fit.B.FOMC.r <- as.numeric(c(fit.B.FOMC$parms.all, fit.B.FOMC$distimes))
+ fit.B.FOMC.r <- as.numeric(c(fit.B.FOMC$parms.all, endpoints(fit.B.FOMC)$distimes))
dev.B.FOMC <- abs(round(100 * ((median.B.FOMC - fit.B.FOMC.r)/median.B.FOMC), digits=1))
dev.B.FOMC <- dev.B.FOMC[c(1, 4, 5)]
checkIdentical(dev.B.FOMC < 1, rep(TRUE, length(dev.B.FOMC)))
@@ -88,7 +88,7 @@ test.FOCUS_2006_FOMC <- function() median.C.FOMC <- as.numeric(lapply(subset(FOCUS_2006_FOMC_ref_A_to_F, dataset == "C",
c(M0, alpha, beta, DT50, DT90)), "median"))
- fit.C.FOMC.r <- as.numeric(c(fit.C.FOMC$parms.all, fit.C.FOMC$distimes))
+ fit.C.FOMC.r <- as.numeric(c(fit.C.FOMC$parms.all, endpoints(fit.C.FOMC)$distimes))
dev.C.FOMC <- abs(round(100 * ((median.C.FOMC - fit.C.FOMC.r)/median.C.FOMC), digits=1))
dev.C.FOMC <- dev.C.FOMC[c(1, 4, 5)]
checkIdentical(dev.C.FOMC < 1, rep(TRUE, length(dev.C.FOMC)))
@@ -106,7 +106,7 @@ test.FOCUS_2006_DFOP <- function() median.A.DFOP <- as.numeric(lapply(subset(FOCUS_2006_DFOP_ref_A_to_B, dataset == "A",
c(M0, k1, k2, f, DT50, DT90)), "median"))
- fit.A.DFOP.r <- as.numeric(c(fit.A.DFOP$parms.all, fit.A.DFOP$distimes))
+ fit.A.DFOP.r <- as.numeric(c(fit.A.DFOP$parms.all, endpoints(fit.A.DFOP)$distimes))
dev.A.DFOP <- abs(round(100 * ((median.A.DFOP - fit.A.DFOP.r)/median.A.DFOP), digits=1))
# about 6.7% deviation for parameter f, the others are < 0.1%
checkIdentical(dev.A.DFOP < c(1, 1, 1, 10, 1, 1), rep(TRUE, length(dev.A.DFOP)))
@@ -117,7 +117,7 @@ test.FOCUS_2006_DFOP <- function() median.B.DFOP <- as.numeric(lapply(subset(FOCUS_2006_DFOP_ref_A_to_B, dataset == "B",
c(M0, k1, k2, f, DT50, DT90)), "median"))
- fit.B.DFOP.r <- as.numeric(c(fit.B.DFOP$parms.all, fit.B.DFOP$distimes))
+ fit.B.DFOP.r <- as.numeric(c(fit.B.DFOP$parms.all, endpoints(fit.B.DFOP)$distimes))
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)))
@@ -135,7 +135,7 @@ test.FOCUS_2006_HS <- function() median.A.HS <- as.numeric(lapply(subset(FOCUS_2006_HS_ref_A_to_F, dataset == "A",
c(M0, k1, k2, tb, DT50, DT90)), "median"))
- fit.A.HS.r <- as.numeric(c(fit.A.HS$parms.all, fit.A.HS$distimes))
+ fit.A.HS.r <- as.numeric(c(fit.A.HS$parms.all, endpoints(fit.A.HS)$distimes))
dev.A.HS <- abs(round(100 * ((median.A.HS - fit.A.HS.r)/median.A.HS), digits=1))
# about 6.7% deviation for parameter f, the others are < 0.1%
checkIdentical(dev.A.HS < 1, rep(TRUE, length(dev.A.HS)))
@@ -146,7 +146,7 @@ test.FOCUS_2006_HS <- function() median.B.HS <- as.numeric(lapply(subset(FOCUS_2006_HS_ref_A_to_F, dataset == "B",
c(M0, k1, k2, tb, DT50, DT90)), "median"))
- fit.B.HS.r <- as.numeric(c(fit.B.HS$parms.all, fit.B.HS$distimes))
+ fit.B.HS.r <- as.numeric(c(fit.B.HS$parms.all, endpoints(fit.B.HS)$distimes))
dev.B.HS <- abs(round(100 * ((median.B.HS - fit.B.HS.r)/median.B.HS), digits=1))
# < 10% deviation for M0, k1, DT50 and DT90, others are problematic
dev.B.HS <- dev.B.HS[c(1, 2, 5, 6)]
@@ -158,7 +158,7 @@ test.FOCUS_2006_HS <- function() median.C.HS <- as.numeric(lapply(subset(FOCUS_2006_HS_ref_A_to_F, dataset == "C",
c(M0, k1, k2, tb, DT50, DT90)), "median"))
- fit.A.HS.r <- as.numeric(c(fit.A.HS$parms.all, fit.A.HS$distimes))
+ fit.A.HS.r <- as.numeric(c(fit.A.HS$parms.all, endpoints(fit.A.HS)$distimes))
dev.A.HS <- abs(round(100 * ((median.A.HS - fit.A.HS.r)/median.A.HS), digits=1))
# deviation <= 0.1%
checkIdentical(dev.A.HS < 1, rep(TRUE, length(dev.A.HS)))
@@ -178,9 +178,9 @@ test.FOCUS_2006_SFORB <- function() fit.A.SFORB.1.r <- as.numeric(c(
parent_0 = fit.A.SFORB.1$parms.all[[1]],
- k1 = fit.A.SFORB.1$SFORB[[1]],
- k2 = fit.A.SFORB.1$SFORB[[2]],
- fit.A.SFORB.1$distimes))
+ k1 = endpoints(fit.A.SFORB.1)$SFORB[[1]],
+ k2 = endpoints(fit.A.SFORB.1)$SFORB[[2]],
+ endpoints(fit.A.SFORB.1)$distimes))
dev.A.SFORB.1 <- abs(round(100 * ((median.A.SFORB - fit.A.SFORB.1.r)/median.A.SFORB), digits=1))
# The first Eigenvalue is a lot different from k1 in the DFOP fit
# The explanation is that the dataset is simply SFO
@@ -189,9 +189,9 @@ test.FOCUS_2006_SFORB <- function() fit.A.SFORB.2.r <- as.numeric(c(
parent_0 = fit.A.SFORB.2$parms.all[[1]],
- k1 = fit.A.SFORB.2$SFORB[[1]],
- k2 = fit.A.SFORB.2$SFORB[[2]],
- fit.A.SFORB.2$distimes))
+ k1 = endpoints(fit.A.SFORB.2)$SFORB[[1]],
+ k2 = endpoints(fit.A.SFORB.2)$SFORB[[2]],
+ endpoints(fit.A.SFORB.2)$distimes))
dev.A.SFORB.2 <- abs(round(100 * ((median.A.SFORB - fit.A.SFORB.2.r)/median.A.SFORB), digits=1))
# The first Eigenvalue is a lot different from k1 in the DFOP fit
# The explanation is that the dataset is simply SFO
@@ -207,17 +207,17 @@ test.FOCUS_2006_SFORB <- function() fit.B.SFORB.1.r <- as.numeric(c(
parent_0 = fit.B.SFORB.1$parms.all[[1]],
- k1 = fit.B.SFORB.1$SFORB[[1]],
- k2 = fit.B.SFORB.1$SFORB[[2]],
- fit.B.SFORB.1$distimes))
+ k1 = endpoints(fit.B.SFORB.1)$SFORB[[1]],
+ k2 = endpoints(fit.B.SFORB.1)$SFORB[[2]],
+ endpoints(fit.B.SFORB.1)$distimes))
dev.B.SFORB.1 <- abs(round(100 * ((median.B.SFORB - fit.B.SFORB.1.r)/median.B.SFORB), digits=1))
checkIdentical(dev.B.SFORB.1 < 1, rep(TRUE, length(dev.B.SFORB.1)))
fit.B.SFORB.2.r <- as.numeric(c(
parent_0 = fit.B.SFORB.2$parms.all[[1]],
- k1 = fit.B.SFORB.2$SFORB[[1]],
- k2 = fit.B.SFORB.2$SFORB[[2]],
- fit.B.SFORB.2$distimes))
+ k1 = endpoints(fit.B.SFORB.2)$SFORB[[1]],
+ k2 = endpoints(fit.B.SFORB.2)$SFORB[[2]],
+ endpoints(fit.B.SFORB.2)$distimes))
dev.B.SFORB.2 <- abs(round(100 * ((median.B.SFORB - fit.B.SFORB.2.r)/median.B.SFORB), digits=1))
checkIdentical(dev.B.SFORB.2 < 1, rep(TRUE, length(dev.B.SFORB.2)))
} # }}}
@@ -244,10 +244,10 @@ test.FOCUS_2006_D_SFO_SFO <- function() FOCUS_2006_D_results_schaefer07_means <- c(
parent_0 = 99.65, DT50_parent = 7.04, DT50_m1 = 131.34)
- r.1.e <- c(fit.1.e$parms.all[[1]], fit.1.e$distimes[[1]])
- r.1.d <- c(fit.1.d$parms.all[[1]], fit.1.d$distimes[[1]])
- r.2.e <- c(fit.2.e$parms.all[[1]], fit.2.e$distimes[[1]])
- r.2.d <- c(fit.2.d$parms.all[[1]], fit.2.d$distimes[[1]])
+ r.1.e <- c(fit.1.e$parms.all[[1]], endpoints(fit.1.e)$distimes[[1]])
+ r.1.d <- c(fit.1.d$parms.all[[1]], endpoints(fit.1.d)$distimes[[1]])
+ r.2.e <- c(fit.2.e$parms.all[[1]], endpoints(fit.2.e)$distimes[[1]])
+ r.2.d <- c(fit.2.d$parms.all[[1]], endpoints(fit.2.d)$distimes[[1]])
dev.1.e <- 100 * (r.1.e - FOCUS_2006_D_results_schaefer07_means)/r.1.e
checkIdentical(as.numeric(abs(dev.1.e)) < 1, rep(TRUE, 3))
|