<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"><meta name="Generator" content="Microsoft Word 14 (filtered medium)"><base href="x-msg://13/"><style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Trebuchet MS";
        panose-1:2 11 6 3 2 2 2 2 2 4;}
@font-face
        {font-family:Times;
        panose-1:2 2 6 3 5 4 5 2 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
span.apple-style-span
        {mso-style-name:apple-style-span;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang="EN-US" link="blue" vlink="purple"><div class="WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi Mollie</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Yes – you’re right. Many thanks for pointing that out. If only it was always that simple!</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">cheers</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Charlotte</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span></p>
<div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Mollie Brooks [mailto:<a href="mailto:mbrooks@ufl.edu">mbrooks@ufl.edu</a>] <br>
<b>Sent:</b> Thursday, September 08, 2011 2:56 PM<br><b>To:</b> Charlotte Boyd<br><b>Cc:</b> <a href="mailto:users@admb-project.org">users@admb-project.org</a><br><b>Subject:</b> Re: [ADMB Users] R2admb with random effects</span></p>
</div></div><p class="MsoNormal"> </p><p class="MsoNormal">Hi Charlotte,</p><div><p class="MsoNormal">I suspect that the pdf is not as up to date as the help file. I checked the help file ?do_admb and saw that there's a parameter called re, but not one called re_vectors.</p>
</div><div><p class="MsoNormal"> </p></div><div><table class="MsoNormalTable" border="0" cellpadding="0" summary="R argblock" style="z-index:auto"><tr><td valign="top" style="padding:.75pt .75pt .75pt .75pt"><p class="MsoNormal">
<code><span style="font-size:10.0pt">"re</span></code><span style="font-family:"Times","serif""></span></p></td><td valign="top" style="padding:.75pt .75pt .75pt .75pt"><p class="MsoNormal"><span style="font-family:"Times","serif"">a named list of the identities and dimensions of any random effects vectors or matrices used in the TPL file</span></p>
</td></tr></table><p class="MsoNormal">"</p><div><p class="MsoNormal">Try replacing "re_vectors" with "re" in your call to do_admb.</p></div><div><p class="MsoNormal">cheers,</p></div><div><p class="MsoNormal">
Mollie</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal"><span style="font-size:13.5pt;font-family:"Helvetica","sans-serif";color:black"><br><br><br></span></p></div><p class="MsoNormal">
 </p><div><div><p class="MsoNormal">On 8 Sep 2011, at 5:26 PM, Charlotte Boyd wrote:</p></div><p class="MsoNormal"><br><br></p><div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">Hi</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">I would like to use R2admb with a random effects model. When I try the toy example in the vignette, I get the following error message:</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">Error in do_admb("test", data = tmpdat, re = TRUE, params = list(beta = rep(0,  :</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">  unused argument(s) (re_vectors = list(u_herd = ncol(Zherd)))</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">I’m using R version 2.13.1 (2011-07-08), and have tried this on other computers and got the same error message. I’ve copied all the code from R2admb.pdf (Bolker, 2011), but for completeness, the code I’m using and the ‘bare-bones’ .tpl file are below. It’s probably something simple I’m missing – I’d appreciate any suggestions on what that is.</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">With many thanks</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">Charlotte</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<div><p class="MsoNormal"><i><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#31849B">Charlotte Boyd</span></i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><i><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#31849B">School of Aquatic and Fishery Sciences</span></i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><i><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#31849B">University of Washington</span></i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><i><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#31849B">1122 NE Boat St Rm 116</span></i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><i><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#31849B">Seattle WA 98105</span></i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">library(R2admb)</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">library(lme4)</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd), family = binomial, data = cbpp)</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">X <- model.matrix(~period,data=cbpp)</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">Zherd <- model.matrix(~herd-1,data=cbpp)</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">tmpdat <- list(X=X,Zherd=Zherd, incidence=cbpp$incidence,size=cbpp$size, nobs=nrow(cbpp))</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">d1 <- do_admb("test",data=tmpdat,re=TRUE,params=list(beta=rep(0,ncol(X)),sigma_herd=0.1),bounds=list(sigma_herd=c(0.0001,20)),re_vectors=list(u_herd=ncol(Zherd)),</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">run.opts=run.control(checkdata="write",checkparam="write"),mcmc=TRUE,mcmc.opts=mcmc.control(mcmcpars=c("beta","sigma_herd")))</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"># .tpl file</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">PARAMETER_SECTION</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">  vector herdvec(1,nobs)</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">  vector eta(1,nobs)</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">  vector mu(1,nobs)</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">PROCEDURE_SECTION</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">  herdvec = sigma_herd*(Zherd*u_herd);</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">  eta = X*beta; // form linear predictor</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">  eta += herdvec; // augment with random effects</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">  mu = pow(1.0+exp(-eta),-1.0); // logistic transform</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">  // binomial log-likelihood (unnormalized)</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">  f -= sum(elem_prod(incidence,log(mu))+</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">  elem_prod(size-incidence,log(1.0-mu)));</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D">  f+=0.5*norm2(u_herd); // log-prior (standard normal)</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span></p>
<p class="MsoNormal"><span style="font-size:13.5pt;font-family:"Helvetica","sans-serif"">_______________________________________________<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></span></p></div></div><p class="MsoNormal"> </p></div></div></body></html>