I'm experimenting with JAGS. I've been trying to set up a sampler that uses a multivariate Gaussian. I based my code on a 1-dim Gaussian sampler (that works). Here is the model:
model {
# Likelihood:
for(i in 1:N){
y[i, 1:M] ~ dmnorm( mu[i, 1:M], tau[i, 1:M, 1:M] )
mu[i, 1:M] <- muOfTopic[ topic[i], 1:M ]
tau[i, 1:M, 1:M] <- tauOfTopic[ topic[i], 1:M, 1:M ]
topic[i] ~ dcat( pTopic[doc[i], 1:Ntopic] )
}
# Prior:
for(j in 1:Ntopic){
muOfTopic[j, 1:M] ~ dmnorm(zerosLengthNtopic, tauOfTopic[j, 1:M, 1:M]*ikappa)
tauOfTopic[j, 1:M, 1:M] ~ dwish(iPsi, nu)
}
for(m in 1:Ndocs){
pTopic[m, 1:Ntopic] = ddirch(alpha)
}
}
I specify values for N, M, Ntopic, Ndocs, zerosLengthM, ikappa, iPsi, nu, alpha, y (an array of vectors of dim M), and doc (an array of scalars). I also pass initial values for pTopic, muOfTopic, and tauOfTopic.
When I try to run the model I get the following error:
Node tau[1,1:200,1:200] overlaps previously defined nodes
I know that the values in tau are assigned using <-, but the same thing seemed to work in 1-dim, and seems to work for mu.
Aucun commentaire:
Enregistrer un commentaire