relWarps: calculate relative Warp analysis

View source: R/relwarps.r

relWarpsR Documentation

calculate relative Warp analysis

Description

After Procrustes registration the data is scaled by the bending energy or its inverse to emphasize global/local differences when exploring a sample's shape.

Usage

relWarps(
  data,
  scale = TRUE,
  CSinit = TRUE,
  alpha = 1,
  tol = 1e-10,
  orp = TRUE,
  pcAlign = TRUE,
  computeBasis = TRUE,
  noalign = FALSE
)

Arguments

data

Input k x m x n real array, where k is the number of points, m is the number of dimensions, and n is the sample size.

scale

Logical: indicating if scaling is requested

CSinit

Logical: if TRUE, all configurations are initially scaled to Unit Centroid Size.

alpha

integer: power of the bending energy matrix. If alpha = 0 then standard Procrustes PCA is carried out. If alpha = 1 then large scale differences are emphasized, if alpha = -1 then small scale variations are emphasised.

tol

tolerance for the eigenvalues of the bending energy matrix to be zero

orp

logical: request orthogonal projection into tangent space.

pcAlign

logical: if TRUE, the shapes are aligned by the principal axis of the first specimen

computeBasis

logical: whether to compute the basis of the resulting vector space (takes a lot of memory and time for configurations with > 1000 coordinates.

noalign

logical: if TRUE, data is assumed to be already aligned and alignment and orthogonal projection are skipped.

Value

bescores

relative warp scores (PC-scores if alpha = 0)

uniscores

uniform scores, NULL if alpha = 0

Var

non-affine variation explained by each relative warp

mshape

sample's conensus shape

rotated

Procrustes superimposed data

bePCs

vector basis of nonaffine shape variation- relative warps (plain PCs if alpha = 0)

uniPCs

vector basis of affine shape variation - uniform component. NULL if alpha = 0

Author(s)

Stefan Schlager

References

Bookstein FL 1989. Principal Warps: Thin-plate splines and the decomposition of deformations. IEEE Transactions on pattern analysis and machine intelligence 11.

Bookstein FL, 1991. Morphometric tools for landmark data. Geometry and biology. Cambridge Univ. Press, Cambridge.

Rohlf FJ, Bookstein FL 2003. Computing the Uniform Component of Shape Variation. Systematic Biology 52:66-69.

Examples


data(boneData)
pop <- name2factor(boneLM,which=3)
rW <- relWarps(boneLM, alpha = -1)
## Not run: 
if (require(car)) {
# plot first 5 relative warps scores grouped by population
spm(rW$bescores[,1:5],group=pop)
# plot uniform component scores grouped by population
spm(rW$uniscores[,1:5],group=pop)
}
##plot non-affine variance associated with each relative warp
barplot(rW$Var[,2], xlab="relative Warps")
## visualize first relative warp +-3 sd of the scores
rw1 <- restoreShapes(as.matrix(c(-3,3)*sd(rW$bescores[,1])),rW$bePCs[,1,drop=FALSE],rW$mshape)
deformGrid3d(rw1[,,1],rw1[,,2],ngrid=5)

## 2D example:
if (require(shapes)) {
data <- bindArr(gorf.dat, gorm.dat, along=3)
sex <- factor(c(rep("fem", dim(gorf.dat)[3]), rep("male",dim(gorm.dat)[3])))
rW <- relWarps(data, alpha = -1)
if (require(car)) {
# plot first 3 relative warps scores grouped by population
spm(rW$bescores[,1:3],group=sex)
# plot uniform component scores grouped by population
spm(rW$uniscores[,1:2],group=sex)
}
##plot non-affine variance associated with each relative warp
barplot(rW$Var[,2], xlab="relative Warps")
## visualize first relative warp +-3 sd of the scores
rw1 <- restoreShapes(as.matrix(c(-3,3)*sd(rW$bescores[,1])),rW$bePCs[,1,drop=FALSE],rW$mshape)
deformGrid2d(rw1[,,1],rw1[,,2],ngrid=10)
}
## End(Not run)


Morpho documentation built on Feb. 16, 2023, 10:51 p.m.