## This WinBUGS code below is for a nested random effects model with 4 covariates for $n$ subjects with $m$ locations recorded for each subject. The subject random effects ## $i$ are independent Bridge random variables, and the location ("tooth") random effects $\epsilon_{ij}$ are multivariate bridge, with exponential spatial correlation matrix ## $\Sigma$. The constants $m$, $n$, the matrix of distances between locations (DIST), and the mathematical constant $\pi$ need to be entered as data in addition to X and Y. model{ for (i in 1:n){ for (j in 1:m){ Y[i,j]~ dbern(pi[i,j]) logit(pi[i,j])<- alpha+X1[i,j]*beta1+ X2[i,j]*beta2+X3[i,j]*beta3+ X4[i,j]*beta4+gam[i]+eps[i,j] # get PHI(theta), P(z