SHARE
TWEET

Untitled

a guest Sep 17th, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. svss <- "model{
  2.  
  3. for(i in 1:n){
  4. y[i] ~ dnorm(yhat[i], shat[i])
  5. yhat[i] <-  (u[ID[i], 1]) + (X[i] * u[ID[i], 2])
  6. shat[i] <-  exp(u[ID[i], 3] + (X[i] * u[ID[i], 4]))
  7. }
  8.  
  9. for(i in 1:J){
  10. u[i,1:4] ~ dmnorm.vcov(bhat[i,], Sigma[1:4,1:4])
  11. bhat[i,1] <- beta[1]
  12. bhat[i,2] <- beta[2]
  13. bhat[i,3] <- beta[3]
  14. bhat[i,4] <- beta[4]
  15. }
  16.  
  17.  
  18. beta[1] ~ dnorm(0, 1)
  19. beta[2] ~ dnorm(0, pow(0.25, - 2))
  20. beta[3] ~ dnorm(0, 1)
  21. beta[4] ~ dnorm(0, 1)
  22.  
  23. sigma_11 ~  dgamma(1, 1/5)
  24. sigma_22 ~  dgamma(1, 1/5)
  25. sigma_33 ~  dgamma(1, 1/5)
  26. sigma_44 ~  dgamma(1, 1/5)
  27.  
  28. Sigma[1,1] <- pow(sigma_11, 2)
  29. Sigma[2,2] <- pow(sigma_22, 2)
  30. Sigma[3,3] <- pow(sigma_33, 2)
  31. Sigma[4,4] <- pow(sigma_44, 2)
  32.  
  33. Sigma[1,2] <- (rhoNS[1] * sigma_11 * sigma_22)
  34. Sigma[2,1] <- Sigma[1,2]
  35.  
  36. Sigma[1,3] <- (rho[2] * sigma_11 * sigma_33)
  37. Sigma[3,1] <- Sigma[1,3]
  38.  
  39. Sigma[1,4] <- (rho[3] * sigma_11 * sigma_44)
  40. Sigma[4,1] <- Sigma[1,4]
  41.  
  42.  
  43. Sigma[2,3] <- (rho[4] * sigma_22 * sigma_33)
  44. Sigma[3,2] <- Sigma[2,3]
  45.  
  46.  
  47. Sigma[2,4] <- rho[5] * sigma_22 * sigma_33
  48. Sigma[4,2] <- Sigma[2,4]
  49.  
  50.  
  51. Sigma[3,4] <- (rhoNS[2] * sigma_33 * sigma_44)
  52. Sigma[4,3] <- Sigma[3,4]
  53.  
  54.  
  55.  
  56. for(i in 2:5){
  57. IndA[i] ~ dcat(PInd[])
  58. Ind[i] <- IndA[i] - 1
  59. z[i] ~ dnorm(0, TauM[IndA[i]])
  60. rho[i] <- tanh(z[i])
  61. }
  62.  
  63. zNS[1] ~ dnorm(0, pow(0.5, -2))
  64. zNS[2] ~ dnorm(0, pow(0.5, -2))
  65. rhoNS[1] <- tanh(zNS[1])
  66. rhoNS[2] <- tanh(zNS[2])
  67.  
  68.  
  69. TauM[1] <- pow(0.01, -2);    
  70. TauM[2] <- pow(0.5, - 2);
  71. PInd[1] <- 0.5;    
  72. PInd[2] <- 0.5;  
  73.  
  74. }"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top