https://github.com/cran/robCompositions
Raw File
Tip revision: 603e991f22931dee89245568fb7ae42ec7c13bf2 authored by Matthias Templ on 19 February 2019, 12:50:03 UTC
version 2.0.10
Tip revision: 603e991
pcaCoDa.Rd
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pcaCoDa.R
\name{pcaCoDa}
\alias{pcaCoDa}
\alias{print.pcaCoDa}
\alias{summary.pcaCoDa}
\title{Robust principal component analysis for compositional data}
\usage{
pcaCoDa(x, method = "robust", mult_comp = NULL, external = NULL)

\method{print}{pcaCoDa}(x, ...)

\method{summary}{pcaCoDa}(object, ...)
}
\arguments{
\item{x}{compositional data}

\item{method}{must be either \dQuote{robust} (default) or \dQuote{classical}}

\item{mult_comp}{a list of numeric vectors holding the indices of linked
compositions}

\item{external}{external non-compositional variables}

\item{...}{additional parameters for print method passed through}

\item{object}{object of class pcaCoDa}
}
\value{
\item{scores }{scores in clr space} \item{loadings }{loadings in clr
space} \item{eigenvalues }{eigenvalues of the clr covariance matrix}
\item{method }{method} \item{princompOutputClr }{output of \code{princomp}
needed in \code{plot.pcaCoDa}}
}
\description{
This function applies robust principal component analysis for compositional
data.
}
\details{
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.

\code{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 \code{mult_comp} is set correctly.
}
\examples{

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")
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)
}
\references{
Filzmoser, P., Hron, K., Reimann, C. (2009) Principal component
analysis for compositional data with outliers. \emph{Environmetrics},
\bold{20}, 621-632.

Kynclova, P., Filzmoser, P., Hron, K. (2016) Compositional biplots including external non-compositional variables. 
\emph{Statistics: A Journal of Theoretical and Applied Statistics},
\bold{50}, 1132-1148.
}
\seealso{
\code{\link{print.pcaCoDa}}, \code{\link{summary.pcaCoDa}}, \code{\link{biplot.pcaCoDa}}, \code{\link{plot.pcaCoDa}}
}
\author{
Karel Hron, Peter Filzmoser, Matthias Templ and a contribution for dimnames in external variables by Amelia Landre.
}
\keyword{multivariate}
back to top