Last chance! 50% off unlimited learning
Sale ends in
A principal component analysis is done in real geometry (i.e. using iit-transform).
# S3 method for rplus
princomp(x,...,scores=TRUE,center=attr(covmat,"center"),
covmat=var(x,robust=robust,giveCenter=TRUE),
robust=getOption("robust"))
# S3 method for princomp.rplus
print(x,...)
# S3 method for princomp.rplus
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 princomp.rplus
predict(object,newdata,...)
princomp
gives an object of type
c("princomp.rcomp","princomp")
with the following content:
the standard deviation of the principal components
the matrix of variable loadings (i.e., a matrix which
columns contain the eigenvectors). This is of class
"loadings"
the loadings as an "rmult"
-object
the iit-transformed vector of means used to center the dataset
the rplus
vector of means used to center the dataset
(center
and Center
have no difference, except that the second has a class)
the scaling applied to each variable
number of observations
if scores = TRUE
, the scores of the supplied data
on the principal components. Scores are coordinates in a basis given by the principal
components and thus not compositions
the matched call
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
.
an rplus-dataset (for princomp) or a result from princomp.rplus
not used
a logical indicating whether scores should be computed or not
the number of components to be drawn in the scree plot
type of the plot: "screeplot"
is a lined screeplot,
"variance"
is a boxplot-like screeplot, "biplot"
is a
biplot, "loadings"
displays the loadings as a
barplot
the multiple of sigma to use when plotting the loadings
title of the plot
a fitted princomp.rplus object
another amount dataset of class rcomp
further arguments to pass to internally-called functions
provides the covariance matrix to be used for the principle component analysis
provides the be used for the computation of scores
Gives the robustness type for the calculation of the
covariance matrix. See var.rmult
for details.
Mainly a princomp(iit(x))
is performed. Note all parts in a composition
or in an amount vector share a natural scaling. Therefore, they do not need any
preliminary standardization (which in fact would produce a loss of important information).
For this reason, princomp.rplus
works on the covariance matrix.
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 uses, additionally to the
classical interperation, a compositional concept: the
differences between two arrowheads can be interpreted as the shift of mass
between the two components represented by the arrows.
The amount loading plot is more or less a standard
loadings plot. The loadings are displayed by a barplot as positive and
negative changes of amounts.
The loadings plot can work in two different modes: If
scale.sdev
is set to NA
it displays the amount vector
being represented by the unit vector of loadings in the iit-transformed space. If
scale.sdev
is numeric we use this amount vector 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.
iit
,rplus
, relativeLoadings
princomp.rcomp
, princomp.aplus
,
data(SimulatedAmounts)
pc <- princomp(rplus(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))
Run the code above in your browser using DataLab