<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">oops, I meant glmmadmb without the dot.<div>
</div>
<br><div><div>On 22 Sep 2011, at 10:11 PM, Mollie Brooks wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi Matt,</div>Type in ?glmmadmb and if you're using the latest version, there should be this <div><br></div><div><table summary="R argblock" style="font-family: Times; "><tbody><tr valign="top"><td><code>random</code></td><td>a formula specifying the random effects. A single random effect may be specified as <code>~x|g</code>, but parentheses must be used if more than one random effect is specified (e.g.,<code>~(x1|g1)+(x2|g2)</code>).</td></tr></tbody></table><div><br></div><div>If you don't see that, then you need to download the newer version before you can do multiple random effects. </div><div>To get the latest version, follow directions on this web page</div><div><a href="http://glmmadmb.r-forge.r-project.org/">http://glmmadmb.r-forge.r-project.org/</a></div><div><br></div><div>The website says the new version has a "<span class="Apple-style-span" style="font-family: sans-serif; ">new formula format, similar to that of the </span><span class="Apple-style-span" style="font-family: sans-serif; "><tt>lme4</tt></span><span class="Apple-style-span" style="font-family: sans-serif; "> package, where random and fixed effects are specified as part of a single formula (</span><span class="Apple-style-span" style="font-family: sans-serif; "><tt>random</tt></span><span class="Apple-style-span" style="font-family: sans-serif; "> can also be specified separately, as in </span><span class="Apple-style-span" style="font-family: sans-serif; "><tt>lme</tt></span><span class="Apple-style-span" style="font-family: sans-serif; ">)" </span></div><div><span class="Apple-style-span" style="font-family: sans-serif; "><br></span></div><div><span class="Apple-style-span" style="font-family: sans-serif; ">So, if you want a random intercept for each student and class, you would do</span></div><div><span class="Apple-style-span" style="font-family: sans-serif; "><blockquote type="cite" style="font-family: Helvetica; "><div>output <- glmm.admb(Y~Treat+ (1|class)+ (1|student) ,family="nbinom", data=mydata)</div></blockquote><br></span></div><div><span class="Apple-style-span" style="font-family: sans-serif; ">or if you think the different classes and students will be affected differently by the treatment levels, you may want</span></div><div><span class="Apple-style-span" style="font-family: sans-serif; "><blockquote type="cite" style="font-family: Helvetica; "><div>output <- glmm.admb(Y~Treat+ (Treat|class)+ (Treat|student) ,family="nbinom", data=mydata)</div></blockquote>but this requires a larger dataset because it fits more parameters (random intercept and random slope).</span></div><div><span class="Apple-style-span" style="font-family: sans-serif; "><br></span></div><div><span class="Apple-style-span" style="font-family: sans-serif; ">best,</span></div><div><font class="Apple-style-span" face="sans-serif">Mollie</font></div><div><font class="Apple-style-span" face="sans-serif"><br></font></div><br><div></div></div><div>
<span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">Mollie Brooks<br>Ph.D. Candidate<br>NSF IGERT Fellow<br>Biology Department<br>University of Florida<br><a href="mailto:mbrooks@ufl.edu">mbrooks@ufl.edu</a><br><a href="http://people.biology.ufl.edu/mbrooks">http://people.biology.ufl.edu/mbrooks</a><br><br><br><br></span>
</div>
<br><div><div>On 22 Sep 2011, at 9:40 PM, Matthew Kraft wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi,</div>
<div> </div>
<div>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.</div>
<div> </div>
<div>I would like to fit a model where I model Y = Treat with nested random effects for classes and students.</div>
<div> </div>
<div>my question:</div>
<div> </div>
<div>1) in the random statement how do I specific multiple nested random effects? Is is random= ~class: student </div>
<div> </div>
<div>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?</div>
<div> </div>
<div>My general thought is to specify the model as</div>
<div> </div>
<div>output <- glmm.admb(Y~Treat, random=~class: student , group="???",family="nbinom", data=mydata)</div>
<div> </div>
<div>Any specific help you can provide about coding would be greatly appreciated.<br></div>
<div>Best,</div>
<div> </div>
<div>Matt</div>
<div> </div>
<div>--</div>
<div>Matthew Kraft<br>Doctoral Candidate in Quantitative Policy Analysis<br>Harvard Graduate School of Education<br></div><br>
_______________________________________________<br>Users mailing list<br><a href="mailto:Users@admb-project.org">Users@admb-project.org</a><br><a href="http://lists.admb-project.org/mailman/listinfo/users">http://lists.admb-project.org/mailman/listinfo/users</a><br></blockquote></div><br></div>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@admb-project.org">Users@admb-project.org</a><br>http://lists.admb-project.org/mailman/listinfo/users<br></blockquote></div><br></body></html>