Learn R Programming

Morpho (version 2.12)

restoreShapes: 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
)

Value

returns matrix or array containing landmarks

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

Author

Stefan Schlager

Details

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

See Also

prcomp, procSym

getPCscores

Examples

Run this code

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)
}

Run the code above in your browser using DataLab