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 /branches/0.1/chemCal/R/lod.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 'branches/0.1/chemCal/R/lod.R')
-rw-r--r-- | branches/0.1/chemCal/R/lod.R | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/branches/0.1/chemCal/R/lod.R b/branches/0.1/chemCal/R/lod.R index f5bbb7d..5b74418 100644 --- a/branches/0.1/chemCal/R/lod.R +++ b/branches/0.1/chemCal/R/lod.R @@ -1,14 +1,14 @@ -lod <- function(object, ..., alpha = 0.05, beta = 0.05, method = "default") +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") +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") +lod.lm <- function(object, ..., alpha = 0.05, beta = 0.05, method = "default", tol = "default") { if (length(object$weights) > 0) { stop(paste( @@ -21,6 +21,7 @@ lod.lm <- function(object, ..., alpha = 0.05, beta = 0.05, method = "default") )) } xname <- names(object$model)[[2]] + xvalues <- object$model[[2]] yname <- names(object$model)[[1]] newdata <- data.frame(0) names(newdata) <- xname @@ -42,7 +43,8 @@ lod.lm <- function(object, ..., alpha = 0.05, beta = 0.05, method = "default") yd <- pi.y[[1,"lwr"]] (yd - yc)^2 } - lod.x <- optimize(f,interval=c(0,max(object$model[[xname]])))$minimum + 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) |