| dist.binary {ade4} | R Documentation |
computes for binary data some distance matrice.
dist.binary(df, method = NULL, diag = FALSE, upper = FALSE)
df |
a matrix or a data frame with positive or null numeric values. Used with as.matrix(1 * (df > 0)) |
method |
an integer between 1 and 10 . If NULL the choice is made with a console message. See details |
diag |
a logical value indicating whether the diagonal of the distance matrix should be printed by ‘print.dist’ |
upper |
a logical value indicating whether the upper triangle of the distance matrix should be printed by ‘print.dist’ |
Let be the contingency table of binary data such as n11 = a, n10 = b, n01 = c and n00 = d. All these distances are of type d = sqrt(1 - s) with s a similarity coefficient.
returns a distance matrix of class dist between the rows of the data frame
Daniel Chessel
Stéphane Dray dray@biomserv.univ-lyon1.fr
Gower, J.C. and Legendre, P. (1986) Metric and Euclidean properties of dissimilarity coefficients. Journal of Classification, 3, 5–48.
data(aviurba)
for (i in 1:10) {
d <- dist.binary(aviurba$fau, method = i)
cat(attr(d, "method"), is.euclid(d), "\n")}
> library(ade4)
> ### Name: dist.binary
> ### Title: Computation of Distance Matrices for Binary Data
> ### Aliases: dist.binary
> ### Keywords: array multivariate
>
> ### ** Examples
>
> data(aviurba)
> for (i in 1:10) {
+ d <- dist.binary(aviurba$fau, method = i)
+ cat(attr(d, "method"), is.euclid(d), "\n")}
JACCARD S3 TRUE
SOCKAL & MICHENER S4 TRUE
SOCKAL & SNEATH S5 TRUE
ROGERS & TANIMOTO S6 TRUE
CZEKANOWSKI S7 TRUE
GOWER & LEGENDRE S9 TRUE
OCHIAI S12 TRUE
SOKAL & SNEATH S13 TRUE
Phi of PEARSON S14 TRUE
GOWER & LEGENDRE S2 TRUE
>
>
>
>