pca(x, ncomp = NULL, retx = TRUE,
center = TRUE, scale. = FALSE,
comp.tol = NULL, max.iter = 500,
tol = 1e-09)
NULL
,
a criterion of stop is given.x
can be supplied.
The value is passed to s
prcomp
function, but in general scaling is advisable. Alternativelypca
returns a list with class "pca" and "prcomp" containing the following components:retx
is true the value of the rotated data (the centred (and scaled if requested) data
multiplied by the rotation matrix) is returned.FALSE
.princomp
, the print method for these objects prints the
results in a nice format and the plot
method produces a scree plot.
Note that scale. = TRUE
cannot be used if there are zero or constant (for center = TRUE
) variables.
Components are omitted if their standard deviations are less than or equal to comp.tol
times
the standard deviation of the first component. With the default null setting, no components are omitted.
Other settings for comp.tol
could be comp.tol = 0
or comp.tol = sqrt(.Machine$double.eps)
,
which would omit essentially constant components.nipals
, prcomp
, biplot
,
plotIndiv
, plotVar
,
plot3dIndiv
, plot3dVar
.data(multidrug)
## this data set contains missing values, therefore
## the 'prcomp' function cannot be applied
pca.res <- pca(multidrug$ABC.trans, ncomp = 4, scale = TRUE)
plot(pca.res)
summary(pca.res)
biplot(pca.res, xlabs = multidrug$cell.line$Class, cex = 0.7)
Run the code above in your browser using DataLab