Here's what I get with some playing around:

* scaling x3 as well as x1 helps considerably (the warning message tells
you about 'component 7' -- there are 3 RE parameters, the 4th fixed effect
parameter is the coefficient for x3) -- no more warnings for model 1,
max|grad| reduced to 0.0017 (from 0.05) on my machine for model 2.

* bobyqa, nloptwrap, nlminb all give the same theta estimates
(getME(.,"theta")) and the same warning for model 2, so there doesn't seem
to be any easy way to fix that.  You might have to live with the warning,
or bump the tolerance up to 0.002.

* I tried removing the g1:g2 random effect (since the g1:g2 variance is
about 1000 times smaller than the other RE components), but that just seems
to push the warning to another place.


On Fri, Jul 4, 2014 at 6:36 AM, bob martin <bobmrtin444@gmail.com> wrote:

> Dear ladies and gents,
>
> I would very much like to ask for some advice regarding the analysis of the
> following example data set provided below. I hope my question is
> appropriate, and not too vague.
>
> I am running a variety of mixed models with random effects included to
> control for nuisance pseudorep (i.e. estimation of random effects is not my
> focus).
>
> On previous versions of R and lme4 I ran the following model with no
> warnings. Now I receive the following sort of warning as standard across
> models in this data set:
>
>
>  mod1 <- glmer(y ~ x1 + x2 + x3 +
>                    x1:x2 + x1:x3 + x2:x3 +
>                    x1:x2:x3 +
>                    (1|g1/g2),
>               data = dummy, family = poisson)
>
>
> Warning message:
> In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
>   Model failed to converge with max|grad| = 0.0113512 (tol = 0.001)
>
>
>  mod2 <- glmer(y ~ x1 + x2 + x3 +
>                    x1:x2 + x1:x3 + x2:x3 +
>                    x1:x2:x3 +
>                    (1|g1/g2) + (1|g3),
>               data = dummy, family = poisson)
>
> Warning message:
> In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
>   Model failed to converge with max|grad| = 0.0774227 (tol = 0.001)
> (i do see problems of overfitting although I am not sure just how bad this
> is)
>
> My main concern is that I am not sure what is causing this warning and
> where potential problems lie, therefore I am not sure how much to worry
> about what lme4 is telling me.
>
> I have tried to read some discussion on this topic, many people seem to be
> having false positives. I have some discussions on this and I understand
> sample size may be an issue, I know sample size is low in this case. Also
> here are some random effect combinations that only occur once, although I
> did not see this as a problem as I assumed it was similar to approximating
> a log-normal poisson distribution.
>
> I have attempted different optimisers e.g.
>
> mod1.bobyqa <- glmer(y ~ x1 + x2 + x3 +
>                    x1:x2 + x1:x3 + x2:x3 +
>                    x1:x2:x3 +
>                    (1|g1/g2),
>                      data = dummy, family = poisson,
>                     control=glmerControl(optimizer="bobyqa"))
>
> mod1.NM <-
> update(mod1.bobyqa,control=glmerControl(optimizer="Nelder_Mead"))
>
> Using bobyqa we receive no warnings and estimates across all optimisers are
> extremely similar.
>
> Any advice on how concerned or where the crucial problem lies would be
> great, best
>
> dummy <- structure(list(g1 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L,
> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L,
> 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L,
> 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
> 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L), .Label = c("1",
> "2", "3", "4", "5", "6"), class = "factor"), g2 = structure(c(1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
> 6L, 6L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 10L, 10L, 10L, 10L,
> 10L, 10L, 10L, 10L, 10L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
> 5L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 9L, 9L, 9L, 9L, 9L,
> 9L, 9L, 9L, 9L, 9L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 11L,
> 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 12L, 12L, 12L, 12L, 12L,
> 12L, 12L, 12L, 12L, 12L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
> 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L), .Label = c("1", "2",
> "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"), class = "factor"),
>     g3 = structure(c(3L, 5L, 7L, 12L, 19L, 35L, 48L, 50L, 61L,
>     68L, 2L, 6L, 21L, 25L, 30L, 37L, 41L, 53L, 59L, 8L, 18L,
>     20L, 28L, 34L, 36L, 51L, 56L, 65L, 11L, 16L, 17L, 23L, 43L,
>     44L, 55L, 66L, 67L, 4L, 13L, 26L, 27L, 31L, 47L, 52L, 58L,
>     69L, 70L, 1L, 9L, 10L, 14L, 22L, 45L, 46L, 57L, 63L, 64L,
>     15L, 24L, 29L, 32L, 33L, 40L, 49L, 54L, 60L, 62L, 6L, 9L,
>     12L, 31L, 73L, 74L, 79L, 86L, 90L, 94L, 5L, 10L, 11L, 13L,
>     71L, 80L, 85L, 89L, 91L, 4L, 19L, 28L, 29L, 75L, 76L, 77L,
>     88L, 92L, 93L, 39L, 72L, 83L, 84L, 87L, 96L, 97L, 98L, 100L,
>     101L, 38L, 42L, 78L, 81L, 82L, 95L, 99L, 102L, 103L), .Label = c("1",
>     "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",
>     "13", "14", "15", "16", "17", "18", "19", "20", "21", "22",
>     "23", "24", "25", "26", "27", "28", "29", "30", "31", "32",
>     "33", "34", "35", "36", "37", "38", "39", "40", "41", "42",
>     "43", "44", "45", "46", "47", "48", "49", "50", "51", "52",
>     "53", "54", "55", "56", "57", "58", "59", "60", "61", "62",
>     "63", "64", "65", "66", "67", "68", "69", "70", "71", "72",
>     "73", "74", "75", "76", "77", "78", "79", "80", "81", "82",
>     "83", "84", "85", "86", "87", "88", "89", "90", "91", "92",
>     "93", "94", "95", "96", "97", "98", "99", "100", "101", "102",
>     "103"), class = "factor"), y = c(5, 4, 0, 0, 5, 2, 10, 10,
>     0, 7, 1, 0, 0, 0, 0, 5, 10, 5, 9, 0, 3, 6, 1, 12, 2, 2, 6,
>     0, 1, 2, 1, 0, 1, 1, 0, 14, 4, 1, 0, 5, 1, 1, 9, 7, 0, 7,
>     4, 1, 1, 2, 5, 0, 2, 2, 1, 0, 0, 2, 0, 4, 0, 0, 9, 4, 1,
>     5, 1, 1, 0, 1, 1, 4, 14, 2, 1, 24, 8, 1, 1, 1, 1, 8, 6, 8,
>     11, 8, 0, 10, 3, 7, 3, 6, 5, 0, 3, 10, 0, 1, 12, 15, 3, 6,
>     0, 11, 9, 3, 1, 0, 8, 7, 21, 0, 1, 9, 9), x1 = c(11L, 12L,
>     8L, 8L, 9L, 3L, 9L, 10L, 5L, 6L, 11L, 4L, 4L, 4L, 9L, 7L,
>     10L, 10L, 6L, 4L, 4L, 10L, 6L, 10L, 4L, 2L, 6L, 4L, 2L, 6L,
>     3L, 1L, 3L, 3L, 1L, 7L, 8L, 8L, 1L, 9L, 6L, 5L, 8L, 11L,
>     1L, 8L, 7L, 6L, 3L, 3L, 9L, 7L, 6L, 8L, 3L, 8L, 9L, 10L,
>     4L, 4L, 5L, 2L, 7L, 8L, 3L, 5L, 1L, 3L, 4L, 2L, 3L, 3L, 9L,
>     3L, 1L, 9L, 11L, 8L, 4L, 7L, 7L, 8L, 8L, 10L, 11L, 8L, 5L,
>     10L, 7L, 9L, 6L, 8L, 6L, 4L, 4L, 10L, 5L, 3L, 8L, 12L, 12L,
>     11L, 10L, 11L, 11L, 10L, 3L, 8L, 11L, 12L, 12L, 4L, 5L, 12L,
>     11L), x2 = c(3.72727272727273, NA, 1.75, 1.75, 2.33333333333333,
>     NA, 5.88888888888889, NA, 2, NA, 5.90909090909091, 1, 2.75,
>     1, 3.44444444444444, NA, NA, NA, 1.66666666666667, 1, NA,
>     NA, NA, NA, 1.5, 2, NA, 1.25, NA, 2.33333333333333, 1, 1,
>     1, NA, 1, NA, NA, 1.75, 1, 3.66666666666667, 2.66666666666667,
>     NA, NA, 3.18181818181818, 1, NA, NA, 1.66666666666667, NA,
>     NA, NA, 1.42857142857143, NA, 2.125, 3, 1.75, 3.66666666666667,
>     1.4, 1, 3, 1.6, 1, NA, NA, 2.33333333333333, NA, NA, NA,
>     1.5, NA, 2, 7.66666666666667, 6.88888888888889, NA, NA,
> 3.55555555555556,
>     NA, NA, 1.5, 1.14285714285714, 1.42857142857143, 2.875, 3.25,
>     4.4, 2.90909090909091, NA, 1.4, NA, 2.28571428571429, NA,
>     NA, NA, 1.33333333333333, 1, NA, NA, 1.6, NA, NA, 5.08333333333333,
>     2.66666666666667, 3.54545454545455, 2.5, 3.81818181818182,
>     NA, 5.4, 1.33333333333333, 1.5, NA, 2.5, 3.75, 1.5, 1, NA,
>     NA), x3 = c(0.151226551226551, 0.180291005291005, 0.140972222222222,
>     0.137996031746032, 0.129276895943563, 0.122619047619048,
>     0.129276895943563, 0.14968253968254, 0.120793650793651,
> 0.190939153439153,
>     0.188311688311688, 0.148809523809524, 0.148809523809524,
>     0.154761904761905, 0.165343915343915, 0.227891156462585,
>     0.173809523809524, 0.182142857142857, 0.246031746031746,
>     0.210714285714286, 0.258333333333333, 0.245952380952381,
>     0.26547619047619, 0.262619047619048, 0.202380952380952,
> 0.238095238095238,
>     0.233333333333333, 0.189880952380952, 0.25, 0.319444444444444,
>     0.333333333333333, 0.2, 0.25, 0.233333333333333, 0.2, 0.35,
>     0.410416666666667, 0.169345238095238, 0.2, 0.205820105820106,
>     0.156349206349206, 0.197142857142857, 0.193154761904762,
>     0.194372294372294, 0.142857142857143, 0.186011904761905,
>     0.193537414965986, 0.165674603174603, 0.150793650793651,
>     0.191666666666667, 0.20489417989418, 0.178741496598639,
> 0.22797619047619,
>     0.223065476190476, 0.136904761904762, 0.177380952380952,
>     0.211243386243386, 0.434285714285714, 0.185714285714286,
>     0.241666666666667, 0.195238095238095, 0.121428571428571,
>     0.191836734693878, 0.230357142857143, 0.147619047619048,
>     0.2, 0.1, 0.175925925925926, 0.181944444444444, 0.180555555555556,
>     0.159259259259259, 0.27037037037037, 0.241975308641975,
> 0.187037037037037,
>     0.25, 0.241975308641975, 0.266161616161616, 0.15625, 0.125,
>     0.176190476190476, 0.176190476190476, 0.165625, 0.160416666666667,
>     0.185833333333333, 0.187878787878788, 0.15625, 0.129126984126984,
>     0.233730158730159, 0.14937641723356, 0.225308641975309,
> 0.128439153439153,
>     0.142162698412698, 0.143253968253968, 0.134027777777778,
>     0.125694444444444, 0.213730158730159, 0.115238095238095,
>     0.128571428571429, 0.121130952380952, 0.13234126984127,
> 0.13234126984127,
>     0.129220779220779, 0.130238095238095, 0.131385281385281,
>     0.131385281385281, 0.127857142857143, 0.14484126984127,
> 0.146577380952381,
>     0.155952380952381, 0.156845238095238, 0.156845238095238,
>     0.163095238095238, 0.139285714285714, 0.156845238095238,
>     0.152922077922078)), .Names = c("g1", "g2", "g3", "y", "x1",
> "x2", "x3"), row.names = c(NA, -115L), class = "data.frame")
>
>
> dummy$x1 <- scale(dummy$x1)
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

	[[alternative HTML version deleted]]

