[R-sig-ME] Warning message after "unscaling" predictor variable

D. Rizopoulos d@r|zopou|o@ @end|ng |rom er@@mu@mc@n|
Wed May 8 09:35:24 CEST 2019


You could also give a try in GLMMadaptive 
(https://drizopoulos.github.io/GLMMadaptive/) that fits the same model 
using the adaptive Gaussian quadrature instead on the Laplace 
approximation. The equivalent code is:

fm <- mixed_model(sum.50 ~ trtmt_simple + julian, random = ~ 1 | site,
                   data = data, family = zi.negative.binomial(),
                   zi_fixed = ~ 1)
summary(fm)

For more examples check here:

https://drizopoulos.github.io/GLMMadaptive/articles/ZeroInflated_and_TwoPart_Models.html

https://drizopoulos.github.io/GLMMadaptive/articles/Goodness_of_Fit.html

Best,
Dimitris



On 5/7/2019 11:17 PM, Rachael Mady wrote:
> Hello,
> 
> I have been successfully using the glmmTMB package, but have come across a
> Warning today that I cannot solve. The data and the code are provided below
> this posting.
> 
> I have been running mixed models with julian date scaled and centered (such
> that it is a z-score; julian2 in the data). Today, I tried to run the same
> models without julian date scaled and centered and received this warning:
> 
> *Warning message:*
> *In nlminb(start = par, objective = fn, gradient = gr, control =
> control$optCtrl) :*
> *  NA/NaN function evaluation*
> 
> To recreate, see the code below. Mod1 is with julian not scaled/centered
> and mod2 is with julian scaled.
> 
> *The data and code to reproduce situation: *
> 
> data <-
> structure(list(sum.50 = c(2L, 1L, 2L, 0L, 0L, 7L, 0L, 6L, 1L,
> 0L, 3L, 8L, 1L, 0L, 2L, 7L, 0L, 0L, 1L, 3L, 2L, 0L, 8L, 9L, 6L,
> 1L, 8L, 8L, 0L, 5L, 0L, 0L, 5L, 3L, 1L, 5L, 2L, 0L, 0L, 2L, 7L,
> 0L, 0L, 7L, 1L, 0L, 5L, 8L, 5L, 3L, 0L, 4L, 8L, 2L, 7L, 0L, 2L,
> 7L, 0L, 1L, 12L, 5L, 0L, 14L, 0L, 5L, 5L, 2L, 6L, 0L, 3L, 1L,
> 0L, 4L, 5L, 1L, 0L, 3L, 9L, 1L, 13L, 0L, 5L, 7L, 8L, 5L, 0L,
> 9L, 11L, 0L, 0L, 4L, 3L, 0L, 4L, 7L, 7L, 7L, 0L, 1L, 5L, 1L),
>      trtmt_simple = structure(c(3L, 1L, 2L, 3L, 1L, 2L, 1L, 2L,
>      3L, 1L, 2L, 3L, 2L, 3L, 1L, 2L, 3L, 1L, 1L, 2L, 3L, 1L, 2L,
>      3L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 2L, 3L,
>      1L, 2L, 3L, 1L, 1L, 2L, 3L, 1L, 2L, 3L, 2L, 3L, 1L, 2L, 3L,
>      1L, 3L, 1L, 2L, 2L, 3L, 1L, 2L, 3L, 1L, 3L, 1L, 2L, 3L, 1L,
>      2L, 1L, 2L, 3L, 1L, 2L, 3L, 3L, 1L, 2L, 3L, 1L, 2L, 1L, 2L,
>      3L, 2L, 3L, 1L, 2L, 3L, 1L, 1L, 2L, 3L, 1L, 2L, 3L, 2L, 3L,
>      1L, 2L, 3L, 1L), .Label = c("control", "constant", "pulsed"
>      ), class = "factor"), site = structure(c(3L, 4L, 5L, 3L,
>      4L, 5L, 8L, 9L, 6L, 8L, 9L, 6L, 1L, 2L, 7L, 1L, 2L, 7L, 4L,
>      5L, 3L, 4L, 5L, 3L, 6L, 8L, 9L, 6L, 8L, 9L, 2L, 7L, 1L, 2L,
>      7L, 1L, 9L, 6L, 8L, 9L, 6L, 8L, 7L, 1L, 2L, 7L, 1L, 2L, 5L,
>      3L, 4L, 5L, 3L, 4L, 6L, 8L, 9L, 1L, 2L, 7L, 1L, 2L, 7L, 3L,
>      4L, 5L, 3L, 4L, 5L, 8L, 9L, 6L, 8L, 9L, 6L, 2L, 7L, 1L, 2L,
>      7L, 1L, 4L, 5L, 3L, 9L, 6L, 8L, 9L, 6L, 8L, 7L, 1L, 2L, 7L,
>      1L, 2L, 5L, 3L, 4L, 5L, 3L, 4L), .Label = c("bakh", "icel",
>      "lid1", "lid2", "lid3", "mtpl", "nemi", "yb01", "yb02"), class =
> "factor"),
>      julian = c(12L, 12L, 12L, 14L, 14L, 14L, 19L, 19L, 19L, 21L,
>      21L, 21L, 26L, 26L, 26L, 28L, 28L, 28L, 33L, 33L, 33L, 35L,
>      35L, 35L, 40L, 40L, 40L, 42L, 42L, 42L, 47L, 47L, 47L, 49L,
>      49L, 49L, 61L, 61L, 61L, 63L, 63L, 63L, 68L, 68L, 68L, 70L,
>      70L, 70L, 75L, 75L, 75L, 77L, 77L, 77L, 84L, 84L, 84L, 89L,
>      89L, 89L, 91L, 91L, 91L, 96L, 96L, 96L, 98L, 98L, 98L, 103L,
>      103L, 103L, 105L, 105L, 105L, 110L, 110L, 110L, 112L, 112L,
>      112L, 119L, 119L, 119L, 124L, 124L, 124L, 126L, 126L, 126L,
>      131L, 131L, 131L, 133L, 133L, 133L, 138L, 138L, 138L, 140L,
>      140L, 140L), julian2 = structure(c(-1.60484310158565,
> -1.60484310158565,
>      -1.60484310158565, -1.55457625178932, -1.55457625178932,
>      -1.55457625178932, -1.42890912729851, -1.42890912729851,
>      -1.42890912729851, -1.37864227750218, -1.37864227750218,
>      -1.37864227750218, -1.25297515301137, -1.25297515301137,
>      -1.25297515301137, -1.20270830321504, -1.20270830321504,
>      -1.20270830321504, -1.07704117872422, -1.07704117872422,
>      -1.07704117872422, -1.0267743289279, -1.0267743289279,
> -1.0267743289279,
>      -0.901107204437083, -0.901107204437083, -0.901107204437083,
>      -0.850840354640757, -0.850840354640757, -0.850840354640757,
>      -0.725173230149941, -0.725173230149941, -0.725173230149941,
>      -0.674906380353615, -0.674906380353615, -0.674906380353615,
>      -0.373305281575658, -0.373305281575658, -0.373305281575658,
>      -0.323038431779332, -0.323038431779332, -0.323038431779332,
>      -0.197371307288516, -0.197371307288516, -0.197371307288516,
>      -0.14710445749219, -0.14710445749219, -0.14710445749219,
>      -0.0214373330013746, -0.0214373330013746, -0.0214373330013746,
>      0.0288295167949516, 0.0288295167949516, 0.0288295167949516,
>      0.204763491082093, 0.204763491082093, 0.204763491082093,
>      0.330430615572909, 0.330430615572909, 0.330430615572909,
>      0.380697465369235, 0.380697465369235, 0.380697465369235,
>      0.506364589860051, 0.506364589860051, 0.506364589860051,
>      0.556631439656377, 0.556631439656377, 0.556631439656377,
>      0.682298564147192, 0.682298564147192, 0.682298564147192,
>      0.732565413943518, 0.732565413943518, 0.732565413943518,
>      0.858232538434334, 0.858232538434334, 0.858232538434334,
>      0.90849938823066, 0.90849938823066, 0.90849938823066, 1.0844333625178,
>      1.0844333625178, 1.0844333625178, 1.21010048700862, 1.21010048700862,
>      1.21010048700862, 1.26036733680494, 1.26036733680494, 1.26036733680494,
>      1.38603446129576, 1.38603446129576, 1.38603446129576, 1.43630131109209,
>      1.43630131109209, 1.43630131109209, 1.5619684355829, 1.5619684355829,
>      1.5619684355829, 1.61223528537923, 1.61223528537923, 1.61223528537923
>      ), .Dim = c(102L, 1L), "`\`scaled:center\``" = 75.8529411764706,
> "`\`scaled:scale\``" = 39.7876534555816)), row.names = c(NA,
> -102L), class = "data.frame")
> 
> # library
> library(glmmTMB)
> 
> # model
> mod1 <- glmmTMB(sum.50 ~ trtmt_simple + julian + (1|site), data = data,
> ziformula=~1, family=nbinom1)
> summary(mod1)
> 
> mod2 <- glmmTMB(sum.50 ~ trtmt_simple + julian2 + (1|site), data = data,
> ziformula=~1, family=nbinom1)
> summary(mod2)
> 
> Thank you very much in advance for your help!
> 
> Cheers,
> Rachael
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mixed-models&data=02%7C01%7Cd.rizopoulos%40erasmusmc.nl%7C91bb409ad91f4855ce9708d6d33177d3%7C526638ba6af34b0fa532a1a511f4ac80%7C0%7C0%7C636928606752416375&sdata=VsIzaPmGoNpEOQ23%2FYVhrVyMDL8SV3oJZYdwvT%2BB%2Faw%3D&reserved=0
> 

-- 
Dimitris Rizopoulos
Professor of Biostatistics
Department of Biostatistics
Erasmus University Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014
Web (personal): http://www.drizopoulos.com/
Web (work): http://www.erasmusmc.nl/biostatistiek/
Blog: http://iprogn.blogspot.nl/


More information about the R-sig-mixed-models mailing list