pca {mining}R Documentation

Principal Component Analysis

Description

Computes a projection matrix that preserves spread.

Usage

pca(x,k=1)

Arguments

x a data frame.
k the number of dimensions to project down to.

Details

The projection is chosen so that the projected data is as "spread out" as possible, measured according to the determinant of the covariance matrix. This turns out to be the top k eigenvectors of the data covariance matrix.

The projection is "stabilized" so that small changes in the data do not cause sign flips in the projection.

Value

A matrix with named rows matching the numeric columns of x and columns named h1, ..., hk. Each column denotes a new dimension to be obtained as a linear combination of the numeric variables in x.

Author(s)

Tom Minka

See Also

project, projection, pca in the multiv package

Examples

data(Housing)
w = pca(HousingT,k=2)
plot(project(HousingT,w),asp=1)
plot.axes(w)

[Package Contents]