# varying-intercept, varying-slope radon model for earnings by ethnicity # modeling the correlation model { for (i in 1:n){ y[i] ~ dnorm (y.hat[i], tau.y) y.hat[i] <- a[eth[i]] + b[eth[i]]*x[i] } tau.y <- pow(sigma.y, -2) sigma.y ~ dunif (0, 100) for (j in 1:n.eth){ a[j] <- B[j,1] b[j] <- B[j,2] B[j,1:2] ~ dmnorm (B.hat[j,], Tau.B[,]) B.hat[j,1] <- mu.a B.hat[j,2] <- mu.b } mu.a~ dnorm (0, .0001) mu.b ~ dnorm (0, .0001) Tau.B[1:2,1:2] <- inverse(Sigma.B[,]) Sigma.B[1,1] <- pow(sigma.a, 2) sigma.a ~ dunif (0, 100) Sigma.B[2,2] <- pow(sigma.b, 2) sigma.b ~ dunif (0, 100) Sigma.B[1,2] <- rho*sigma.a*sigma.b Sigma.B[2,1] <- Sigma.B[1,2] rho ~ dunif (-1, 1) }