Nothing
require(ncar)
# Regression test for the expected-value comparator in pdfPQ(), which carries the same
# code as NonCompart::PQNCA(). A parameter that was NA on BOTH sides - not estimable for
# that profile, and not expected to be - was counted as a difference, so feeding the
# analysis its own output back in as `expected` produced "expected-values DIFFER" and an
# overall NOT QUALIFIED for a correct analysis.
Fail = function(msg) stop(paste("Test Failed!", msg))
pdfOut = tempfile(fileext = ".pdf")
on.exit(unlink(pdfOut), add = TRUE)
d = data.frame(ID = rep(1:2, each = 6),
Time = rep(c(0, 1, 2, 4, 8, 24), 2),
Conc = c(0, 10, 16, 12, 8, 1,
0, 0, 5, 0, 0, 0))
r = NonCompart::tblNCA(d, key = "ID", colTime = "Time", colConc = "Conc", dose = 1, R2ADJ = 0)
if (!is.na(r$LAMZHL[2])) Fail("fixture is wrong: subject 2 should have no terminal phase")
expected = r[, c("ID", "CMAX", "AUCLST", "AUCIFO", "LAMZHL")]
pq = pdfPQ(fileName = pdfOut, concData = d, key = "ID", colTime = "Time", colConc = "Conc",
dose = 1, R2ADJ = 0, expected = expected)
bad = Filter(function(e) !isTRUE(e$ok), pq$expected)
if (length(bad) > 0) {
Fail(paste("self-comparison reported", length(bad), "difference(s); first:",
bad[[1]]$param, "expected =", bad[[1]]$exp, "observed =", bad[[1]]$obs))
}
if (!isTRUE(pq$reproducible)) Fail("re-running the same analysis was reported as irreproducible")
## a genuine disagreement must still be caught
e2 = expected
e2$AUCLST[1] = e2$AUCLST[1] * 2
pq = pdfPQ(fileName = pdfOut, concData = d, key = "ID", colTime = "Time", colConc = "Conc",
dose = 1, R2ADJ = 0, expected = e2)
bad = Filter(function(e) !isTRUE(e$ok), pq$expected)
if (length(bad) != 1) Fail(paste("a doubled AUCLST should be 1 difference, got", length(bad)))
if (bad[[1]]$param != "AUCLST") Fail(paste("wrong parameter flagged:", bad[[1]]$param))
cat("Test-pdfPQ.R: OK\n")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.