genpca | R Documentation |
Compute a PCA in a inner-product space defined by row and column constraint matrices.
genpca(
X,
A = NULL,
M = NULL,
ncomp = min(dim(X)),
preproc = multivarious::center(),
deflation = FALSE,
threshold = 1e-06,
use_cpp = TRUE,
maxeig = 800,
warn_approx = TRUE
)
X |
the data matrix |
A |
the column constraints. Can be a |
M |
the row constraints. Can be a |
ncomp |
the number of components to return |
preproc |
a pre-processing function (e.g. |
deflation |
use the iterative deflation method |
threshold |
convergence threshold for deflation method |
use_cpp |
use the C++ implementation |
maxeig |
upper bound on the dimension used for eigen decompositions.
If the dimension of a constraint matrix is at most this value a full eigen
decomposition is used. Otherwise only the leading |
warn_approx |
logical; emit a warning when an approximate eigen decomposition is used. |
Pre-processing such as scaling and centering is carried out using special functions from the multivarious
package.
Basic options are multivarious::center()
, multivarious::standardize()
, and for no pre-processing at all, multivarious::pass()
.
When method = "eigen"
, the maxeig
parameter controls how eigen
decompositions of the constraint matrices are performed. If the dimension of a
constraint matrix does not exceed maxeig
a full eigen decomposition is
used. Otherwise only the leading maxeig
eigenvalues and vectors are
computed via RSpectra::eigs_sym
, producing an approximate result.
Set warn_approx = FALSE
to suppress the warning about this
approximation.
an instance of type genpca
, extending bi_projector
Abdi, H. (2007). Singular value decomposition (SVD) and generalized singular value decomposition. Encyclopedia of measurement and statistics, 907-912.
Allen, G. I., Grosenick, L., & Taylor, J. (2014). A generalized least-square matrix decomposition. Journal of the American Statistical Association, 109(505), 145-159.
X <- matrix(rnorm(100*100), 100,100)
A <- cov(X)
M <- cov(t(X))
gp1 <- genpca(X, A=A, M=M, ncomp=100)
Xrecon <- reconstruct(gp1)
gp2 <- truncate(gp1,2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.