SAS WinBUGS using multiple chains
2009-11-26      
Print from: Zhiyong Zhang \'s Psychometric Website
Address: http://www.psychstat.org/us/article.php/86
SAS WinBUGS using multiple chains

Please cite this using

Zhang, Z., McArdle, J. J., Wang, L., & Hamagami, F. (2008). A SAS interface for Bayesian analysis with WinBUGS. Structural Equation Modeling, 15(4), 705?C728.

Using the linear regression model example (http://www.psychstat.org/us/article.php/73.htm), the method with two chains are specified as following.

/*Create the initial values - Starting values should be carefully chosen.*/

/*Starting values for chain 1*/
DATA _NULL_;
FILE "c:\RegInit1.txt";
PUT "list(b0=0, b1=0, b2=0, Inv_sig2_e=1)";
RUN;

/*Starting values for chain 2*/
DATA _NULL_;
FILE "c:\RegInit2.txt";
PUT "list(b0=5, b1=5, b2=5, Inv_sig2_e=5)";
RUN;

/*Create a script file that includes the command to be used in WinBUGS*/
DATA _NULL_;
FILE "C:\Programs\WinBUGS14\BatchReg.txt";
PUT // @@
#1 "display('log')"
#2 "check('c:/RegModel.txt')"
#3 "data('c:/RegData.txt')"
#4 "compile(2)"
#5 "inits(1, 'c:/RegInit1.txt')"
#6 "inits(2, 'c:/RegInit2.txt')"
#7 "gen.inits()"
#8 "update(2000)"
#9 "set(b0)"
#10 "set(b1)"
#11 "set(b2)"
#12 "set(Sig2_e)"
#13 "dic.set()"
#14 "update(5000)"
#15 "dic.stats()"
#16 "coda(*,'c:/output')"
#17 "save('c:/bugslog.txt')"
#18 "quit()"
;
RUN;

Editor: johnny