pcaCoDa | R Documentation |
This function applies robust principal component analysis for compositional data.
pcaCoDa(
x,
method = "robust",
mult_comp = NULL,
external = NULL,
solve = "eigen"
)
## S3 method for class 'pcaCoDa'
print(x, ...)
## S3 method for class 'pcaCoDa'
summary(object, ...)
x |
compositional data |
method |
must be either “robust” (default) or “classical” |
mult_comp |
a list of numeric vectors holding the indices of linked compositions |
external |
external non-compositional variables |
solve |
eigen (as princomp does, i.e. eigenvalues of the covariance matrix) or svd (as prcomp does with single value decomposition instead of eigen). Only for method classical. |
... |
additional parameters for print method passed through |
object |
object of class pcaCoDa |
The compositional data set is expressed in isometric logratio coordinates. Afterwards, robust principal component analysis is performed. Resulting loadings and scores are back-transformed to the clr space where the compositional biplot can be shown.
mult_comp
is used when there are more than one group of compositional
parts in the data. To give an illustrative example, lets assume that one
variable group measures angles of the inner ear-bones of animals which sum
up to 100 and another one having percentages of a whole on the thickness of
the inner ear-bones included. Then two groups of variables exists which are
both compositional parts. The isometric logratio coordinates are then internally applied
to each group independently whenever the mult_comp
is set correctly.
scores |
scores in clr space |
loadings |
loadings in clr space |
eigenvalues |
eigenvalues of the clr covariance matrix |
method |
method |
princompOutputClr |
output of |
Karel Hron, Peter Filzmoser, Matthias Templ and a contribution for dimnames in external variables by Amelia Landre.
Filzmoser, P., Hron, K., Reimann, C. (2009) Principal component analysis for compositional data with outliers. Environmetrics, 20, 621-632.
Kynclova, P., Filzmoser, P., Hron, K. (2016) Compositional biplots including external non-compositional variables. Statistics: A Journal of Theoretical and Applied Statistics, 50, 1132-1148.
print.pcaCoDa
, summary.pcaCoDa
, biplot.pcaCoDa
, plot.pcaCoDa
data(arcticLake)
## robust estimation (default):
res.rob <- pcaCoDa(arcticLake)
res.rob
summary(res.rob)
plot(res.rob)
## classical estimation:
res.cla <- pcaCoDa(arcticLake, method="classical", solve = "eigen")
biplot(res.cla)
## just for illustration how to set the mult_comp argument:
data(expenditures)
p1 <- pcaCoDa(expenditures, mult_comp=list(c(1,2,3),c(4,5)))
p1
## example with external variables:
data(election)
# transform external variables
election$unemployment <- log((election$unemployment/100)/(1-election$unemployment/100))
election$income <- scale(election$income)
res <- pcaCoDa(election[,1:6], method="classical", external=election[,7:8])
res
biplot(res, scale=0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.