# Using dmnorm in JAGS

I have a question regarding the use of dmnorm in Jags when none of the mean and variance covariance matrix are known and fixed. I keep getting the error "node Q invalid parent value" I am not sure where the issue comes from. Any idea will be more than welcome! Thanks!

model {
for (i in 1:n) {
mu[i] <- a+b*X[i]
}
va <- (c*VM+diag)
va.p <- inverse(va)
Q ~ dmnorm(mu[], va.p[ , ])
a ~ dnorm(0,0.01)
b ~ dnorm(0,0.01)
c ~ dunif(0.0001,100)
}

-
Could you post all the code? As is, VM and diag do not seem to be defined. – jbowman Dec 7 '11 at 16:17
Hi Sorry. So those are part of the data I'm giving to JAGS. VM is a variance covariance matrix that I got from my data. Except that it has 0 on the diagonal and diag also comes from my data and is the diagonal of the variance covariance matrix. So both of those are given as data. – Bene Dec 7 '11 at 16:48
Please note you cannot expect va to be positive-definite, Bene. When it's not, dmnorm had better complain! It is difficult to make statistical sense of this model, which appears to add a random multiple of the diagonal to all the off-diagonal elements. – whuber Dec 7 '11 at 17:19
Consider a 2x2 matrix x with x[1,1] = x[2,2] = 1 and x[1,2] = x[2,1] = 100. It is symmetric but not positive definite. The diagonal needs to be "big enough" so that you get a positive definite covariance matrix. You could find an upper bound on your parameter c by trying out various values for c in R and checking the eigenvalues of the resulting matrix (eigen(va)\$values); they should all be positive. For good numerical properties, you don't want the ratio between the largest and smallest to be too big, either; less than 10^6 would be good. – jbowman Dec 7 '11 at 18:36
Those are excellent points, @jbowman, and great advice. However, the whole idea of forming a prior by separating the variance matrix like this is suspect. Rather than fixing it up, which may make the software run (but produce erroneous results), it might be more productive to explore the bigger picture of what this model is attempting to do in the first place. – whuber Dec 7 '11 at 19:36