PCA {Momocs} | R Documentation |
Principal component analysis on Coe objects
Description
Performs a PCA on Coe objects, using prcomp.
Usage
PCA(x, scale., center, fac)
## S3 method for class 'OutCoe'
PCA(x, scale. = FALSE, center = TRUE, fac)
## S3 method for class 'OpnCoe'
PCA(x, scale. = FALSE, center = TRUE, fac)
## S3 method for class 'LdkCoe'
PCA(x, scale. = FALSE, center = TRUE, fac)
## S3 method for class 'TraCoe'
PCA(x, scale. = TRUE, center = TRUE, fac)
## Default S3 method:
PCA(x, scale. = TRUE, center = TRUE, fac = dplyr::tibble())
as_PCA(x, fac)
Arguments
x |
a Coe object or an appropriate object (eg prcomp) for |
scale. |
logical whether to scale the input data |
center |
logical whether to center the input data |
fac |
any factor or data.frame to be passed to |
Details
By default, methods on Coe object do not scale the input data but center them. There is also a generic method (eg for traditional morphometrics) that centers and scales data.
Value
a 'PCA' object on which to apply plot.PCA, among others. This list has several
components, most of them inherited from the prcomp
object:
-
sdev
the standard deviations of the principal components (i.e., the square roots of the eigenvalues of the covariance/correlation matrix, though the calculation is actually done with the singular values of the data matrix) -
eig
the cumulated proportion of variance along the PC axes -
rotation
the matrix of variable loadings (i.e., a matrix whose columns contain the eigenvectors). The function princomp returns this in the element loadings. -
center
, scale the centering and scaling used -
x
PCA scores (the value of the rotated data (the centred (and scaled if requested) data multiplied by the rotation matrix)) other components are inherited from the
Coe
object passed toPCA
, egfac
,mshape
,method
,baseline1
andbaseline2
, etc. They are documented in the corresponding*Coe
file.
See Also
Other multivariate:
CLUST()
,
KMEANS()
,
KMEDOIDS()
,
LDA()
,
MANOVA_PW()
,
MANOVA()
,
MDS()
,
MSHAPES()
,
NMDS()
,
classification_metrics()
Examples
bot.f <- efourier(bot, 12)
bot.p <- PCA(bot.f)
bot.p
plot(bot.p, morpho=FALSE)
plot(bot.p, 'type')
op <- npoly(olea, 5)
op.p <- PCA(op)
op.p
plot(op.p, 1, morpho=TRUE)
wp <- fgProcrustes(wings, tol=1e-4)
wpp <- PCA(wp)
wpp
plot(wpp, 1)
# "foreign prcomp"
head(iris)
iris.p <- prcomp(iris[, 1:4])
iris.p <- as_PCA(iris.p, iris[, 5])
class(iris.p)
plot(iris.p, 1)