nomdist2
statistics: D = nomdist2 (X, Y)
statistics: D = nomdist2 (X, Y, measure)
statistics: D = nomdist2 (…, Name, Value)
Dissimilarity between the rows of two samples of nominal data.
D = nomdist2 (X, Y) returns the Goodall 3
dissimilarity of each row of X to each row of Y, as the
N×M matrix D, where X has N rows and Y
M. Their columns are the same nominal variables and their values
the levels, of any type nomdist takes; where X is a table,
Y must be one holding every variable of X, read by name. A
Y of no rows gives an N×0 D.
Level frequencies are counted over X, the sample the rows of Y
are measured against, so D is not symmetric in the two:
nomdist2 (X, Y) is not in general
nomdist2 (Y, X)'. nomdist2 (X, X)
equals squareform (nomdist (X)) off the diagonal; on it,
several measures give two identical rows a nonzero dissimilarity.
D = nomdist2 (X, Y, measure) uses the
measure named, one of 'anderberg', 'burnaby',
'eskin', 'gambaryan', 'goodall1',
'goodall2', 'goodall3', 'goodall4', 'iof',
'lin', 'lin1', 'of', 'sm',
'smirnov', 've' or 'vm', in any case, each defined
as in nomdist.
D = nomdist2 (…, Name, Value) takes the
options nomdist takes. 'Weights' gives one weight per
variable. 'Reference' names a sample to count level frequencies
over in place of X, which must hold every level X holds;
[X; Y] counts them over both samples.
'CountQuery', false by default, counts each row of Y
into the reference while it is measured, so that its column of D
takes level frequencies over the reference with that row appended.
Y may hold a level the reference sample does not, unless
'CountQuery' is true, which counts that level once. Each measure
then answers with the limit of its formula as that level’s count falls
to 0.
'sm', 'eskin', 'gambaryan', the four Goodall
measures, 'smirnov', 've' and 'vm' never read that
count and answer as usual. 'of' and 'burnaby' score the
variable 0, 'anderberg' places the pair at 1, and 'lin' and
'lin1' at Inf. Refused, where the limit does not exist:
'iof', whose similarity rises as a level grows rarer, and
'of' and 'burnaby' where the reference holds that variable
at a single level. A variable of weight 0 is left out, and so never
refused.
Source Code: nomdist2