Principal component analysis for real compositions
Description
A principal component analysis is done in real geometry (i.e. cpttransform) of the simplex. Some gimics simplify the interpretation of the obtained components.
Usage
1 2 3 4 5 6 7 8 9 10 11 12  ## S3 method for class 'rcomp'
princomp(x,...,scores=TRUE,center=attr(covmat,"center"),
covmat=var(x,robust=robust,giveCenter=TRUE),
robust=getOption("robust"))
## S3 method for class 'princomp.rcomp'
print(x,...)
## S3 method for class 'princomp.rcomp'
plot(x,y=NULL,...,npcs=min(10,length(x$sdev)),
type=c("screeplot","variance","biplot","loadings","relative"),
main=NULL,scale.sdev=1)
## S3 method for class 'princomp.rcomp'
predict(object,newdata,...)

Arguments
x 
an rcomp dataset (for princomp) or a result from princomp.rcomp 
y 
not used 
scores 
a logical indicating whether scores should be computed or not 
npcs 
the number of components to be drawn in the scree plot 
type 
type of the plot: 
scale.sdev 
the multiple of sigma to use when plotting the loadings 
main 
title of the plot 
object 
a fitted princomp.rcomp object 
newdata 
another compositional dataset of class rcomp 
... 
further arguments to pass to internallycalled functions 
covmat 
provides the covariance matrix to be used for the principle component analysis 
center 
provides the be used for the computation of scores 
robust 
Gives the robustness type for the calculation of the
covariance matrix. See 
Details
Mainly a princomp(cpt(x))
is performed. To avoid confusion, the
meaningless last principal component is removed.
The plot routine provides screeplots (type = "s"
,type=
"v"
), biplots (type = "b"
), plots of the effect of
loadings (type = "b"
) in scale.sdev*sdev
spread, and
loadings of pairwise differences (type = "r"
).
The interpretation of a screeplot does not differ from ordinary
screeplots. It shows the eigenvalues of the covariance matrix, which
represent the portions of variance explained by the principal
components.
The interpretation of the biplot strongly differs from a classical one.
The relevant variables are not the arrows drawn (one for each component),
but rather the links (i.e., the differences) between two
arrow heads, which represents the difference between the two
components represented by the arrows, or the transfer of mass from
one to the other.
The compositional loading plot is more or less a standard
one. The loadings are displayed by a barplot as positve and
negative changes of amounts.
The loading plot can work in
two different modes: If
scale.sdev
is set to NA
it displays the composition
being represented by the unit vector of loadings in cpttransformed space. If
scale.sdev
is numeric we use this composition scaled by the
standard deviation of the respective component.
The relative plot displays the relativeLoadings
as a
barplot. The deviation from a unit bar shows the effect of each
principal component on the respective differences.
Value
princomp
gives an object of type
c("princomp.rcomp","princomp")
with the following content:
sdev 
the standard deviation of the principal components. 
loadings 
the matrix of variable loadings (i.e., a matrix which
columns contain the eigenvectors). This is of class

Loadings 
the loadings as an rmultobject 
center 
the cpttransformed vector of means used to center the dataset 
Center 
the 
scale 
the scaling applied to each variable 
n.obs 
number of observations 
scores 
if 
call 
the matched call 
na.action 
not clearly understood 
predict
returns a matrix of scores of the observations in the
newdata
dataset.
The other routines are mainly called for their side effect of plotting or
printing and return the object x
.
Author(s)
K.Gerald v.d. Boogaart http://www.stat.boogaart.de
See Also
cpt
,rcomp
, relativeLoadings
princomp.acomp
, princomp.rplus
,
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23  data(SimulatedAmounts)
pc < princomp(rcomp(sa.lognormals5))
pc
summary(pc)
plot(pc) #plot(pc,type="screeplot")
plot(pc,type="v")
plot(pc,type="biplot")
plot(pc,choice=c(1,3),type="biplot")
plot(pc,type="loadings")
plot(pc,type="loadings",scale.sdev=1) # Downward
plot(pc,type="relative",scale.sdev=NA) # The directions
plot(pc,type="relative",scale.sdev=1) # one sigma Upward
plot(pc,type="relative",scale.sdev=1) # one sigma Downward
biplot(pc)
screeplot(pc)
loadings(pc)
relativeLoadings(pc,mult=FALSE)
relativeLoadings(pc)
relativeLoadings(pc,scale.sdev=1)
relativeLoadings(pc,scale.sdev=2)
pc$sdev^2
cov(predict(pc,sa.lognormals5))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.