Mercurial > hg > camir-aes2014
annotate toolboxes/FullBNT-1.0.7/bnt/learning/mk_tetrad_data_file.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
rev | line source |
---|---|
wolffd@0 | 1 function mk_tetrad_data_file(filename, samples, sig) |
wolffd@0 | 2 % MK_TETRAD_DATA_FILE Make a file containing raw discrete data for input to TETRAD |
wolffd@0 | 3 % mk_tetrad_data_file(filename, samples, sig) |
wolffd@0 | 4 % |
wolffd@0 | 5 % samples(i,j) is the value for case i, variable j |
wolffd@0 | 6 % The resulting file can be used for the 'build' part of Tetrad. |
wolffd@0 | 7 % For details on tetrad, see hss.cmu.edu/html/departments/philosophy/TETRAD/tetrad.html |
wolffd@0 | 8 |
wolffd@0 | 9 [nsamples N] = size(samples); |
wolffd@0 | 10 |
wolffd@0 | 11 fid = fopen(filename, 'w'); |
wolffd@0 | 12 fprintf(fid, '/Raw\n'); |
wolffd@0 | 13 fprintf(fid, '%d\n', nsamples); |
wolffd@0 | 14 for i=1:N |
wolffd@0 | 15 fprintf(fid, 'x%d ', i); |
wolffd@0 | 16 end |
wolffd@0 | 17 fprintf(fid, '\n'); |
wolffd@0 | 18 for i=1:nsamples |
wolffd@0 | 19 fprintf(fid, '%d ', samples(i,:)-1); % tetrad counts from 0 |
wolffd@0 | 20 fprintf(fid, '\n'); |
wolffd@0 | 21 end |
wolffd@0 | 22 %fprintf(fid, '/Knowledge\n'); |
wolffd@0 | 23 %fprintf(fid, 'Significance %4.2f\n', sig); |
wolffd@0 | 24 fclose(fid); |
wolffd@0 | 25 |