edma_scale: Scale an EDMA data object

View source: R/edma_scale.R

edma_scaleR Documentation

Scale an EDMA data object

Description

This function implements the landmark scaling procedures described in Lele and Cole (1996) which are used to rescale the landmarks for specimens in which the variance-covariance matrices to two populations are unequal.

Usage

edma_scale(x, scale_by, L1 = NULL, L2 = NULL, scale_constant = NULL)

Arguments

x

an EDMA data object of class edma_data.

scale_by

string specifying the type of scaling. Valid options are "constant", "endpoints", "geometric_mean", "maximum", "median", "sneath". See below for details.

L1

string specifying first landmark to use if scale_by = "endpoints"

L2

string specifying second landmark to use if scale_by = "endpoints"

scale_constant

numeric specifying the scaling constant to use for scale_by = "constant"

Details

scale_by determines the interlandmark scaling value. Options are:

  • constant Interlandmark distances are scaled by a numeric constant that is applied to all specimens.

  • endpoints Interlandmark distances are scaled by the distance between a pair of landmarks (L1 and L2) for each specimen.

  • geometric mean Interlandmark distances are scaled by th geometric mean of all pairwise distances for each specimen.

  • maximum Interlandmark distances are scaled by the maximum of all pairwise distances for each specimen.

  • median Interlandmark distances are scaled by the median of all pairwise distances for each specimen.

  • sneath Interlandmark distances are scaled using the method described by Sneath (1967), which uses the square-root of the mean squared distances of each landmark to the centroid. Also see Creel (1986).

Value

object of class 'edma_data', with landmarks scaled according to scale_by parameter. See details for details of scaling procedures. The object x are appended with a list including the the scaling method string and the values used for scaling. The latter can be useful for comparisons, e.g., of geometric means.

References

Creel, N. 1986. Size and Phylogeny in Hominoid Primates. Syst. Zool. 35:81-99.

Lele, S., and T. M. Cole III. 1996. A new test for shape differences when variance-covariance matrices are unequal. J. Hum. Evol. 31:193-212.

Sneath, P. H. A. 1967. Trend-surface analysis of transformation grids. J. Zool. 151:65-122. Wiley.

Examples

# Following the example in Lele and Cole (1996)
X <- matrix(c(0, 0, 2, 3, 4, 1), byrow = TRUE, ncol = 2)
Y <- matrix(c(0, 0, 3, 3, 3, 0), byrow = TRUE, ncol = 2)

# Bind matrices into 3d array and convert to edma_data
XY <- as.edma_data(array(dim = c(3, 2, 2),
                         data = cbind(X, Y)))

# Scale by a constant
XY_const <- edma_scale(XY, scale_by = "constant", scale_constant = 2)
print(XY_const)
XY_const$data
XY_const$scale

# Scale by distance between two landmarks
XY_endpt <- edma_scale(XY, scale_by = "endpoints", L1 = "L1", L2 = "L3")
print(XY_endpt)
XY_endpt$data
XY_endpt$scale

# Scale by geometric mean of all interlandmark distances
XY_geomean <- edma_scale(XY, scale_by = "geometric_mean")
print(XY_geomean)
XY_geomean$data
XY_geomean$scale

# Scale by maximum of all interlandmark distances
XY_max <- edma_scale(XY, scale_by = "maximum")
print(XY_max)
XY_max$data
XY_max$scale

# Scale by median of all interlandmark distances
XY_median <- edma_scale(XY, scale_by = "median")
print(XY_median)
XY_median$data
XY_median$scale

# Scale using root mean squared distance from each landmark to
# the centroid (Sneath, 1967).
XY_sneath <- edma_scale(XY, scale_by = "sneath")
print(XY_sneath)
XY_sneath$data
XY_sneath$scale


psolymos/EDMAinR documentation built on Aug. 25, 2023, 7:54 p.m.