[ADMB Users] R2admb with random effects

Charlotte Boyd boydchar at uw.edu
Thu Sep 8 14:26:34 PDT 2011


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:

Error in do_admb("test", data = tmpdat, re = TRUE, params = list(beta =
rep(0,  :

  unused argument(s) (re_vectors = list(u_herd = ncol(Zherd)))

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.

With many thanks


*Charlotte Boyd*

*School of Aquatic and Fishery Sciences*

*University of Washington*

*1122 NE Boat St Rm 116*

*Seattle WA 98105*



gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
family = binomial, data = cbpp)

X <- model.matrix(~period,data=cbpp)

Zherd <- model.matrix(~herd-1,data=cbpp)

tmpdat <- list(X=X,Zherd=Zherd, incidence=cbpp$incidence,size=cbpp$size,

d1 <-


# .tpl file


  vector herdvec(1,nobs)

  vector eta(1,nobs)

  vector mu(1,nobs)


  herdvec = sigma_herd*(Zherd*u_herd);

  eta = X*beta; // form linear predictor

  eta += herdvec; // augment with random effects

  mu = pow(1.0+exp(-eta),-1.0); // logistic transform

  // binomial log-likelihood (unnormalized)

  f -= sum(elem_prod(incidence,log(mu))+


  f+=0.5*norm2(u_herd); // log-prior (standard normal)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20110908/1f998263/attachment.html>

More information about the Users mailing list