restoreShapes: restore shapes from PC-Scores or similar projections

View source: R/restoreShapes.r

restoreShapesR Documentation

restore shapes from PC-Scores or similar projections

Description

restore shapes from PC-Scores or similar projections

Usage

restoreShapes(
  scores,
  PC,
  mshape,
  sizeshape = FALSE,
  origsize = FALSE,
  meanlogCS
)

Arguments

scores

vector of PC-scores, or matrix with rows containing PC-scores

PC

Principal components (eigenvectors of the covariance matrix) associated with 'scores'.

mshape

matrix containing the meanshape's landmarks (used to center the data by the PCA)

sizeshape

logical: if TRUE, it is assumed that the data is the output of procSym run with sizeshape=TRUE.

origsize

logical: if sizeshape = TRUE, this will apply the scaling to the original size from the corresponding entry from the PC basis matrix.

meanlogCS

numeric: provide the average log Centroid Size of the original sample (see examples below). Only needed if sizeshape = TRUE and origsize = TRUE

Details

Rotates and translates PC-scores (or similar) derived from shape data back into configuration space.

Value

returns matrix or array containing landmarks

Author(s)

Stefan Schlager

See Also

prcomp, procSym

getPCscores

Examples


if (require(shapes)) {
## generate landmarks using
##the first PC-score of the first specimen

proc <- procSym(gorf.dat)
lm <- restoreShapes(proc$PCscores[1,1],proc$PCs[,1],proc$mshape)
plot(lm,asp=1)

##now the first 3 scores
lm2 <- restoreShapes(proc$PCscores[1,1:3],proc$PCs[,1:3],proc$mshape)
points(lm2,col=2)

## Now restore some sizeshape data
procSize <- procSym(gorf.dat,sizeshape=TRUE)
est1 <- restoreShapes(range(procSize$PCscores[,1]),procSize$PCs[,1],procSize$mshape,
                      sizeshape=TRUE,origsize=TRUE,meanlogCS=procSize$meanlogCS)
}


Morpho documentation built on June 22, 2024, 7:19 p.m.