[ADMB Users] help with glmm.admb negative binomial multilevel model

Mollie Brooks mbrooks at ufl.edu
Thu Sep 22 19:11:36 PDT 2011

Hi Matt,
Type in ?glmmadmb and if you're using the latest version, there should be this 

random	a formula specifying the random effects. A single random effect may be specified as ~x|g, but parentheses must be used if more than one random effect is specified (e.g.,~(x1|g1)+(x2|g2)).

If you don't see that, then you need to download the newer version before you can do multiple random effects. 
To get the latest version, follow directions on this web page

The website says the new version has a "new formula format, similar to that of the lme4 package, where random and fixed effects are specified as part of a single formula (random can also be specified separately, as in lme)" 

So, if you want a random intercept for each student and class, you would do
> output <- glmm.admb(Y~Treat+ (1|class)+ (1|student) ,family="nbinom", data=mydata)

or if you think the different classes and students will be affected differently by the treatment levels, you may want
> output <- glmm.admb(Y~Treat+ (Treat|class)+ (Treat|student) ,family="nbinom", data=mydata)
but this requires a larger dataset because it fits more parameters (random intercept and random slope).


Mollie Brooks
Ph.D. Candidate
Biology Department
University of Florida
mbrooks at ufl.edu

On 22 Sep 2011, at 9:40 PM, Matthew Kraft wrote:

> Hi,
> I am struggling to understand the syntax for fitting a negative binomial multilevel model using glmm.admb.  I have conducted a cluster-randomized trial with longitudinal data where students are nested in classes and observations over time are nested within students.  My outcomes have a negative binomial distribution.
> I would like to fit a model where I model Y = Treat with nested random effects for classes and students.
> my question:
> 1) in the random statement how do I specific multiple nested random effects?   Is is random= ~class: student
> 2) I don't understand the "group" argument.  The documentation say that this is a string naming the main nesting variable.  Would that be students or classes in my case?  When it says it must be a factor what does that mean?
> My general thought is to specify the model as
> output <- glmm.admb(Y~Treat, random=~class: student , group="???",family="nbinom", data=mydata)
> Any specific help you can provide about coding would be greatly appreciated.
> Best,
> Matt
> --
> Matthew Kraft
> Doctoral Candidate in Quantitative Policy Analysis
> Harvard Graduate School of Education
> _______________________________________________
> Users mailing list
> Users at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20110922/3d8849a5/attachment.html>

More information about the Users mailing list