===== Steps ===== - Download [[http://mathstat.helsinki.fi/openbugs/OldBUGS/OpenBUGS220.zip|OpenBUGS]] and upload it to dscratch. First upload it to AFS and then copy it to dscratch. - Unzip the file on the cluster - Create a file called linbugs with the following content and change permission using chmod 755 lingbugs #!/bin/bash export LD_ASSUME_KERNEL=2.4.1 DIR=$(dirname $0) cd "$DIR" if [ \! -e "$DIR/temp" ] ; then mkdir "$DIR/temp" fi if [ -e bugs.so ] ; then ./cbugs "$DIR" "$DIR/temp" "/bugs.so" else ./cbugs "$DIR" "$DIR/temp" "/brugs.so" fi - Create a file called Cbugs and compile it using gcc -o cbugs CBugs.c -ldl -m32 . The file includes the following codes /* GNU General Public Licence This small C program loads the bugs.so ELF shared library. Save it as a .c file and then compile it on Linux using gcc -o cbugs Cbugs.c -ldl */ #include #include #include int main (int argc, char **argv) { void * handle; handle = dlopen("./bugs.so", RTLD_LAZY); if (handle) { dlclose(handle); } return 0; } ===== An example ===== - Start OpenBUGS by ./linbugs in the OpenBUGS directory - If OpenBUGS successfully run, you will see OpenBUGS ClassicBUGS release 2.1.1 type 'modelQuit()' to quit Bugs> - Then type in the following commands (those after >) Bugs> modelCheck("Examples/Airmodel.txt") model is syntactically correct Bugs> modelData("Examples/Airdata.txt") data loaded Bugs> modelCompile() model compiled Bugs> modelInits("Examples/Airinits.txt") model is initialized Bugs> modelUpdate(100000) 100000 updates took 4 s Bugs> samplesSet("theta") monitor set Bugs> summarySet("theta") monitor set Bugs> modelUpdate(10000) 10000 updates took 0 s Bugs> samplesStats("theta") mean sd MC_error val2.5pc median val97.5pc start sample theta[1] -1.1 1.332 0.1092 -5.243 -0.7288 0.2504 101001 10000 theta[2] 0.05332 0.05231 0.004327 0.002579 0.03949 0.2046 101001 10000 Bugs> samplesCoda("*","output") CODA files written Bugs> modelQuit() ===== Useful links ===== - http://web.maths.unsw.edu.au/~tduong/research/rlinbugs.html - http://web.maths.unsw.edu.au/~tduong/research/rlinbugs.html - http://www.hsph.harvard.edu/~paciorek/computingTips/R_code_calling_BUGS_in.html