The Euclidean distance is of course appropriate to compute matrices of geographical distances based on variables giving the coordinates of the sites in any units on a
1 or 2-dimensional orthogonal (Cartesian) system such as cm, m or km (or UTM
coordinates if the sites all belong to the same zone). Coordinates in a spherical
system (e.g. latitude-longitude) must be transformed prior to the computation of a
Euclidean distance matrix. This transformation can be done by function geoXY()
of the package SoDA. Note that geographical coordinates should not be standardized
(only centred if necessary), since this would alter the ratio between the two
dimensions.
In the following lines of code you will also compute a matrix of Euclidean
distance on a single variable: dfs, the distance from the source of the river. This
matrix will thus represent the distances among sites along the river, while the matrix
based on spatial (X-Y) coordinates will represent the distance among points on a
geographical map (as the crow flies, so to say).
# Euclidean distance matrix on spatial coordinates (2D)
spa.de <- dist(spa)
coldiss(spa.de, nc = 16, diag = TRUE)
# Euclidean distance matrix on distance from the source (1D)
dfs.df <- as.data.frame(env$dfs, row.names = rownames(env))
riv.de <- dist(dfs.df)
coldiss(riv.de, nc = 16, diag = TRUE)
Why are the X-Y plot and the Euclidean distance from the source plot so different?
3.3.4 Q Mode: Binary Data (Excluding Species Presence-Absence
Data)
The simplest symmetrical similarity measure for binary data is the “simple matching
coefficient” S 1 . For each pair of sites, it is the ratio between the number of double 1’s
plus double 0’s and the total number of variables.
The fish environment dataset is exclusively made of quantitative variables, so we
shall create fictitious data to demonstrate the computation of S 1 . We shall resort to
this method from time to time, just to show how it is convenient to create data sets of
known characteristics in R, for instance for simulation purposes.
48
3 Association Measures and Matrices
Précédent

- 62/444

Suivant