aboutsummaryrefslogtreecommitdiff
path: root/branches/0.1/chemCal/R/lod.R
diff options
context:
space:
mode:
authorranke <ranke@5fad18fb-23f0-0310-ab10-e59a3bee62b4>2015-08-22 09:03:10 +0000
committerranke <ranke@5fad18fb-23f0-0310-ab10-e59a3bee62b4>2015-08-22 09:03:10 +0000
commitd8d6012e98fb4c7f158bcc7c173407c2b5f3e42e (patch)
tree92bcbbc548431b214fb387e20dc423745b2ab897 /branches/0.1/chemCal/R/lod.R
parent2be973ef45816e04a6a59f59a4fae50f8f17a5e1 (diff)
Get rid of the branched svn layout I never used
git-svn-id: http://kriemhild.uft.uni-bremen.de/svn/chemCal@36 5fad18fb-23f0-0310-ab10-e59a3bee62b4
Diffstat (limited to 'branches/0.1/chemCal/R/lod.R')
-rw-r--r--branches/0.1/chemCal/R/lod.R55
1 files changed, 0 insertions, 55 deletions
diff --git a/branches/0.1/chemCal/R/lod.R b/branches/0.1/chemCal/R/lod.R
deleted file mode 100644
index 5b74418..0000000
--- a/branches/0.1/chemCal/R/lod.R
+++ /dev/null
@@ -1,55 +0,0 @@
-lod <- function(object, ..., alpha = 0.05, beta = 0.05, method = "default", tol = "default")
-{
- UseMethod("lod")
-}
-
-lod.default <- function(object, ..., alpha = 0.05, beta = 0.05, method = "default", tol = "default")
-{
- stop("lod is only implemented for univariate lm objects.")
-}
-
-lod.lm <- function(object, ..., alpha = 0.05, beta = 0.05, method = "default", tol = "default")
-{
- if (length(object$weights) > 0) {
- stop(paste(
- "\nThe detemination of a lod from calibration models obtained by",
- "weighted linear regression requires confidence intervals for",
- "predicted y values taking into account weights for the x values",
- "from which the predictions are to be generated.",
- "This is not supported by the internally used predict.lm method.",
- sep = "\n"
- ))
- }
- xname <- names(object$model)[[2]]
- xvalues <- object$model[[2]]
- yname <- names(object$model)[[1]]
- newdata <- data.frame(0)
- names(newdata) <- xname
- y0 <- predict(object, newdata, interval = "prediction",
- level = 1 - 2 * alpha)
- yc <- y0[[1,"upr"]]
- if (method == "din") {
- y0.d <- predict(object, newdata, interval = "prediction",
- level = 1 - 2 * beta)
- deltay <- y0.d[[1, "upr"]] - y0.d[[1, "fit"]]
- lod.y <- yc + deltay
- lod.x <- inverse.predict(object, lod.y)$Prediction
- } else {
- f <- function(x) {
- newdata <- data.frame(x)
- names(newdata) <- xname
- pi.y <- predict(object, newdata, interval = "prediction",
- level = 1 - 2 * beta)
- yd <- pi.y[[1,"lwr"]]
- (yd - yc)^2
- }
- if (tol == "default") tol = min(xvalues[xvalues !=0]) / 1000
- lod.x <- optimize(f, interval = c(0, max(xvalues) * 10), tol = tol)$minimum
- newdata <- data.frame(x = lod.x)
- names(newdata) <- xname
- lod.y <- predict(object, newdata)
- }
- lod <- list(lod.x, lod.y)
- names(lod) <- c(xname, yname)
- return(lod)
-}

Contact - Imprint