diff options
author | ranke <ranke@5fad18fb-23f0-0310-ab10-e59a3bee62b4> | 2006-05-23 07:33:22 +0000 |
---|---|---|
committer | ranke <ranke@5fad18fb-23f0-0310-ab10-e59a3bee62b4> | 2006-05-23 07:33:22 +0000 |
commit | f381f9a6a8a47b89ec25cd627833a7248da7932b (patch) | |
tree | 3155c1f5b2f5810a453aa8cb8a8f44f5920b01e8 /R/loq.R | |
parent | e12be874ff477509b737ad09bf05144a7fbedac2 (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.R | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -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) } |