BOBYQA warning message
On 14-05-03 04:18 PM, Devin Kearns wrote:
Hello List: I am getting the following warning message when running a model with BOBYQA optimization. I am not sure how to interpret it: Warning message: In commonArgs(par, fn, control, environment()) : maxfun < 10 * length(par)^2 is not recommended.
You have 32 parameters (20 fixed and 12 random-effects variance-covariance parameters), unless I miscounted. That means that BOBYQA recommends that the maximum number of function evaluations should be at least 10*32^2 = 10240. It's a bit hard to dig out the default value of maxfun, but it's 10000 (so you only missed by a little bit). Arguably lme4 should make this adjustment automatically; someone could add an issue at https://github.com/lme4/lme4/issues if they wanted. Bottom line: * you can use control=glmerControl(optCtrl=list(maxfun=1e5)) to adjust the maximum number of function evaluations. * if @optinfo$feval will tell you how many function evaluations were actually used.
summary(model)
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: wr ~ 1 + a + b + c + d*e + f*e + g*e + h*e + i +
i*k + k*e + l*e + m + (1+f+i|w) + (-1+d|w) + (1+m|x) + (1|y) + (1| z)
Data: m
Control: glmerControl(optimizer = "bobyqa")
AIC BIC logLik deviance df.resid
6198.5 6426.2 -3067.3 6134.5 9058
Scaled residuals:
Min 1Q Median 3Q Max
-10.7164 -0.2638 0.1284 0.3356 10.3950
Random effects:
Groups Name Variance Std.Dev. Corr
(Intercept) 0.189556 0.43538
x m 0.087545 0.29588 0.24
w d 0.385553 0.62093
w.1 (Intercept) 1.673762 1.29374
f 0.045596 0.21353 -0.39
i 0.036892 0.19207 -0.55 -0.36
y (Intercept) 0.005768 0.07595
z (Intercept) 0.000000 0.00000
Number of obs: 9090, groups: x, 202; w, 45; y, 23; z, 6
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.72456 0.21281 8.104 5.32e-16 ***
a 0.29682 0.06380 4.652 3.28e-06 ***
b -0.06976 0.17471 -0.399 0.689698
c 0.12498 0.09981 1.252 0.210496
d 1.00641 0.13625 7.387 1.51e-13 ***
e 1.28465 0.20023 6.416 1.40e-10 ***
f 0.17962 0.08665 2.073 0.038175 *
g 1.30007 0.08096 16.057 < 2e-16 ***
h 0.16457 0.07051 2.334 0.019601 *
i 0.01631 0.07326 0.223 0.823805
k 0.76396 0.21435 3.564 0.000365 ***
l -0.35635 0.19711 -1.808 0.070633 .
m 0.30247 0.22093 1.369 0.170979
d:e 0.08819 0.13846 0.637 0.524198
e:f -0.01060 0.06633 -0.160 0.873059
e:g 0.04057 0.05732 0.708 0.479095
e:h 0.02144 0.05099 0.421 0.674085
i:k 0.14288 0.05095 2.804 0.005045 **
e:k -0.31092 0.19069 -1.630 0.103000
e:l -0.28359 0.22508 -1.260 0.207682
If it is not clear above, "w" and "x" are perfectly crossed effects (there
are no missing values). In multilevel language, "x" is nested within "y"
which is nested within "z".
"a" is continuous and varies across "x".
"b" is binary and varies across "x".
"c" and "d" are binary and vary across "w" and "x".
"e", "k", "l", and "m" are continuous and vary across "w".
"f", "g", "h", "i", and "I" are continuous and vary across "x".
To explain the random intercepts and slopes, these were derived from a model
building procedure that involved the addition of a random slope for each
fixed effect and testing whether the model without the random slope fit
worse than that with it (the idea was to follow the "forward selection"
approach Bates described here:
https://stat.ethz.ch/pipermail/r-sig-mixed-models/2010q2/003921.html).
Correlations were added in the same way. The "maximal" strategy is ideal,
but the model with all possible random slopes and correlations did not
converge, nor did a "near maximal" model. Barr, Levy, Scheepers, and Tily
(2013) suggested that this approach controls Type I error almost as well as
the maximal strategy, which is why it was used here.
It is not clear to me what this warning means or why it occurred. Here were
my initial thoughts:
"z" has almost no variability (and it is a random effect with only six
levels). I was included because the unconditional model without fit worse
than that with it (the p value for the likelihood ratio test was .07, which
is significant for these). I am therefore reluctant to remove this term,
although I suspected the error might relate to the lack of information
related to z.
I also wondered whether the number of "w" covariates was too large given
that I have only 45 "w" cases. I have seen papers where authors have
included more covariates with fewer numbers (I've seen as many as 8
covariates for a random effect with only 39 levels). In logistic regression,
there is the 10:1 rule of thumb for observations to covariates, but there do
not seem to be any such rules of thumb for these models. It is my
understanding that lme4 includes some tests for overfitting, but this seems
to be under development: https://github.com/lme4/lme4/issues/7). So, I
considered the possibility of overfitting (although the standard errors do
not raise concerns).
Of course, "warnings" are not "errors" and it is possible that nothing is
wrong. However, I am reluctant to believe that!
Would anyone be able to explain this warning? Is there something I could do
differently?
Thank you for your time. I am very appreciative of the list's help.
Devin.
[[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models