Learn R Programming

ade4 (version 1.5-2)

dist.binary: Computation of Distance Matrices for Binary Data

Description

computes for binary data some distance matrice.

Usage

dist.binary(df, method = NULL, diag = FALSE, upper = FALSE)

Arguments

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'

Value

  • returns a distance matrix of class dist between the rows of the data frame

encoding

latin1

Details

Let be the contingency table of binary data such as $n_{11} = a$, $n_{10} = b$, $n_{01} = c$ and $n_{00} = d$. All these distances are of type $d=\sqrt{1-s}$ with s a similarity coefficient. [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

References

Gower, J.C. and Legendre, P. (1986) Metric and Euclidean properties of dissimilarity coefficients. Journal of Classification, 3, 5--48.

Examples

Run this code
data(aviurba)
for (i in 1:10) {
    d <- dist.binary(aviurba$fau, method = i)
    cat(attr(d, "method"), is.euclid(d), "")}

Run the code above in your browser using DataLab