[R-sig-ME] Negative Binomial in glmmadmb

Philipp Singer killver at gmail.com
Fri Jul 1 21:53:21 CEST 2016

Exactly as you would do it in glmmADMB, just replace ADMB with TMB...

Check the github examples: 

On 01.07.2016 21:47, Chad Newbolt wrote:
> Thanks so much for the response.  I know this is probably very simple but how do I denote the family as negative binomial using glmmTMB?  I've dug through text regarding this package and have had trouble coming up with anything that works.
> Chad
> ________________________________________
> From: R-sig-mixed-models <r-sig-mixed-models-bounces at r-project.org> on behalf of Ben Bolker <bbolker at gmail.com>
> Sent: Thursday, June 30, 2016 7:45 PM
> To: r-sig-mixed-models at r-project.org
> Subject: Re: [R-sig-ME] Negative Binomial in glmmadmb
> Chad Newbolt <newboch at ...> writes:
> [snip]
>> Since I have evidence for overdispersion, I'm using negative
>> binomial distribution as opposed to Poisson.  My two questions are:
>> 1) When I fit using the following global zero inflation model I
>> receive the following error:
>> fit1=glmmadmb(Fawn~Age+I(Age^2)+BodySize+SSCM+AvgAge+Age*AvgAge+
>    I(Age^2)*AvgAge+BodySize*AvgAge+SSCM*AvgAge+(1|Sire),
>     data=datum,family="nbinom",zeroInflation = TRUE)
> I think you can shorten this a bit to
> (Age+I(Age^2)+BodySize+SSCM)*AvgAge + (1|Sire)
>> 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(Fawn ~ Age + I(Age^2) + BodySize + SSCM + AvgAge +
>> Age * : 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 message: running command
>> 'C:\windows\system32\cmd.exe /c glmmadmb -maxfn 500 -maxph 5 -noinit
>> -shess' had status 1
>> However, when I change to zeroInflation = FALSE, I receive no
>>   warnings and everything seems to go as should.
>> Does this simply mean that my data is not zero inflated, hence the
>> zero inflated model will not run, or is this something I should be
>> concerned about and investigate the cause further?  When I debug I
>> see the following warning....Warning -- Hessian does not appear to
>> be positive definite Hessian does not appear to be positive
>> definite.
>> 2) When fitting more simple versions(predictors removed) I receive
>> the same error as above when using the family=nbinom; however these
>> errors disappear when using family=nbinom1.  Is this indicative of
>> an underlying problem or am I OK to use the ouput from the later
>> family where variance = ??.  Thanks, Chad [[alternative HTML version
>> deleted]]
>    Short answer: you should be a little concerned, and you should
> not assume that your data are not zero-inflated. These are not
> indications about what your model is actually finding, just indications
> that ADMB ran into *some* kind of trouble. Unfortunately,
> there is no really simple guide to trouble-shooting these kinds of
> problems.  Some general suggestions:
> * try out the glmmTMB package - it's newer/experimental, but
> often more stable
> * the ?admbControl man page suggests trying shess=FALSE and noinit=FALSE
> * it may not help in this case, but centering continuous predictors is
> always worth a shot
> * similarly, poly(Age,2) is a little more stable than (Age+I(Age^2))
> * inspect your data graphically to see whether there are outliers
> or other odd patterns that might be messing up the fit
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

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