# [ADMB Users] multiple random effects vectors with correlated Gaussian priors

Ian Fiske ianfiske at gmail.com
Fri Mar 26 13:36:22 PDT 2010

```Hi all,

I am working on a model with multiple latent spatial Gaussian random
effects.  Because of the spatial nature of the model, I am trying to
incorporate spatially correlated random effects, but have some
questions in trying to do so.

(*) Following section 4.5 in the ADMB-RE manual, I should define the
covariance matrix inside a SEPARABLE_FUNCTION.  However, the "spatial"
example defines a NORMAL_PRIOR_FUNCTION instead, but I don't see this
anywhere in the manual.  Are NORMAL_PRIOR_FUNCTION and
SEPARABLE_FUNCTION equivalent constructs?  The spatial example also
defines a regular FUNCTION called "evaluate_M" that calls the
NORMAL_PRIOR_FUNCTION.  This all seems fairly undocumented, so I'm
wondering if this is the necessary way to write these types of models.
I've googled and can't seem to find much on these models in ADMB.

(*) Is it possible to specify correlated priors for multiple vectors
of random effects?  For example, suppose that for a simple regression

y_i = b0 + b1*x_i + eps_i

that both b0 and b1 vary spatially as in a spatially-varying
coefficients model.  Then I would like to specify

b0_i = b0 + u0_i
b1_i = b1 + u1_i

so that there are 2 vectors of random effects -- one for the intercept
and one for the slope.  Is it possible to specify 2 normal_prior
statements and 2 corresponding NORMAL_PRIOR_FUNCTIONs, one for each
random effect vector?  When I tried to do this, I got "Shape error in
get_Lxu" out of the function df1b2_normal_prior_M::get_Lxu().  I've
attached the template file and simulated data the produces this error.
In this attached tpl, I have 2 random effects vectors, but only
specify one to have a correlated prior, and still get the shape error.

(*)  Is it possible to construct a concentrated likelihood for the
fixed effects when computations are done inside of a
SEPARABLE_FUNCTION?  I've tried to think of how to adapt Dave's
earlier posted

init_bounded_number u(-0.5,1.5)
g = 0.5*norm2(mu_r);
dvariable r2=norm2(y - Ey);
dvariable vhat=r2*u/nobs;
g += 0.5*nobs*log(vhat) + 0.5*r2/vhat;

But this seems impossible if Ey and u are cluster-specific.  Am I
missing something or can we only benefit from the concentrated
likelihood when the Hessian is unstructured?

Sorry for the barrage of questions!  I appreciate any tips -- everyone
was very helpful in response to my last post.
Ian

--
Ian Fiske
PhD Candidate
Department of Statistics
North Carolina State University
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sim_spatial_route.dat
Type: application/octet-stream
Size: 920208 bytes
Desc: not available