pca: Principal Components Analysis

pcaR Documentation

Principal Components Analysis

Description

Computes a principal components analysis based on the singular value decomposition.

Usage

pca(object, ...)

## S4 method for signature 'data.frame'
pca(
  object,
  center = TRUE,
  scale = TRUE,
  rank = NULL,
  sup_row = NULL,
  sup_col = NULL,
  sup_quali = NULL,
  weight_row = NULL,
  weight_col = NULL
)

## S4 method for signature 'matrix'
pca(
  object,
  center = TRUE,
  scale = TRUE,
  rank = NULL,
  sup_row = NULL,
  sup_col = NULL,
  weight_row = NULL,
  weight_col = NULL
)

Arguments

object

A m \times p numeric matrix or a data.frame.

...

Currently not used.

center

A logical scalar: should the variables be shifted to be zero centered?

scale

A logical scalar: should the variables be scaled to unit variance?

rank

An integer value specifying the maximal number of components to be kept in the results. If NULL (the default), p - 1 components will be returned.

sup_row

A vector specifying the indices of the supplementary rows.

sup_col

A vector specifying the indices of the supplementary columns.

sup_quali

A vector specifying the indices of the supplementary qualitative columns.

weight_row

A numeric vector specifying the active row (individual) weights. If NULL (the default), uniform weights are used. Row weights are internally normalized to sum 1

weight_col

A numeric vector specifying the active column (variable) weights. If NULL (the default), uniform weights (1) are used.

Value

A PCA object.

Author(s)

N. Frerebeau

References

Lebart, L., Piron, M. and Morineau, A. Statistique exploratoire multidimensionnelle: visualisation et inférence en fouille de données. Paris: Dunod, 2006.

See Also

svd()

Other multivariate analysis: ca(), mca(), pcoa(), predict()

Examples

## Load data
data("iris")

## Compute principal components analysis
X <- pca(iris)

## Get eigenvalues
get_eigenvalues(X)

## Get individual cos2
head(get_cos2(X, margin = 1))

## Get variable contributions
get_contributions(X, margin = 2)

## Get correlations between variables and dimensions
get_correlations(X)

dimensio documentation built on Sept. 11, 2024, 8:35 p.m.