pca                  package:labdsv                  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:

     Principal components analysis is a eigenanalysis of a correlation
     or covariance matrix used to project a high-dimensional  system to
     fewer dimensions.

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

     pca(mat, cor = FALSE, dim = min(nrow(mat),ncol(mat)))
     ## S3 method for class 'pca':
     summary(object, dim = length(object$sdev), ...)
     ## S3 method for class 'pca':
     scores(x, labels = NULL, dim = length(x$sdev))
     ## S3 method for class 'pca':
     loadings(x, dim = length(x$sdev), digits = 3, cutoff = 0.1)

_A_r_g_u_m_e_n_t_s:

     mat: a matrix or dataframe of interest, samples as rows, 
          attributes as columns

     cor: logical: whether to use a correlation matrix (if TRUE), or
          covariance matrix (if FALSE)

     dim: the number of dimensions to return

  object: an object of class 'pca'

       x: an object of class 'pca'

  labels: an (optional) vector of labels to identify points

  digits: number of digits to report

  cutoff: threshold to suppress printing small values

     ...: arguments to pass to function summary

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

     PCA is a common multivariate technique.  The version here is
     simply a wrapper for the 'prcomp' function to make its use and 
     plotting consistent with the other LabDSV functions

_V_a_l_u_e:

     an object of class "pca", a list with components: 

  scores: a matrix of the coordinates of the samples in the reduced
          space

loadings: a matrix of the contributions of the variables to the axes of
          the reduced space.

    sdev: a vector of standard deviations for each dimension

_N_o_t_e:

     The current version of pca is based on the 'prcomp' function, as
     opposed to the princomp function.  Nonetheless,  it maintains the
     more conventional labels "scores" and "loadings", rather than x
     and rotation.  prcomp is based on a  singular value decomposition
     algorithm, as has worked better in our experience.  In the rare
     cases where it fails, you may want to try 'princomp'.

_A_u_t_h_o_r(_s):

     David W. Roberts droberts@montana.edu <URL:
     http://ecology.msu.montana.edu/droberts>

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

     <URL: http://ecology.msu.montana.edu/labdsv/R>

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

     'princomp', 'prcomp', 'pco',   'nmds', 'fso',   'cca'

_E_x_a_m_p_l_e_s:

         data(bryceveg) # returns a vegetation dataframe
         data(brycesite)
         x <- pca(bryceveg,dim=10)  # returns the first 10 eigenvectors and loadings
         plot(x)
         surf(x,brycesite$elev)
         points(x,brycesite$depth=='deep')

