2

We are using the the metafor package for meta analysis. In one of our analyses we got the error:

Fisher scoring algorithm did not converge

We tried using this code to adjust it:

res <- rma(yi, vi, data=dat, (control = list(stepadj = 0.5)))

It worked in the past, but now it is not working, even when changing the code to:

res <- rma(yi, vi, data=dat, (control = list(stepadj = 0.5, maxiter=10000)))

We are still getting the same error:

Fisher scoring algorithm did not converge

user438383
  • 5,716
  • 8
  • 28
  • 43
Anat
  • 21
  • 2

1 Answers1

2

Don't add the superfluous parentheses. This should work:

res <- rma(yi, vi, data=dat, control=list(stepadj=0.5, maxiter=10000))
Wolfgang
  • 2,810
  • 2
  • 15
  • 29
  • that's interesting. Why does it make a difference in this context? – Ben Bolker Aug 17 '21 at 20:53
  • 1
    The parentheses turn the `(control = ...)` part into an unnamed argument, so it ends up getting matched by position to who-knows what ... Try this: `f <- function(x, y, z) { if (!missing(x)) print(paste("x =", x)); if (!missing(y)) print(paste("y =", y)); if (!missing(z)) print(paste("z =", z)) }` and then `f(1, z=3)` versus `f(1, (z=3))`. – Wolfgang Aug 17 '21 at 21:11
  • 1
    a nice counterexample to "you can put parentheses around anything and it doesn't change the meaning" – Ben Bolker Aug 17 '21 at 21:12
  • Yeah, had to think about that one for a bit, but now it makes sense. – Wolfgang Aug 17 '21 at 21:14