image thumbnail
from NPC algorithm for learning DAG in Bayesian network by Guangdi Li
NPC algorithm is designed for learning Bayesian network formed as DAG in 2001, by Steck

CITest_ChiTwoVar( MI, R, M, a )
function CI = CITest_ChiTwoVar( MI, R, M, a )
% Input:
% MI is the mutual information of I(X1,X2) or I(X1,X2|others );
% M is the number of sample used
% a is  0.05

%Output:
% if CI = 1,X1 and X2 independent, otherwise,dependent
% Null hypothesis is X1 and X2 are independent

   CI = 0; 
   Threshold = chi2inv( 1-a,R );
   if  Threshold < 2*M*MI      %|| ThresholdLarge < 2*N*MI
       CI = 1;    
   end
end

Contact us at files@mathworks.com