[R-sig-ME] multiple errors when using glmmADMB

Mollie Brooks mollieebrook@ @ending from gm@il@com
Fri Jul 27 13:24:25 CEST 2018


Hi Udita,

breeding.success is between 0 and 1. Therefore it is not Poisson or negative binomial. Even if it could be Poisson or negative binomial, you cannot compare models with and without weights as this is equivalent to the models having different sets of observations. You may need to read background information on GLM(M)s or seek local advice…unless someone else has more time.

The only valid models below are 

> gm1 <- glmer(breeding.success ~ laying.date.julian.day.zscale + tmean.zscale + (1|YEAR) , 
>             data = hungary_breeding, family = binomial, weights = CSIZE)

and 

> m_tmb <- glmmTMB(breeding.success ~ laying.date.julian.day.zscale + tmean.zscale + (1|YEAR) , 
>                 data = hungary_breeding, ziformula = ~1, family = binomial, weights = CSIZE)

The DHARMa graph shows that there’s a problem with your model, but without knowing which model, it’s hard to say. Reading this vignette will be helpful https://cran.r-project.org/web/packages/DHARMa/vignettes/DHARMa.html

cheers,
Mollie

> On 27Jul 2018, at 12:41, Bansal, Udita <udita.bansal17 using imperial.ac.uk> wrote:
> 
> Hi Mollie,
> 
> Thanks again for the ideas and explanation. I am not sure about how to interpret the output from the DHARMa package. I got the graph attached herewith.
> 
> I had run a few models with glmmTMB and a simple one with glmer.
> 
> m_tmb <- glmmTMB(breeding.success ~ laying.date.julian.day.zscale + tmean.zscale + (1|YEAR) , 
>                 data = hungary_breeding, ziformula = ~1, family = binomial, weights = CSIZE)
> 
> tmb_poisson <- glmmTMB(breeding.success ~ laying.date.julian.day.zscale + tmean.zscale + (1|YEAR) , 
>                       data = hungary_breeding, ziformula = ~1, family = poisson)
> 
> tmb_nbinom1 <- glmmTMB(breeding.success ~ laying.date.julian.day.zscale + tmean.zscale + (1|YEAR) , 
>                      data = hungary_breeding, ziformula = ~1, family = nbinom1)
> ## Warning message: In fitTMB(TMBStruc) : Model convergence problem; false convergence (8). See vignette('troubleshooting')
> 
> tmb_nbinom2 <- glmmTMB(breeding.success ~ laying.date.julian.day.zscale + tmean.zscale + (1|YEAR) , 
>                       data = hungary_breeding, ziformula = ~1, family = nbinom2) ## same warning as above
> 
> gm1 <- glmer(breeding.success ~ laying.date.julian.day.zscale + tmean.zscale + (1|YEAR) , 
>             data = hungary_breeding, family = binomial, weights = CSIZE)
> 
> The AIC looks as follows: 
> 
> AIC(m_tmb, tmb_poisson, tmb_nbinom1, tmb_nbinom2, gm1)
>                  df      AIC
> m_tmb            5   489.2653
> tmb_poisson  5   333.4137
> tmb_nbinom1  6 335.3694
> tmb_nbinom2  6 335.4137
> gm1                  4   764.4029
> 
> This makes me think it should one of the models with the lower AIC?
> 
> Thanks
> Udita
> 
> On 27/07/18, 10:52 AM, "Mollie Brooks" <mollieebrooks using gmail.com> wrote:
> 
>    Hi Udita,
> 
>    It’s unlikely (but possible) that you’ll need to handle zero inflation. You could test for it using the DHARMa package. Here’s an example of doing that with binomial data.
> 
>    library(DHARMa)
>    library(lme4)
>    gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
>                   data = cbpp, family = binomial)
>    simulationOutput <- simulateResiduals(fittedModel = gm1, n=1000)
>    testZeroInflation(simulationOutput)
> 
>    If you do have zero-inflation, then you could use glmmTMB for models like this
> 
>    #nest failure equally possible for all observations
>    m1 <- glmmTMB(cbind(No.of.chicks, Clutch.size-No.of.chicks)~ laying.date.julian.day.zscale + tmean.zscale + (1|YEAR),  zi=~1, data = hungary_breeding, , family = binomial)
> 
>    #nest failure varies randomly by year
>    m2 <- glmmTMB(cbind(No.of.chicks, Clutch.size-No.of.chicks)~ laying.date.julian.day.zscale + tmean.zscale + (1|YEAR),  zi=~(1|YEAR), data = hungary_breeding, , family = binomial)
> 
>    #nest failure varies with tmean.zscale
>    m3 <- glmmTMB(cbind(No.of.chicks, Clutch.size-No.of.chicks)~ laying.date.julian.day.zscale + tmean.zscale + (1|YEAR),  zi=~ tmean.zscale, data = hungary_breeding, , family = binomial)
> 
>    cheers,
>    Mollie
> 
> 
>> On 27Jul 2018, at 11:28, Bansal, Udita <udita.bansal17 using imperial.ac.uk> wrote:
>> 
>> Hi Mollie,
>> 
>> Thanks a lot, I have tried that and it runs the model. My concern is that I cannot include zero inflation of the data in this model. Any ideas for that?
>> 
>> Cheers
>> Udita
>> 
>> On 27/07/18, 9:47 AM, "Mollie Brooks" <mollieebrooks using gmail.com> wrote:
>> 
>>   Hi Udita, 
>> 
>>   It looks like this is binomial data. You probably want logistic regression like this
>> 
>>   library(lme4)
>>   m_glmer <- glmer(cbind(No.of.chicks, Clutch.size-No.of.chicks)~ laying.date.julian.day.zscale + tmean.zscale + (1|YEAR),  data = hungary_breeding, , family = binomial)
>> 
>>   cheers,
>>   Mollie
>> 
>>> On 26Jul 2018, at 22:03, Bansal, Udita <udita.bansal17 using imperial.ac.uk> wrote:
>>> 
>>> I am measuring breeding success as number of chicks produced out of number of eggs laid. So, the values range from 0 to 1 including decimal values. Although, that was just a warning. Should I be too concerned about that?
>>> 
>>> My model statement is as follows: 
>>> m_admb <- glmmadmb( breeding.success ~ laying.date.julian.day.zscale + tmean.zscale + (1|YEAR) , 
>>>                  data = hungary_breeding, zeroInflation = TRUE, family = "nbinom", link = "logit")
>>> 
>>> Summary for relevant columns of my data: 
>>> 
>>> YEAR       No.of.chicks          Clutch.size        laying_date             tmean            prec       
>>> 1988:16   Min.   :0.000   Min.   :2.000   Min.   :1988-04-22   Min.   : 3.45   Min.   : 0.000  
>>> 1989:25   1st Qu.:0.000   1st Qu.:3.000   1st Qu.:1990-05-07   1st Qu.:11.35   1st Qu.: 0.000  
>>> 1990:45   Median :0.000   Median :3.000   Median :1991-05-09   Median :15.12   Median : 0.000  
>>> 1991:65   Mean   :1.021   Mean   :2.946   Mean   :1991-05-24   Mean   :14.62   Mean   : 2.285  
>>> 1992:46   3rd Qu.:3.000   3rd Qu.:3.000   3rd Qu.:1992-05-15   3rd Qu.:17.95   3rd Qu.: 1.050  
>>> 1993:24   Max.   :3.000   Max.   :3.000   Max.   :1994-06-16   Max.   :27.05   Max.   :55.200  
>>> 1994:19                                                                                        
>>> breeding.success clutch.volume   laying.date.julian.day   tmean.zscale.V1      prec.zscale.V1   
>>> Min.   :0.0000   Min.   :15.82   Min.   : 82.0          Min.   :-2.5607265   Min.   :-0.559014  
>>> 1st Qu.:0.0000   1st Qu.:24.60   1st Qu.:115.0          1st Qu.:-0.7638887   1st Qu.:-0.559014  
>>> Median :0.0000   Median :25.89   Median :129.0          Median : 0.0947269   Median :-0.559014  
>>> Mean   :0.3438   Mean   :25.52   Mean   :132.3          Mean   :-0.0190444   Mean   : 0.006583  
>>> 3rd Qu.:1.0000   3rd Qu.:27.06   3rd Qu.:148.2          3rd Qu.: 0.7372670   3rd Qu.: 0.209975  
>>> Max.   :1.0000   Max.   :29.83   Max.   :186.0          Max.   : 2.8070422   Max.   : 3.762186  
>>> 
>>> laying.date.julian.day.zscale.V1
>>> Min.   :-2.2850626              
>>> 1st Qu.:-0.7846733              
>>> Median :-0.1481445              
>>> Mean   : 0.0000000              
>>> 3rd Qu.: 0.7270826              
>>> Max.   : 2.4434370              
>>> 
>>> I will try glmmTMB as well now.
>>> 
>>> Thanks
>>> Udita
>>> 
>>> On 26/07/18, 7:41 PM, "R-sig-mixed-models on behalf of Ben Bolker" <r-sig-mixed-models-bounces using r-project.org on behalf of bbolker using gmail.com> wrote:
>>> 
>>> 
>>>    The first thing that pops  out is the "non-integer response values in
>>>  discrete family" warning.  How are you measuring breeding success?  Can
>>>  you show us your whole glmmadmb() statement, and maybe a summary() of
>>>  the relevant columns of your data set?
>>> 
>>>     I'll also make the now-blanket statement that you may have better
>>>  luck moving forward with glmmTMB.
>>> 
>>>    cheers
>>>      Ben Bolker
>>> 
>>>  On 2018-07-26 12:57 PM, Bansal, Udita wrote:
>>>> Hi all,
>>>> 
>>>> I was trying to use the glmmADMB package but ran into some errors. I’ve
>>>> noticed that other people have run into similar errors but there doesn’t
>>>> seem to be a solution online. It would be great help if anyone could
>>>> provide any insights on it.
>>>> 
>>>> I am using it for running a zero-inflated mixed-effects binomial model.
>>>> The errors are as follows:
>>>> 
>>>> Parameters were estimated, but standard errors were not: the most likely
>>>> problem is that the curvature at MLE was zero or negative
>>>> Error in glmmadmb(breeding.success ~ laying.date.julian.day.zscale +
>>>> tmean.zscale +  :
>>>> The function maximizer failed (couldn't find parameter file)
>>>> Troubleshooting steps include (1) run with 'save.dir' set and inspect
>>>> output files; (2) change run parameters: see '?admbControl';(3) re-run
>>>> with debug=TRUE for more information on failure mode
>>>> In addition: Warning messages:
>>>> 1: In glmmadmb(breeding.success ~ laying.date.julian.day.zscale +
>>>> tmean.zscale +  :
>>>> non-integer response values in discrete family
>>>> 2: running command './glmmadmb -maxfn 500 -maxph 5 -noinit -shess' had
>>>> status 1
>>>> 
>>>> Any kind of help will be greatly appreciated.
>>>> 
>>>> Bests
>>>> Udita Bansal
>>>> 
>>>> 
>>>> 	[[alternative HTML version deleted]]
>>>> 
>>>> _______________________________________________
>>>> R-sig-mixed-models using r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>> 
>>> 
>>>  _______________________________________________
>>>  R-sig-mixed-models using r-project.org mailing list
>>>  https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>> 
>>> 
>>> _______________________________________________
>>> R-sig-mixed-models using r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>> 
>> 
>> 
> 
> 
> 
> <Screen Shot 2018-07-27 at 11.33.37 AM.png>


	[[alternative HTML version deleted]]



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