Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(rjags)
- mod_cat <- "model{
- # for(i in 1:n){
- # y[i,1:2] ~ dmnorm.vcov(mu[], Sigma[1:2,1:2])
- # }
- mu[1] <- 0
- mu[2] <- 0
- IndA ~ dcat(PInd[])
- PInd[1] <- 0.33333
- PInd[2] <- 0.33333
- PInd[3] <- 0.33333
- z ~ dnorm(0, pow(0.5, -2))T(T1[IndA],T2[IndA])
- rho <- tanh(z)
- sigma_11 ~ dgamma(1, 1/5)
- sigma_22 ~ dgamma(1, 1/5)
- Sigma[1,1] <- pow(sigma_11, 2)
- Sigma[2,2] <- pow(sigma_22, 2)
- Sigma[1,2] <- (rho[1] * sigma_11 * sigma_22)
- Sigma[2,1] <- Sigma[1,2]
- TauM[1] <- pow(0.001, -2);
- TauM[2] <- pow(0.4, - 2);
- T1[1] <- -0.01
- T1[2] <- 0
- T1[3] <- -1
- T2[1] <- 0.01
- T2[2] <- 1
- T2[3] <- 0
- }"
- fit <- jags.model(textConnection(mod_cat))
- codaSamples = coda.samples(fit,
- variable.names=c("IndA", "rho"),
- n.iter= 500000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement