diff options
author | ranke <ranke@5fad18fb-23f0-0310-ab10-e59a3bee62b4> | 2014-04-24 16:03:41 +0000 |
---|---|---|
committer | ranke <ranke@5fad18fb-23f0-0310-ab10-e59a3bee62b4> | 2014-04-24 16:03:41 +0000 |
commit | e83723b497d97cfb4e9e3a9803e06c81e7f0b12a (patch) | |
tree | 3cde2d89dcba3d6b07ba79b0562d843e1351c7cb /trunk/chemCal/R/loq.R | |
parent | 763c3bd1f1c9886bb5747b98c9272d3e26bd514d (diff) |
- Added ChangeLog
- Bugfix for lod() for the case of small x values (see ChangeLog)
- Version 0.1-32 as just submitted to CRAN
- Got rid of trunk directory, as I will not find the time to finish what I started there and it
may confuse visitors of viewcvs in kriemhild
git-svn-id: http://kriemhild.uft.uni-bremen.de/svn/chemCal@31 5fad18fb-23f0-0310-ab10-e59a3bee62b4
Diffstat (limited to 'trunk/chemCal/R/loq.R')
-rw-r--r-- | trunk/chemCal/R/loq.R | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/trunk/chemCal/R/loq.R b/trunk/chemCal/R/loq.R deleted file mode 100644 index 5776096..0000000 --- a/trunk/chemCal/R/loq.R +++ /dev/null @@ -1,40 +0,0 @@ -loq <- function(object, ..., alpha = 0.05, k = 3, n = 1, w.loq = "auto", - var.loq = "auto") -{ - UseMethod("loq") -} - -loq.default <- function(object, ..., alpha = 0.05, k = 3, n = 1, w.loq = "auto", - var.loq = "auto") -{ - stop("loq is only implemented for univariate lm objects.") -} - -loq.lm <- function(object, ..., alpha = 0.05, k = 3, n = 1, w.loq = "auto", - var.loq = "auto") -{ - if (length(object$weights) > 0 && var.loq == "auto" && w.loq == "auto") { - stop(paste("If you are using a model from weighted regression,", - "you need to specify a reasonable approximation for the", - "weight (w.loq) or the variance (var.loq) at the", - "limit of quantification")) - } - xname <- names(object$model)[[2]] - yname <- names(object$model)[[1]] - f <- function(x) { - newdata <- data.frame(x = x) - names(newdata) <- xname - y <- predict(object, newdata) - p <- inverse.predict(object, rep(y, n), ws = w.loq, - var.s = var.loq, alpha = alpha) - (p[["Prediction"]] - k * p[["Confidence"]])^2 - } - tmp <- optimize(f,interval=c(0,max(object$model[[2]]))) - loq.x <- tmp$minimum - newdata <- data.frame(x = loq.x) - names(newdata) <- xname - loq.y <- predict(object, newdata) - loq <- list(loq.x, loq.y) - names(loq) <- c(xname, yname) - return(loq) -} |