## Benchmark Model 1 ## Modified from Parnell et al. (2013) model { # target data likelihood for(i in 1:N) { Y[i,1:J] ~ dmnorm(mu[i,],OmegaresZ) mu[i,1:J] <- p[i,1:K]%*%s[1:K,1:J,i] } # s - sources for(i in 1:N) { for(k in 1:K) { s[k,1:J,i] ~ dmnorm(muS[,k],OmegaS[,,k]) } } # s contraints for(i in 1:N) { for(k in 1:K) { for (j in 1:J) { positive[k,j,i] ~ dinterval(s[k,j,i], zero) } } } # p - proportions for(i in 1:N) { p[i,1:K] <- expphiV[i,1:K]/sum(expphiV[i,1:K]) phiV[i,1:K] <- phi[i,1:(K-1)]%*%tV for(k in 1:K) { expphiV[i,k] <- exp(phiV[i,k]) } } # phi for(i in 1:N) { for(k in 1:(K-1)) { phi[i,k] ~ dnorm(muphi[k],tauphi[k]) } philast[i] <- -sum(phi[i,1:(K-1)]) } # hyperparameters for phi prior for(k in 1:(K-1)) { muphi[k] ~ dnorm(0,1) tauphi[k] ~ dgamma(2,1) sigma2phi[k] <- 1/tauphi[k] } # Prior on OmegaresZ # combined precision matrix of residual + measurement error OmegaresZ ~ dwish(Rres,kres) SigmaresZ <- inverse(OmegaresZ) }