[ADMB Users] Poisson GLMM example

Mark Payne mpa at aqua.dtu.dk
Thu Jun 14 09:34:45 PDT 2012

Dear Hans Skaug and ADMBers,

I have been following the work on with implementing a Poisson GLMM on the ADMB website. I have an application that is more or less exactly a Poisson GLMM with spatial autocorrelation, and I was wondering if you might be able to answer a couple of questions about the Poisson GLMM example on the webpage. i.e. here

In particular, I am confused about the implementation of the actual model in ADMB. As I understand it, you are using the NORMAL_PRIOR_FUNCTION to impose the condition that the random effects associated with each point are multivariate normal, with a mean given by the predictor function, and a variance - covariance matrix that is exponentially decaying with the distance between the variables. However, in the NORMAL_PRIOR_FUNCTION:

NORMAL_PRIOR_FUNCTION void get_M(const dvariable& _a)
  int i,j;
  dvar_matrix tmpM(1,n,1,n);

  for (i=1;i<=n;i++)
    for ( j=1;j<i;j++)
      tmpM(i,j)=exp(-_a*dd(i,j));                       // Exponentially decaying correlation

the matrix that you create, tmpM, only ends up being an exponentially decaying correlation matrix - where do you convert this to a variance-covariance matrix (e.g. by multiplying it by the variance s²? Should the normal_prior be specified as a correlation matrix or a vcov matrix?

Similarly, I am also confused about what it is that actually induces the evaluation of the matrix M. Further down in spatial.tpl, there is another function:

FUNCTION void evaluate_M(void)


However, at no-point can I see where the evaluate_M function is actually called..

I'm sure that there are relatively simple answer to these questions, but I hope that they will shed some light on this rather dark corner of my understanding!

Best wishes,

Mark Payne

More information about the Users mailing list