This folder contains 5 files used to illustrate the Bayesian mediation analysis using the BUGS. 1. BayesianMediation.r: the R code to run the BUGS codes for single-level and multilevel Bayesian mediation analysis. It calls other four files in below. 2. simplemed.txt: the BUGS code for single-level mediation analysis. 3. mlmed.txt: the BUGS code for multilevel mediation analysis. 4. firefighters.txt: the data file for the single-level mediation example. 5. firefighters_simple.txt: the simplified data file for the single-level mediation example, only including the required variables y, m and x. Note that m and x are centered. 6. kennydata.txt: the data file for the multilevel mediation example.