From 8070dc963753142bb86c4ed698d91fd623ed28e7 Mon Sep 17 00:00:00 2001 From: ziejd2 Date: Thu, 28 Sep 2017 15:04:40 -0500 Subject: BNW using Octave instead of Matlab. This version of BNW should perform the same as the original version. The only difference is that it uses Octave instead of Matlab when running BayesNet Toolbox during parameter learning. I am calling this BNW_1.02. It can be accessed at: compbio.uthsc.edu/BNW_1.02 --- .../bnt-master/SLP/examples/test_chisquare.m | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sourcecodes/bnt-master/SLP/examples/test_chisquare.m (limited to 'sourcecodes/bnt-master/SLP/examples/test_chisquare.m') diff --git a/sourcecodes/bnt-master/SLP/examples/test_chisquare.m b/sourcecodes/bnt-master/SLP/examples/test_chisquare.m new file mode 100644 index 00000000..5282f1b0 --- /dev/null +++ b/sourcecodes/bnt-master/SLP/examples/test_chisquare.m @@ -0,0 +1,61 @@ +% +% test CHI2 +% + +% Génération de données jouet +N=20000; +xx=5*rand(N,1); +yy=5*rand(N,1); +zz = 5*rand(N,1); +z2= (xx+yy) ; +Data=1+[round(xx) round(yy) round(z2) round(zz)]; +Data=Data'; + +texte{1}='dependency'; +texte{2}='independency'; + +%test='pearson'; % Pearson's Chi2 +test='LRT'; % Likelihood ratio test G2 + +fprintf('\n\n\n\t=================================================\n'); +fprintf('\t\tChi2 Test for (conditional) independency\n'); +fprintf('\t\t(X, Y and Z are theoritically independant)\n'); + +fprintf('\t=================================================\n'); +fprintf('Variables \t\t: Theory : Results (test=%s)\n',test); +fprintf('------------------------------------------------------------------------\n'); + +S=[]; +x=1; y=2; +[IND CHI2] = cond_indep_chisquare(x,y,S,Data(:,1:100),test); +fprintf('X, Y \t\t\t: DEPDCY : \tCHI2=%8.2f \t%s (not enough data)\n',CHI2,texte{IND+1}); + +S=[]; +x=1; y=2; +[IND CHI2] = cond_indep_chisquare(x,y,S,Data,test); +fprintf('X, Y \t\t\t: INDPCY : \tCHI2=%8.2f \t%s\n',CHI2,texte{IND+1}); + +S=[]; +x=1; y=3; +[IND CHI2] = cond_indep_chisquare(x,y,S,Data,test); +fprintf('X, X+Y \t\t\t: DEPDCY :\tCHI2=%8.2f \t%s\n',CHI2,texte{IND+1}); + +S=[]; +x=1; y=4; +[IND CHI2] = cond_indep_chisquare(x,y,S,Data,test); +fprintf('X, Z \t\t\t: INDPCY :\tCHI2=%8.2f \t%s\n',CHI2,texte{IND+1}); + + +x=1; y=2; S=4; +[IND CHI2] = cond_indep_chisquare(x,y,S,Data,test); +fprintf('X, Y | Z \t\t: INDPCY : \tCHI2=%8.2f \tconditional %s\n',CHI2,texte{IND+1}); + +x=1; y=2; S=3; +[IND CHI2] = cond_indep_chisquare(x,y,S,Data,test); +fprintf('X, Y | X+Y \t\t: DEPDCY : \tCHI2=%8.2f \tconditional %s\n',CHI2,texte{IND+1}); + +x=1; y=2; S=[3 4]; +[IND CHI2] = cond_indep_chisquare(x,y,S,Data,test); +fprintf('X, Y | {X+Y,Z}\t\t: DEPDCY : \tCHI2=%8.2f \tconditional %s\n',CHI2,texte{IND+1}); + +fprintf('------------------------------------------------------------------------\n'); \ No newline at end of file -- cgit 1.4.1