pca: Principal Component Analysis

Description Usage Arguments Value Examples

Description

Implements the Principal Component Analysis (PCA) algorithm

Usage

1
2
pca(x, space = c("rows", "columns"), nsv = NULL, center = TRUE,
  scale = FALSE)

Arguments

x

An n x p matrix.

space

Specifies which space to do the projections. Either "row" or "column", default is "row".

nsv

Optional. An integer specifying the number of PCs.

center

If TRUE then matrix will be mean centered. Default is TRUE.

scale

If TRUE then matrix will be normalized. Default is FALSE

Value

A list of object type "pca" containing:

pc

A matrix containing the principal components.

loading

A matrix containing the loadings.

pve

A vector containing the percent variation explained by each PC.

Examples

1
2
3
4
5
6
# import data
X <- matrix(rnorm(100 * 10), ncol = 10)

out_pca <- pca(X)

scree_plot(out_pca)

jdstorey/fastats documentation built on May 16, 2019, 9:29 a.m.