Open nlubock opened 5 years ago
I have the same problem. Is there any update on this? I iterate over drm with purrr::map and use tryCatch to continue after an error occurs. This works. However, the error message is still printed, which messes up my progress bar.
Hello, the error message comes from ‘optim()’ that is wrapped inside drc. I do not think it can be silenced from drc.
Thank you for your answer. I already noticed that the problem is optim()
. As far as I could see, it is called at least in drmOpt()
which is called in drm()
. However, it looks like the error of optim()
is intended to be silenced since it is wrapped in try()
with the option silent = TRUE
. So this seems to be a bug. The only intended error message here seems to be "Convergence failed" which is part of drmOpt()
.
drmOpt <- function (opfct, opdfct1, startVec, optMethod, constrained, warnVal,
upperLimits, lowerLimits, errorMessage, maxIt, relTol, opdfct2 = NULL,
parmVec, traceVal, silentVal = TRUE, matchCall)
{
options(warn = warnVal)
if (is.null(opdfct2)) {
hes <- TRUE
}
else {
hes <- FALSE
}
psVec <- abs(startVec)
psVec[psVec < 1e-04] <- 1
{
if (!is.null(opdfct1)) {
if (constrained) {
nlsObj <- try(optim(startVec, opfct, opdfct1,
hessian = hes, method = "L-BFGS-B", lower = lowerLimits,
upper = upperLimits, control = list(maxit = maxIt,
reltol = relTol, parscale = psVec)), silent = silentVal)
}
else {
nlsObj <- try(optim(startVec, opfct, opdfct1,
hessian = hes, method = optMethod, control = list(maxit = maxIt,
reltol = relTol, parscale = psVec)), silent = silentVal)
}
.....
Hello,
I do not think that the error in ‘optim()’ can be silenced by using the try() construct, as it originates from an external C-based routine and it is directly printed to the console (as far as I know). So I am incline to think that this is not a bug in drm. However, if you find a solution to silence it (perhaps from the authors of drc?), I’ll be happy to learn that.
All the best
Andrea
On Jul 9, 2020, at 8:52 AM, jpquast notifications@github.com wrote:
Thank you for your answer. I already noticed that the problem is optim(). As far as I could see, it is called at least in drmOpt() which is called in drm(). However, it looks like the error of optim() is intended to be silenced since it is wrapped in try() with the option silent = TRUE. So this seems to be a bug. The only intended error message here seems to be "Convergence failed" which is part of drmOpt().
drmOpt <- function (opfct, opdfct1, startVec, optMethod, constrained, warnVal, upperLimits, lowerLimits, errorMessage, maxIt, relTol, opdfct2 = NULL, parmVec, traceVal, silentVal = TRUE, matchCall) { options(warn = warnVal) if (is.null(opdfct2)) { hes <- TRUE } else { hes <- FALSE } psVec <- abs(startVec) psVec[psVec < 1e-04] <- 1 { if (!is.null(opdfct1)) { if (constrained) { nlsObj <- try(optim(startVec, opfct, opdfct1, hessian = hes, method = "L-BFGS-B", lower = lowerLimits, upper = upperLimits, control = list(maxit = maxIt, reltol = relTol, parscale = psVec)), silent = silentVal) } else { nlsObj <- try(optim(startVec, opfct, opdfct1, hessian = hes, method = optMethod, control = list(maxit = maxIt, reltol = relTol, parscale = psVec)), silent = silentVal) }
..... — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/DoseResponse/drc/issues/7#issuecomment-655937508, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIXJNIUV75XOWZH4N6VJEFTR2VSK3ANCNFSM4GYZHRZQ.
I'm trying to silence all
drm
output, but it appears to be ignoring the options set indrmc
. For example:results in the output:
Session Info