Generic example of using Classic BUGS and WinBUGS with Matlab

First create appropriate script file and model file.

Then create data file

 mat2bugs('stacks_dat.txt','Y',d(:,1),'x',d(:,2:end),'p',p,'N',n); 
init file
 mat2bugs('stacks_in.txt','beta0',10,'beta',[0 0 0],'tau',0.1); 
call Classic BUGS (in Linux)
 unix(['/proj/ave/bugs/backbugs stacks.bmd']); 
or WinBUGS (in Linux)
 unix(['wine /proj/ave/c/WinBUGS/WinBUGS14.exe /PAR "Y:/cv_vs_dic/stacks/WinBUGS/stacks_scr.txt" 2> /dev/null' ]); 
Leming Qu reported that following works in Windows (replace <PATH> with real path)
 dos('<PATH>\WinBUGS14 /PAR <PATH>\script.txt') 
and read results to Matlab
 S=bugs2mat('bugsIndex.txt','bugs1.txt'); 


Aki Vehtari
Last modified: 2003-08-19