0

I can't seem to suppress the warning Maximizing -- use negfn and neggr produced by this function:

results_sigma <- optimx(par=sigma_guess, fn=myloglikelihood, lower=0,
                        control=list(dowarn=FALSE,maximize=T),method="L-BFGS-B")

I tried both suppressWarnings() and suppressMessages() but to no avail.

even after setting the logical control dowarn=FALSE.

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121
remykarem
  • 2,251
  • 22
  • 28
  • It doesn't look like a warning. Rather just an informative message. What happens if you wrap `suppressMessages` around it? – IRTFM Feb 21 '15 at 01:54
  • @BondedDust Tried that and `suppressWarnings()` but still doesn't work. – remykarem Feb 21 '15 at 16:13

1 Answers1

0

I know its a very old question, but:

invisible(capture.output( your call ))
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Julio
  • 1
  • Hi, welcome to Stackoverflow. `invisible` wrapping `capture.output` on the optimx call would return `NULL`, whereas the OP clearly wants results given his `results_sigma <-` approach; but without annoying warnings about using a function call intended for minimizing to maximize (where warnings seem unavoidable). Your approach has value, though perhaps not in this instance. – Chris Apr 22 '21 at 18:04