txPca: PCA transform.

txPcaR Documentation

PCA transform.

Description

txPca transforms data using principal component analysis. TODO

Usage

txPca(x, k = 3, ...)

Arguments

x

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

k

number of dimensions of the result, defaults to 3 in order to be usable in plot3dProj

...

additional arguments to prcomp

Value

Transform function taking two arguments: a data matrix y to transform, and a logical center determining whether the data are to be centered, or not. The parameters of the transform get returned in the params attribute (see prcomp). In addition, there is the varExplained function added to the parameters, which takes k, the number of components, and returns the contribution of individual dimensions to the top k components.

Author(s)

Tomas Sieger

See Also

prcomp, txSpca, plot3dProj

Examples

tx<-txPca(iris[,1:4])
plot(tx(iris[,1:4])[,1:2],pch=19,col=c('red','green','blue')[as.numeric(iris$Species)])

if (interactive() && require(rgl)) {
  # a 3D example
  x<-iris[,1:4]
  y<-iris$Species
  plot3dProj(x, cls=y, tx=txPca(x))
}

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