<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"><meta name="Generator" content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Trebuchet MS";
        panose-1:2 11 6 3 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-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;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Trebuchet MS","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@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-family:"Trebuchet MS","sans-serif";color:#1F497D">Hi </span></p><p class="MsoNormal">
<span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="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></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">Error in do_admb("test", data = tmpdat, re = TRUE, params = list(beta = rep(0,  : </span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">  unused argument(s) (re_vectors = list(u_herd = ncol(Zherd)))</span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="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></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">With many thanks</span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">Charlotte</span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p>
<p class="MsoNormal"><i><span style="font-family:"Trebuchet MS","sans-serif";color:#31849B">Charlotte Boyd</span></i></p><p class="MsoNormal"><i><span style="font-family:"Trebuchet MS","sans-serif";color:#31849B">School of Aquatic and Fishery Sciences</span></i></p>
<p class="MsoNormal"><i><span style="font-family:"Trebuchet MS","sans-serif";color:#31849B">University of Washington</span></i></p><p class="MsoNormal"><i><span style="font-family:"Trebuchet MS","sans-serif";color:#31849B">1122 NE Boat St Rm 116</span></i></p>
<p class="MsoNormal"><i><span style="font-family:"Trebuchet MS","sans-serif";color:#31849B">Seattle WA 98105</span></i></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">library(R2admb)</span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">library(lme4)</span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd), family = binomial, data = cbpp)</span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">X <- model.matrix(~period,data=cbpp)</span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">Zherd <- model.matrix(~herd-1,data=cbpp)</span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">tmpdat <- list(X=X,Zherd=Zherd, incidence=cbpp$incidence,size=cbpp$size, nobs=nrow(cbpp))</span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="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></p>
<p class="MsoNormal"><span style="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></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"># .tpl file</span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">PARAMETER_SECTION</span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">  vector herdvec(1,nobs)</span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">  vector eta(1,nobs)</span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">  vector mu(1,nobs)</span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">  </span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">PROCEDURE_SECTION</span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">  herdvec = sigma_herd*(Zherd*u_herd);</span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">  eta = X*beta; // form linear predictor</span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">  eta += herdvec; // augment with random effects</span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">  mu = pow(1.0+exp(-eta),-1.0); // logistic transform</span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">  // binomial log-likelihood (unnormalized)</span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">  f -= sum(elem_prod(incidence,log(mu))+</span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">  elem_prod(size-incidence,log(1.0-mu)));</span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D">  f+=0.5*norm2(u_herd); // log-prior (standard normal)</span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-family:"Trebuchet MS","sans-serif";color:#1F497D"> </span></p>
</div></body></html>