aboutsummaryrefslogtreecommitdiff
path: root/R/loq.R
diff options
context:
space:
mode:
authorranke <ranke@5fad18fb-23f0-0310-ab10-e59a3bee62b4>2006-05-23 07:33:22 +0000
committerranke <ranke@5fad18fb-23f0-0310-ab10-e59a3bee62b4>2006-05-23 07:33:22 +0000
commitf381f9a6a8a47b89ec25cd627833a7248da7932b (patch)
tree3155c1f5b2f5810a453aa8cb8a8f44f5920b01e8 /R/loq.R
parente12be874ff477509b737ad09bf05144a7fbedac2 (diff)
Don't do calplot and lod for linear models from weighted
regression any more, since this is not supported (PR#8877). git-svn-id: http://kriemhild.uft.uni-bremen.de/svn/chemCal@13 5fad18fb-23f0-0310-ab10-e59a3bee62b4
Diffstat (limited to 'R/loq.R')
-rw-r--r--R/loq.R16
1 files changed, 13 insertions, 3 deletions
diff --git a/R/loq.R b/R/loq.R
index c493a64..ee22d38 100644
--- a/R/loq.R
+++ b/R/loq.R
@@ -10,11 +10,21 @@ loq.default <- function(object, ..., alpha = 0.05, k = 3, n = 1, w = "auto")
loq.lm <- function(object, ..., alpha = 0.05, k = 3, n = 1, w = "auto")
{
+ xname <- names(object$model)[[2]]
+ yname <- names(object$model)[[1]]
f <- function(x) {
- y <- predict(object, data.frame(x = x))
+ newdata <- data.frame(x = x)
+ names(newdata) <- xname
+ y <- predict(object, newdata)
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)
+ 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)
}

Contact - Imprint