This vignette illustrates the differences in measuring landmark displacement (or variation).
This test will be using the landvR
package from github and will require devtools
, geomorph
and dispRity
from the CRAN. All these packages can be loaded easily as follows
## Loading the libraries (and installing if necessary)
if(!require(devtools)) install.packages("devtools")
if(!require(geomorph)) install.packages("geomorph")
if(!require(landvR)) install_github("TGuillerme/landvR")
## Setting a random seed for the repeatability of this tutorial
set.seed(42)
This whole method is based on Procrustes superimpositions that can be easily done through the geomorph
package (see the geomorph
manual and especially the function gpagen
for more details). For this example, we will be using the plethodon
dataset from the geomorph
R
package.
## Loading the dataset
data(plethodon)
## Generating a Procrustes superimposition
procrustes <- gpagen(plethodon$land, print.progress = FALSE)
This results in a dataset of 40 Procrustes superimposition of 12 landmarks each.
First lets get the two most different specimens for simplifying the comparisons:
## Getting the two most different specimens
extreme_spec <- variation.range(procrustes, return.ID = TRUE)$min.max
## Separating the specimens
specimen_1 <- procrustes$coords[, , extreme_spec[1]]
specimen_2 <- procrustes$coords[, , extreme_spec[2]]
We can then measure the landmark displacements between a focal specimen (specimen 1, in blue below) and a reference one (specimen 2, in orange). Typically the focal one can be all the observed specimens and the reference one could be the mean or median landmark configuration.
These landmark displacements can be measured using two coordinates systems: the spherical or the vector one and is always measured between \(F_{n}\) and \(R_{n}\), respectively the \(n^{th}\) landmark of the focal specimen and the reference. \(F_{n}\) and \(R_{n}\) are defined by two or three coordinates x, y, z depending on the number of dimensions in the system.
The spherical coordinates measure the landmark’s displacement in spherical coordinates systems for each landmark individually. In other words, the values for each landmark displacement is discrete in space (i.e. independent from other landmarks).
The spherical coordinate system is a 3D (or 2D) referential centred on a point of origin (here the \(n^{th}\) landmark of the focal specimen). The system is defined by two or three variables (for respectively 2D and 3D systems):
In landvR
they are measured using basic algebra and trigonometry through the following function:
## Measuring the spherical coordinates between specimen 1 (focal) and 2 (reference)
spherical_diff <- coordinates.difference(coordinates = specimen_1, reference = specimen_2,
type = "spherical", angle = "degree")[[1]]
This results in a list of coordinates for each specimen. For example, to look at the differences between the first specimen and the consensus in terms of spherical coordinates, one can call:
## The differences between the two selected specimens
spherical_diff
## radius azimuth
## [1,] 0.015154920 48.558836
## [2,] 0.056550779 32.649301
## [3,] 0.070087218 23.584891
## [4,] 0.020754872 86.333453
## [5,] 0.014831446 34.103072
## [6,] 0.034482428 72.125643
## [7,] 0.052406817 58.952595
## [8,] 0.015595846 29.388294
## [9,] 0.042363538 44.790597
## [10,] 0.009759552 15.401958
## [11,] 0.076345817 4.720584
## [12,] 0.042128720 55.072969
In this case, for each landmark, the longer the radii \(\rho\), the more it is displaced and the bigger the azimuth \(\phi\), the more away from the equatorial plan.
Here is a graphical representation of the system for a single landmark (3) with a radius of 0.0700872 and an angle of 23.5848906 degrees.
This system has the advantage of directly measuring the landmark displacement in any direction and to be independent from other landmarks within the same specimen. However, the azimuth and polar angle are often hard to interpret in isolation since they are relative to the equatorial and polar plan of the specimens (which can be arbitrary).
The vector coordinates system is a bit different than the spherical one in that it is based on the landmark displacements relative to the centroid of the reference specimen. The centroid point of the reference, \(C\), is the mean of all the x, y, z coordinates for all the landmarks of the reference specmin. This coordinate system is based on the vectors between the centroid \(C\) and \(F_{n}\) or \(R_{n}\). These two vectors are called \(\bf{v}_{Fn}\) and \(\bf{v}_{Rn}\) respectively. The system is defined by two variables (regardless of the number of dimensions):
In landvR
they are measured using basic vector operations through the following function:
## Measuring the spherical coordinates between specimen 1 (focal) and 2 (reference)
vector_diff <- coordinates.difference(coordinates = specimen_1, reference = specimen_2,
type = "vector", angle = "degree",
absolute.distance = FALSE)[[1]]
Note that we’ve asked the distances to be not absolute, toggling this option allows the distances to be calculated as \(\sqrt((\bf{v}_{Fn} - \bf{v}_{Rn})^2)\) (TRUE
) or
## The differences between the two selected specimens
vector_diff
## length angle
## [1,] -0.011983265 3.741149
## [2,] -0.056155071 1.846975
## [3,] -0.070039331 5.417873
## [4,] -0.005007085 3.894607
## [5,] -0.013642722 1.076431
## [6,] -0.007305423 5.993309
## [7,] 0.019240177 9.022292
## [8,] 0.008311100 3.311774
## [9,] 0.019129391 21.852162
## [10,] -0.009716796 0.263511
## [11,] 0.074060097 3.189630
## [12,] -0.020314545 3.623498
In this case, for each landmark, the longer the difference in length (in absolute value), the more it is displaced and the bigger the angle, the more it is offset. In terms of biology, if all lengths are positive and all angles are close to 0, the specimen is simply generally bigger (with no major changes in shape). On the other hand, if the lengths are close to 0 but the angles are high, the specimen is not bigger but still “deformed”,
Here is a graphical representation of the system for a single landmark (7) with a difference of 0.0192402 and an angle of 9.0222921 degrees:
This coordinate system has the advantage to be more interpretable biologically (i.e. the length and angle will give a clear overview of how the landmark has moved relative to the reference) but the measurements are always relative to the reference and dependent on the other landmarks (used to calculate the centroid point).