spca: Supervised PCA.

spcaR Documentation

Supervised PCA.

Description

spca computes supervised principal component analysis as described in Barshan et al.

Usage

spca(x, y = diag(1, nrow(x)), 
    center = TRUE, scale = FALSE, 
    retx = FALSE, debug = FALSE)

Arguments

x

a data matrix (features in columns, samples in rows)

y

target classification of x (logical, numeric, or a factor), or a kernel matrix of the target. If not specified, it defaults to identity matrix, in which case SPCA becomes equivalent to classical PCA (as the matrix being decomposed equals the covariance matrix of 'x'. (Strictly speaking, when centering is in use, SPCA becomes the classical PCA. Otherwise, SPCA yields components similar to those yielded by PCA over centered data, but shifted.)

center

a logical value indicating whether to center the data. This is advisable.

scale

a logical value indicating whether to scale the data to have unit variance.

retx

a logical value indicating whether to return the rotated version of 'x'

debug

if TRUE, debugs will be printed. If numeric of value greater than 1, verbose debugs will be produced.

Value

Eigenvalue decomposition of Q (see the paper). The value is a list of values and vectors components (see eigen, Q, the matrix being decomposed, and center and scale holding the centering and scaling used, or FALSE. If retx is TRUE, the rotated version of x is returned in x. The number of eigenvalues and eigenvectors correspond to the dimension of the output space.

Author(s)

Tomas Sieger

References

Barshan, E., Ghodsi, A., Azimifar, Z., Jahromi, M. Z. _Supervised principal component analysis: Visualization, classification and regression on subspaces and submanifolds_. Pattern Recognition, Vol. 44, No. 7. (29 July 2011), pp. 1357-1371, doi:10.1016/j.patcog.2010.12.015.

Examples

spca(iris[,1:4],iris$Species)

tsieger/tsiMisc documentation built on Oct. 10, 2023, 10:24 p.m.