geigen: Generalized eigenvalue decomposition

Description Usage Arguments Value Author(s) See Also Examples

View source: R/geigen.R

Description

geigen takes in constraints (W), (usually diagonal matrices, but any positive semi-definite matrix) that are applied to the data (X). Constraints are used for the orthogonality conditions.

Usage

1
geigen(X, W, k = 0, tol = sqrt(.Machine$double.eps), symmetric)

Arguments

X

a square, symmetric data matrix to decompose

W

Weights – the constraints applied to the matrix and thus the eigen vectors.

k

total number of components to return though the full variance will still be returned (see d_full). If 0, the full set of components are returned.

tol

default is sqrt(.Machine$double.eps). A tolerance level for eliminating effectively zero (small variance), negative, imaginary eigen/singular value components.

symmetric

if X is symmetric, set as TRUE. See eigen.

Value

A list with eight elements:

d_full

A vector containing the singular values of X above the tolerance threshold (based on eigenvalues).

l_full

A vector containing the eigen values of X above the tolerance threshold (tol).

d

A vector of length min(length(d_full), k) containing the retained singular values of X

l

A vector of length min(length(l_full), k) containing the retained eigen values of X

v

Eigenvectors. Dimensions are ncol(X) by k.

q

Generalized eigenvectors. Dimensions are ncol(X) by k.

fj

Component scores. Dimensions are ncol(X) by k.

Author(s)

Derek Beaton

See Also

tolerance_eigen, gsvd and gplssvd

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## (Metric) Multidimensional Scaling
data(wine, package="GSVD")
D <- as.matrix(dist(wine$objective))
masses <- rep(1/nrow(D), nrow(D))
Xi <- diag(nrow(D)) - ( rep(1,nrow(D)) %o% masses )
S <- Xi %*% (-(D^2) / 2) %*% t(Xi)
mds.res_geigen <- geigen(S)

## Principal components analysis: "covariance"
cov_X <- as.matrix(cov(wine$objective))
cov_pca.res_geigen <- geigen(cov_X)

## Principal components analysis: "correlation"
cor_X <- as.matrix(cor(wine$objective))
cor_pca.res_geigen <- geigen(cor_X)

derekbeaton/GSVD documentation built on Jan. 2, 2021, 9:21 p.m.