PCA {easyCODA} | R Documentation |
Principal component analysis
Description
Computation of weighted or unweighted principal component analysis of a matrix of interval-scale data (e.g. a matrix of logratios).
Usage
PCA(data, nd = 2, weight = TRUE, row.wt = NA, suprow = NA)
Arguments
data |
A data frame or matrix of interval-scale data, or logratio object from functions |
nd |
Number of dimensions for summary solution if not 2 |
weight |
TRUE (default) for column weighting, FALSE for unweighted analysis, or a vector of user-defined column weights |
row.wt |
Optional user-defined set of positive weights for the rows (samples) (default: equal weights) |
suprow |
Indices of rows that are supplementary points (NOTE: this option is not implemented in this version) |
Details
The function PCA
computes an unstandardized principal component analysis, based on the singular value decomposition, of a matrix of interval-scale data, usually a matrix of logratios in the context of this package (but it can be used for general data as well).
For general usage the unweighted option weight = FALSE
might be preferred, but the default is weighted in the present context of compositional data.
User-specified weights can be supplied, for the rows and/or the columns.
Usually row weights are not specified, and are equal unless intentional weighting of the samples is desired.
User-specified part weights can be provided using the weight
option.
Supplementary rows and columns can be declared (also known as passive points) – these do not contribute to the solution but are positioned on the solution axes. Notice that this optyion is not implemented in the present version, but will appear in the next one.
The function borrows the structure and functions of the ca
package, which is required, and produces a ca
object, and the same print
, summary
and plot
methods can be used, as for a ca
object.
Value
sv |
Singular values |
nd |
Dimenson of the solution |
rownames |
Row names |
rowmass |
Row weights |
rowdist |
Row logratio distances to centroid |
rowinertia |
Row variances |
rowcoord |
Row standard coordinates |
rowpcoord |
Row principal coordinates |
rowsup |
Indices of row supplementary points |
colnames |
Column names |
colmass |
Column weights |
coldist |
Column logratio distances to centroid |
colinertia |
Column variances |
colcoord |
Column standard coordinates |
colpcoord |
Column principal coordinates |
N |
The data table |
Author(s)
Michael Greenacre
References
Aitchison, J. and Greenacre, M. (2002), Biplots of compositional data, Applied Statistics 51, 375-392.
Greenacre, M. (2010), Biplots in Practice, BBVA Foundation, Bilbao. Free download from www.multivariatestatistics.org
See Also
, PLOT.PCA
, plot.ca
, summary.ca
, print.ca
Examples
# compute logratios of Vegetables data set
data(veg)
veg.LR <- LR(veg)
# unweighted PCA biplot of the results
veg.PCA <- PCA(veg.LR$LR, weight=FALSE)
PLOT.PCA(veg.PCA, map="asymmetric")