BUGS Utility for Spreadsheets



The BUGS Utility for Spreadsheets (BUS) converts BUGS output into an importable format for spreadsheet-based programs such as Excel. By default, BUGS writes all of the values of the monitored nodes into a long column of values1. BUS reads in BUGS output files, and then writes a file in which each monitored node is placed in a separate column. In this format, each node is easily treated as a separate variable by a variety of programs including Excel and other spreadsheet-based programs. BUS output is also easy to import to database programs such as Access, or to other Windows-based statistical packages such as SAS for Windows or SPSS.

Why BUS?
BUGS and WinBUGS are powerful and flexible programs. Their functionality has been further augmented by software such as CODA and BOA. Still, it is of occasional (and sometimes regular) interest to import the results of a BUGS run into another software package to capitalize on that package's capabilities. BUS can help to automate this task.

While it is originally designed to work with spreadsheet-based programs, BUS could be conceivably used in other tasks. For example, it may be of interest to import BUGS output into Mathematica for graphing. BUS could be used in an intermediary fashion. The output from BUS could then be readily formatted to integrate into Mathematica, even though Mathematica is not a spreadsheet-based package.

BUS could also be used in an educational context in conjuction with the BUGS software in a course on Bayesian methods. BUS can be used to import BUGS output into Excel, which may be a more user-friendly environment for further summarization or processing.

Operation:
Read: BUS reads two files that follow the Classic BUGS conventions for BUGS output. The first file is a *.out file that contains a long column of the values of the monitored nodes. In Classic BUGS this is called bugs.out by default. The second file is a *.ind file that indexes the *.out file. In Classic BUGS this is called bugs.ind by default.

If WinBUGS is being used, the CODA button from the Sample Monitor Tool can be used to create the appropriate files. The two files must share the same name, such as myfile.ind and myfile.out. Make sure to save the index file in Text format with a .ind extension. Similarly, save the long column of values in Text format with a .out extension. Note that WinBUGS may append a .txt extension to the files. If this happens, the files will need to be renamed so that they have the correct extensions.

Specify the *.out file to be read by typing in its path and name, without the .out extension. For example, to read the bugs.out file in the c:\bugs directory, enter c:\bugs\bugs. Alternatively, you can browse for the file. BUS will look for and read the associated *.ind file.

Note that reading the Classic BUGS file named bugs1.out will not produce the desired result.

Write: Clicking on Write will cause BUS to write a file named bugsout.txt to the directory where the input files are located. This file is a tab-delimited text file with each variable in its own column, and is ready to be imported.


Program Details:
BUS is written in Visual Basic 6.0 and so requires that msvbvm60.dll be placed in the Windows\System or Windows\System32 folder. Technically, other files are required to be present as well, but if you are viewing this page via a web browser on a Windows machine, those files should already be there. dlls are freely available, and can be found on many Internet sites. A zipped version of msvbvm60.dll is available below.

Out files of up to 30 megs in size have been successfully (if somewhat slowly) processed by BUS. At some point memory limitations may crop up. The Read subroutine makes use of 4 byte Long integer variables which, in theory, should allow 2,147,483,647 lines to be read. Storing all of this information in an array, however, may not necessarily go smoothly.

It is interesting to note that the file size for BUS output files may be considerably smaller than that of the original BUGS output file. This is due in part to the elimination of redundant iteration information. The more parameters are monitored in BUGS, the more BUS will reduce file sizes. For example, a 12 meg BUGS file with 92 monitored parameters was reduced to 6.5 megs by BUS. Zipping produces even more dramatic gains. The aforementioned BUGS file was 2.75 megs when zipped, whereas the zipped BUS file was a mere 259K.

Version History
Version 1.0.1: fixed overflow associated with writing larger files (9/10/01)
Version 1.0: initial release (6/22/00)



  • Download BUS. Please see the enclosed readme file.
  • Download msvbvm60.zip.
  • You may need one or more of the following system files depending on your setup.



    Questions? Glitches? Interesting stories? Send email to
    edhahn@salisbury.edu


    Main page



    1 Actually, there are two columns - the first column is the iteration number and the second is the variable's value at that iteration.