lol.project.pca {lolR} | R Documentation |
Principal Component Analysis (PCA)
Description
A function that performs PCA on data.
Usage
lol.project.pca(X, r, xfm = FALSE, xfm.opts = list(), robust = FALSE, ...)
Arguments
X |
[n, d] the data with n samples in d dimensions.
|
r |
the rank of the projection.
|
xfm |
whether to transform the variables before taking the SVD.
FALSEapply no transform to the variables.
'unit'unit transform the variables, defaulting to centering and scaling to mean 0, variance 1. See scale for details and optional arguments to be passed with xfm.opts .
'log'log-transform the variables, for use-cases such as having high variance in larger values. Defaults to natural logarithm. See log for details and optional arguments to be passed with xfm.opts .
'rank'rank-transform the variables. Defalts to breaking ties with the average rank of the tied values. See rank for details and optional arguments to be passed with xfm.opts .
c(opt1, opt2, etc.)apply the transform specified in opt1, followed by opt2, etc.
|
xfm.opts |
optional arguments to pass to the xfm option specified. Should be a numbered list of lists, where xfm.opts[[i]] corresponds to the optional arguments for xfm[i] . Defaults to the default options for each transform scheme.
|
robust |
whether to perform PCA on a robust estimate of the covariance matrix or not. Defaults to FALSE .
|
... |
trailing args.
|
Value
A list containing the following:
A |
[d, r] the projection matrix from d to r dimensions.
|
d |
the eigen values associated with the eigendecomposition.
|
Xr |
[n, r] the n data points in reduced dimensionality r .
|
Details
For more details see the help vignette:
vignette("pca", package = "lolR")
Author(s)
Eric Bridgeford
Examples
library(lolR)
data <- lol.sims.rtrunk(n=200, d=30) # 200 examples of 30 dimensions
X <- data$X; Y <- data$Y
model <- lol.project.pca(X=X, r=2) # use pca to project into 2 dimensions
[Package
lolR version 2.1
Index]