[R-sig-ME] [ADMB Users] negative binomial mixed model with crossed and random effects

Ben Bolker bbolker at gmail.com
Wed Nov 23 23:48:43 CET 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11-11-23 01:17 PM, Sharif S. Aly wrote:
> Thanks Ben,
> Appreciate your prompt response. Thanks for alerting me this should be
> on the r-sig-mixed-models list. I am including my earlier post below.
> If you allow me, may I follow with these questions:
> 
> /On 11/23/2011 5:09 AM, Ben Bolker wrote:/
>> /On Tue, Nov 22, 2011 at 11:17 PM, Sharif S. Aly<saly at ucdavis.edu> 
>> wrote:
>> /
>>> /Greetings,
>>> I am interested in RE variance estimates from a negative binomial mixed
>>> model. My model has a random intercept, no fixed effects, 4 random
>>> effects:
>>> time, collector, location, facility. RE location is nested in
>>> facility. Also
>>> RE location is crossed with time and collector. After studying several
>>> examples I came up with this syntax, is it correct:
>>>
>>> glmmadmb(formula = Counts ~ 1 + (1 | time) + (1 | collector) + (1 |
>>> facility) + (1 | facility:location), data = Data, family = "nbinom",
>>> link = "log")
>>>
>>> Coefficients:
>>>              Estimate Std. Error z value Pr(>|z|)
>>> (Intercept)    1.952      0.356    5.49  4.1e-08 ***
>>> ---
>>> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>>>
>>> Number of observations: total=180, =3, =2, =4, =44
>>> /
>> /
>>     These numbers of levels (there is a bug in the assignment of names
>> here, which I'm
>> working on fixing) indicate that it's probably a little bit dicey to
>> fit random effects to
>> the time, collector, facility levels (fewer than 5 or 6 levels is
>> usually problematic:
>> see http://glmm.wikidot.com/faq )
>> /
> 
> I am not sure I follow your comment, is it the (1|facility:location)
> that may be problematic? I did check the wiki you forwarded, perhaps it
> should be (1|facility/location)?

  No, the problem is that fitting random effects with fewer than 5 or 6
observations (levels) is dicey.  Not impossible, but dicey.

>> /
>> /
>>> /Random effect variance(s):
>>> $time
>>>              (Intercept)
>>> (Intercept)  2.9696e-09
>>> /
>> /
>>    Note that this variance is effectively zero
>> /
>>> /
>>> $collector
>>>              (Intercept)
>>> (Intercept)  0.00047214
>>> /
>> /
>>    This one is four orders of magnitude less than the next largest (so
>> the sd is two
>> orders of magnitude less)
>> /
>>> /
>>> $facility
>>>              (Intercept)
>>> (Intercept)     0.26907
>>>
>>> $`facility:location`
>>>              (Intercept)
>>> (Intercept)       1.352
>>>
>>> Negative binomial dispersion parameter: 1.379 (std. err.: 0.19336)
>>>
>>> Log-likelihood: -570.014
>>>
>>> If we think of r and p as the negative binomial parameters, how can I
>>> estimate "r" for such a complex dataset?
>>> /
>> /
>>     What do mean by r?  The overdispersion parameter? Recent versions of
>> glmmADMB (at least) describe the parameterization of the NB in ?glmmadmb;
>> see above where it says "negative binomial dispersion parameter"
>> /
> I guess I interpreted the over-dispersion parameter as exposure.  I can
> see that also being number of failures, so my guess would be that r is
> the over dispersion parameter then.

  Yes.

> I am interested in r as I need to calculate the variance of the
> expectation of Y, which includes p and r.
>> /
>> /
>>> /
>>> I would also like to estimate P, would you agree that it can be
>>> estimated
>>> as:
>>>
>>> P =exponentiation of
>>> (intercept+RE_facility+RE_location+RE_collector+RE_time)
>>>
>>> Sharif
>>> /
>> /
>>     Yes, more or less.  That should be RE_facility:location, shouldn't
>> it?/
> 
> Correct, RE_facility:location
>> /
>>
>>    Questions about glmmADMB should really go to the
>> r-sig-mixed-models at r-project.org
>> mailing list, because they are generally a little bit more R-specific ...
>>
>>    Ben Bolker/
> 
> Many thanks for your and any others comments.
> Sharif

  If you are interpreting this as a discrete-time survival process (less
typical in ecological situations than interpreting it as count process
with latent heterogeneity), you will have to work backward from the
estimate of mu (which is your exponentiated value of the random effects
above) to p: since the mean is mu=p*r/(1-p) and you know mu and r you
can easily do the algebra.

  Ben Bolker

> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOzXhLAAoJED2whTVMEyK9rcgH/AzdfdDHy7WQhqQC0kDnLTvp
/WkiTQKdp0a760gSn6L6J4Qal/vmWqZge+MBuMmf/DRvZKDV3Fo/vckBHR5CsioN
pfViaEllzE1Jmqv3lRgNk+5Qf6qBUQfZZKchAVivFHT26d0UmvACxqBIl6mILiqN
paipL2BTcJ9x9YPJ28uBT+eepNTzZzvXUYewk9f6pKcCHzUlIrHqqa8aVUP1S4tH
wp6ZO5pbmrFqW9OaiUpOagdKwxuuVdlguoGAOWrCw1ARMZ6F95RsbO/cX4w0p9zs
geViQW/6dcf86+wNc9sRRRDJyrbI9IKpwQiJr9Hm3vnk7pBocGxQtjcIIVnQk+g=
=kpd5
-----END PGP SIGNATURE-----




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