Home > wafo > markov > hdcmat.m

# hdcmat

## PURPOSE

Hellinger distance of cycle matrix.

## SYNOPSIS

hd = hdcmat(Fobs,F)

## DESCRIPTION

```  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```

## CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:
 f_smctp Auxiliary function used by ESTSMCTP

## SOURCE CODE

```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```

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group

Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003