Dear Martyn, dear JAGS experts,

the context of my question is a model for meta-analysis of dependent effect sizes. At some point, I want to calculate the inverse of a variance-covariance matrix (to supply to `dmnorm`

later on). So I am using an array for this purpose and a vector that gives the dimension of the current array. A minimal example is as follows:

model{ for(i in 1:2){ Omega[i,1:msize[i],1:msize[i]] <- inverse(R[i,1:msize[i],1:msize[i]) } }

Here the data is (as `R`

code):

R <- array(NA, dim = c(2,2,2)) R[1,1,1] <-1 R[1,2,2] <-1 R[1,2,1] <-0.5 R[1,1,2] <-0.5 R[2,1,1] <-1 R[2,2,2] <-NA R[2,2,1] <-NA R[2,1,2] <-NA msize <- c(2,1)

The trouble is, that `inverse`

does not like one dimensional matrices (only during RUNTIME though): `RUNTIME ERROR: Non-conforming parameters in function inverse`

I tried the old step-function trick to emulate an if-statement http://www.mrc-bsu.cam.ac.uk/bugs/faqs/contents.shtml#q15 but the JAGS compiler seems to check the dimension nevertheless.

I would be very grateful for a work-around that does not involve splitting the data and having two separate likelihoods, as I want to keep the code compact.

Is there a special reason that inverse does not work on one-dimensional matrices?

Thanks for reading this far,

Philipp