Use BAUW to convert data
2006-05-30    Zhiyong Zhang & Lijuan Wang   
Print from: Zhiyong Zhang \'s Psychometric Website
Address: http://www.psychstat.org/us/article.php/52
Convert data

NOTE: BAUW is being replaced by a OpenBUGS plugin now. The plugin can be downloaded at http://psychstat.org/us/images/upfile/Bauw.rar. The plugin only works for OpenBUGS not WinBUGS. However, the scripts working in OpenBUGS generally work for WinBUGS, too. To install the plugin, simple unzip the downlowd to the OpenBUGS folder. A menu item "BAUW" should appear in your OpenBUGS window. This plugin has most of the functions BAUW has. Questions and comments are welcome.

The standalone BAUW can also be downloaded at http://www.psychstat.org/us/showimg.php?iid=36.

BAUW can convert data in a text file to WinBUGS format. In this example, we have data file containing 4 variables and 5 subjects. The missing data are coded as 999.

1 2 3 4
5 6 7 8
9 10 11 12
13 15 999 16
5 6 8 7

To convert data, we first run BAUW and go to the menu Analyze - Convert Data

In the popout dialog, input the sample size (number of subjects, 5 in this example), number of variables (4 here), missing data (999 here). Then use browse to locate the file "test.txt".

After click OK, the data were converted to

list(N=5,T=4,y = structure(.Data = c(1,2,3,4,
5,6,7,8,
9,10,11,12,
13,15,NA,16,
5,6,8,7), .Dim = c(5,4)))

Notice that the missing data were replaced by "NA".

The above data are in matrix/array format. If you need the vector format, choose "Vector" type. Then the data look like:

list(v1=c(1,5,9,13,5),
v2=c(2,6,10,15,6),
v3=c(3,7,11,NA,8),
v4=c(4,8,12,16,7),
N=5)

If the data with variable names are used, please choose variable name "With".

var1 var2 var3 var4
1 2 3 4
5 6 7 8
9 10 11 12
13 15 999 16
5 6 8 7

The vector format looks like,

list(var1=c(1,5,9,13,5),
var2=c(2,6,10,15,6),
var3=c(3,7,11,NA,8),
var4=c(4,8,12,16,7),
N=5)

The matrix format looks like,

list(N=5,T=4,y = structure(.Data = c(1,2,3,4,
5,6,7,8,
9,10,11,12,
13,15,NA,16,
5,6,8,7), .Dim = c(5,4)))

 A user who would like to include a reference to BAUW in a journal article may use the following format (Publication Manual of the American Psychological Association, Fifth Edition, Example 83, page 280):
Zhang, Z., & Wang, L. (2006).BAUW: Bayesian Analysis Uinsg WinBUGS, Version 1.0. Computer software and manual]. Retrieved from
http://bauw.psychstat.org

Editor: johnny