Principal Component Analysis

Share:

Description

Calculates principal components from a matrix

Usage

1
pca(mat, cent = TRUE, scle = FALSE)

Arguments

mat

a numeric matrix.

cent

a logical value referring to center argument in scale.

scle

a logical value referring to scale argument in scale.

Value

a list containing

pcs

a matrix of principal component loadings

d

a matrix containing the singular value (eigenvalue) of each principal component on its diagonal

v

a matrix of eigenvectors

Author(s)

R port by Chris Walsh cwalsh@unimelb.edu.au from S+ library by Glenn De'ath g.death@aims.gov.au.

Examples

1
2
3
4
5
6
7
8
9
         data(soilspec)
         species <- sqrt(soilspec[,2:9])
         specpca <- pca(species)
         eqscplot(specpca$pcs[,1], specpca$pcs[,2], type = "n",
              xlab = "Principal component 1",
              ylab = "Principal component 2") 
         text(specpca$pcs[,1], specpca$pcs[,2], 
              soilspec$site) 
         mtext(paste("Grassland communities in 45 sites"))