diff options
author | ranke <ranke@5fad18fb-23f0-0310-ab10-e59a3bee62b4> | 2006-05-12 21:59:33 +0000 |
---|---|---|
committer | ranke <ranke@5fad18fb-23f0-0310-ab10-e59a3bee62b4> | 2006-05-12 21:59:33 +0000 |
commit | 69504b635d388507bce650c44b3bfe17cad3383e (patch) | |
tree | 120114ff6dc2d1aeb4716efef90d71257ac47501 /R/lod.R | |
parent | 6d118690c0cae02fc5cd4b28c1a67eecde4d9f60 (diff) |
- Fixed the inverse prediction
- Now I have a working approach for the calculation of LOD and LOQ,
but it seems to be different from what everybody else is doing
(e.g. Massart chaper 13). I like it, however. Maybe it even
yields a paper.
git-svn-id: http://kriemhild.uft.uni-bremen.de/svn/chemCal@8 5fad18fb-23f0-0310-ab10-e59a3bee62b4
Diffstat (limited to 'R/lod.R')
-rw-r--r-- | R/lod.R | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -0,0 +1,25 @@ +lod <- function(object, ..., alpha = 0.05, k = 1, n = 1, w = "auto") +{ + UseMethod("lod") +} + +loq <- function(object, ..., alpha = 0.05, k = 3, n = 1, w = "auto") +{ + lod(object = object, alpha = alpha, k = k, n = n, w = w) +} + +lod.default <- function(object, ..., alpha = 0.05, k = 1, n = 1, w = "auto") +{ + stop("lod is only implemented for univariate lm objects.") +} + +lod.lm <- function(object, ..., alpha = 0.05, k = 1, n = 1, w = "auto") +{ + f <- function(x) { + y <- predict(object, data.frame(x = x)) + p <- inverse.predict(object, rep(y, n), ws = w, alpha = alpha) + (p[["Prediction"]] - k * p[["Confidence"]])^2 + } + tmp <- optimize(f,interval=c(0,max(object$model$x))) + return(tmp$minimum) +} |