

   prcomp {mva}                                 R Documentation

   PPrriinncciippaall CCoommppoonneennttss AAnnaallyyssiiss

   DDeessccrriippttiioonn::

        Performs a principal components analysis on the given
        data matrix and returns the results as an object of
        class `prcomp'.

   UUssaaggee::

        prcomp(x, retx = TRUE, center = TRUE, scale. = FALSE, tol = NULL)

   AArrgguummeennttss::

          x: a matrix (or data frame) which provides the data
             for the principal components analysis.

       retx: a logical value indicating whether the rotated
             variables should be returned.

     center: a logical value indicating whether the variables
             should be shifted to be zero centered. Alter-
             nately, a vector of length equal the number of
             columns of `x' can be supplied.  The value is
             passed to `scale'.

      scale: a logical value indicating whether the variables
             should be scaled to have unit variance before the
             analysis takes place. The default is `FALSE' for
             consistency with S, but in general scaling is
             advisable. Alternately, a vector of length equal
             the number of columns of `x' can be supplied.  The
             value is passed to `scale'.

        tol: a value indicating the magnitude below which com-
             ponents should be omitted. With the default null
             setting, no components are omitted.  Other set-
             tings for tol could be `tol = 0' or `tol =
             sqrt(.Machine$double.eps)'.

   DDeettaaiillss::

        The calculation is done by a singular-value decomposi-
        tion of the data matrix, not by using eigen on the
        covariance matrix.  This is generally the preferred
        method for numerical accuracy.  The `print' method for
        the these objects prints the results in a nice format
        and the `plot' method produces a scree plot.

   VVaalluuee::

        `prcomp' returns an list with class `"prcomp"' contain-
        ing the following components:

       sdev: the standard deviation of the principal components
             (i.e., the eigenvalues of the cov matrix, though
             the calculation is actually done with the singular
             values of the data matrix).

   rotation: the matrix of variable loadings (i.e., a matrix
             whose olumns contain the eigenvectors).  The func-
             tion `princomp' returns this in the element `load-
             ings'.

          x: if `retx' is true the value of the rotated data
             (the data multiplied by the `rotation' matrix) is
             returned.

   RReeffeerreenncceess::

        Mardia, K. V., J. T. Kent, J and M. Bibby (1979), Mul-
        tivariate Analysis, London: Academic Press.

        Venables, W. N. and B. D. Ripley (1997), Modern Applied
        Statistics with S-PLUS, Springer-Verlag.

   SSeeee AAllssoo::

        `princomp', `cor', `cov', `svd', `eigen'.

   EExxaammpplleess::

        ## the variances of the variables in the
        ## USArrests data vary by orders of magnitude
        data(USArrests)
        prcomp(USArrests)
        prcomp(USArrests, scale = TRUE)
        plot(prcomp(USArrests))
        summary(prcomp(USArrests))

