Xu 2014 SM
R and OpenBUGS code used in: Xu, Hongwei. 2014. "Comparing Spatial and Multilevel Regression Models for Binary Outcomes in Neighborhood Studies." Sociological Methodology 44:229-72.
Note: The R code file with the suffix "simExp_RandomNb" is used to simulate data sets to which various models are fitted.
The other R code files with the suffix "k4_" are used to call the OpenBUGS to fit models to the simulated data. To speed up the computation in the simulation analysis, I used parallel computing: one CPU core to run one of the 4-fold cross-validation, and hence, parallel computing on four cores. You may not need to do parallel computing if you are only analyzing one dataset, which means you need to modify the "k4_" R files.