HDCMAT Hellinger distance of cycle matrix. comuptes the Hellinger distance between the observed cycle matrix Fobs and the expected cycle matrix F. The Hellinger distance is defined as H.D. = acos( sum( sqrt(N_ij/N*g_ij) ) ) hd = hdcmat(Fobs,F) Fobs = Observation of cycle matrix F = Expected cycle matrix
Auxiliary function used by ESTSMCTP |
01 function hd = hdcmat(Fobs,F) 02 % HDCMAT Hellinger distance of cycle matrix. 03 % 04 % comuptes the Hellinger distance between the observed 05 % cycle matrix Fobs and the expected cycle matrix F. 06 % 07 % The Hellinger distance is defined as 08 % H.D. = acos( sum( sqrt(N_ij/N*g_ij) ) ) 09 % 10 % hd = hdcmat(Fobs,F) 11 % 12 % Fobs = Observation of cycle matrix 13 % F = Expected cycle matrix 14 15 F = flipud(F)'; % Convert to PJ-def 16 Fobs = flipud(Fobs)'; % Convert to PJ-def 17 18 n = length(F); 19 N = sum(sum(Fobs)); 20 21 F = F / sum(sum(F)); 22 23 FF = F(:); 24 FFobs = Fobs(:); 25 FI = find(F>0); 26 27 % Compute chi-square quantity 28 29 hd = acos( sum( sqrt(FFobs(FI)/N.*FF(FI)) ) ); 30 31
Comments or corrections to the WAFO group