prcomp                  package:mva                  R Documentation

_P_r_i_n_c_i_p_a_l _C_o_m_p_o_n_e_n_t_s _A_n_a_l_y_s_i_s

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_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. Alternately, 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 components
          should be omitted. (Components are omitted if their standard
          deviations are less than or equal to `tol' times the standard
          deviation of the first component.) With the default null
          setting, no components are omitted.  Other settings for tol
          could be `tol = 0' or `tol = sqrt(.Machine$double.eps)',
          which would omit essentially constant components.

_D_e_t_a_i_l_s:

     The calculation is done by a singular value decomposition of the
     (centered and scaled) 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_a_l_u_e:

     `prcomp' returns an list with class `"prcomp"' containing the
     following components: 

    sdev: the standard deviations of the principal components (i.e.,
          the square roots of the eigenvalues of the
          covariance/correlation 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 columns
          contain the eigenvectors).  The function `princomp' returns
          this in the element `loadings'.

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

_R_e_f_e_r_e_n_c_e_s:

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

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

_S_e_e _A_l_s_o:

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

_E_x_a_m_p_l_e_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))

