Scale an EDMA data object
edma_scale.Rd
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.
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"
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.
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
andL2
) 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).
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)
#> EDMA data: Landmark data
#> 3 landmarks, 2 dimensions, 2 specimens
#> Landmarks scaled using: constant
XY_const$data
#> $S1
#> X Y
#> L1 -1 -0.6666667
#> L2 0 0.8333333
#> L3 1 -0.1666667
#>
#> $S2
#> X Y
#> L1 -1.0 -0.5
#> L2 0.5 1.0
#> L3 0.5 -0.5
#>
XY_const$scale
#> $method
#> [1] "constant"
#>
#> $values
#> $values$S1
#> [1] 2
#>
#> $values$S2
#> [1] 2
#>
#>
# Scale by distance between two landmarks
XY_endpt <- edma_scale(XY, scale_by = "endpoints", L1 = "L1", L2 = "L3")
print(XY_endpt)
#> EDMA data: Landmark data
#> 3 landmarks, 2 dimensions, 2 specimens
#> Landmarks scaled using: endpoints L1 and L3
XY_endpt$data
#> $S1
#> X Y
#> L1 -0.4850713 -0.32338083
#> L2 0.0000000 0.40422604
#> L3 0.4850713 -0.08084521
#>
#> $S2
#> X Y
#> L1 -0.6666667 -0.3333333
#> L2 0.3333333 0.6666667
#> L3 0.3333333 -0.3333333
#>
XY_endpt$scale
#> $method
#> [1] "endpoints L1 and L3"
#>
#> $values
#> $values$S1
#> [1] 4.123106
#>
#> $values$S2
#> [1] 3
#>
#>
# Scale by geometric mean of all interlandmark distances
XY_geomean <- edma_scale(XY, scale_by = "geometric_mean")
print(XY_geomean)
#> EDMA data: Landmark data
#> 3 landmarks, 2 dimensions, 2 specimens
#> Landmarks scaled using: geometric_mean
XY_geomean$data
#> $S1
#> X Y
#> L1 -0.5751524 -0.38343495
#> L2 0.0000000 0.47929368
#> L3 0.5751524 -0.09585874
#>
#> $S2
#> X Y
#> L1 -0.5939325 -0.2969662
#> L2 0.2969662 0.5939325
#> L3 0.2969662 -0.2969662
#>
XY_geomean$scale
#> $method
#> [1] "geometric_mean"
#>
#> $values
#> $values$S1
#> [1] 3.477339
#>
#> $values$S2
#> [1] 3.367386
#>
#>
# Scale by maximum of all interlandmark distances
XY_max <- edma_scale(XY, scale_by = "maximum")
print(XY_max)
#> EDMA data: Landmark data
#> 3 landmarks, 2 dimensions, 2 specimens
#> Landmarks scaled using: maximum
XY_max$data
#> $S1
#> X Y
#> L1 -0.4850713 -0.32338083
#> L2 0.0000000 0.40422604
#> L3 0.4850713 -0.08084521
#>
#> $S2
#> X Y
#> L1 -0.4714045 -0.2357023
#> L2 0.2357023 0.4714045
#> L3 0.2357023 -0.2357023
#>
XY_max$scale
#> $method
#> [1] "maximum"
#>
#> $values
#> $values$S1
#> [1] 4.123106
#>
#> $values$S2
#> [1] 4.242641
#>
#>
# Scale by median of all interlandmark distances
XY_median <- edma_scale(XY, scale_by = "median")
print(XY_median)
#> EDMA data: Landmark data
#> 3 landmarks, 2 dimensions, 2 specimens
#> Landmarks scaled using: median
XY_median$data
#> $S1
#> X Y
#> L1 -0.5547002 -0.36980013
#> L2 0.0000000 0.46225016
#> L3 0.5547002 -0.09245003
#>
#> $S2
#> X Y
#> L1 -0.6666667 -0.3333333
#> L2 0.3333333 0.6666667
#> L3 0.3333333 -0.3333333
#>
XY_median$scale
#> $method
#> [1] "median"
#>
#> $values
#> $values$S1
#> [1] 3.605551
#>
#> $values$S2
#> [1] 3
#>
#>
# 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)
#> EDMA data: Landmark data
#> 3 landmarks, 2 dimensions, 2 specimens
#> Landmarks scaled using: sneath
XY_sneath$data
#> $S1
#> X Y
#> L1 -0.9733285 -0.6488857
#> L2 0.0000000 0.8111071
#> L3 0.9733285 -0.1622214
#>
#> $S2
#> X Y
#> L1 -1.0 -0.5
#> L2 0.5 1.0
#> L3 0.5 -0.5
#>
XY_sneath$scale
#> $method
#> [1] "sneath"
#>
#> $values
#> $values$S1
#> [1] 2.054805
#>
#> $values$S2
#> [1] 2
#>
#>