Commits

Zoltan Szabo  committed 98e0522

Handling of identically constant random variables in distance correlation computation: included; see 'IdCor_estimation.m'.

  • Participants
  • Parent commits 28c447c

Comments (0)

Files changed (2)

File CHANGELOG.txt

+-Handling of identically constant random variables in distance correlation computation: included; see 'IdCor_estimation.m'.
+
 v0.26 (Dec 22, 2012):
 -Distance covariance estimation via HSIC: added; see IdCov_IHSIC_initialization.m', 'IdCov_IHSIC_estimation.m'.
 -Energy distance estimation via MMD: added; see 'DEnergyDist_DMMD_initialization.m', 'DEnergyDist_DMMD_estimation'.

File code/H_I_D_A_C/base_estimators/IdCor_estimation.m

 A = compute_dCov_dCor_statistics(Y(1:ds(1),:),co.alpha);
 B = compute_dCov_dCor_statistics(Y(ds(1)+1:ds(1)+ds(2),:),co.alpha);
 
-I = sum(sum(A.*B)) / sqrt(sum(sum(A.^2)) * sum(sum(B.^2))); %<A,B> / sqrt(<A,A><B,B>)
-I = sqrt(I);
+n = sum(sum(A.*B)); %numerator
+d1 = sum(sum(A.^2));%denumerator-1 (without sqrt)
+d2 = sum(sum(B.^2));%denumerator-2 (without sqrt)
 
+if (d1*d2)==0 %(at least) one of the random variables is constant
+    I = 0;
+else
+    I = n/sqrt(d1*d2); %<A,B> / sqrt(<A,A><B,B>)
+    I = sqrt(I);
+end
 
 
+