tolerance_svd: 'tolerance_svd': An SVD to truncate potentially spurious...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/tolerance_svd.R

Description

tolerance_svd eliminates likely spurious components: any eigenvalue (squared singular value) below a tolerance level is elminated. The (likely) spurious singular values and vectors are then eliminated from $u, $d, and $v. Additionally, all values in abs($u) or abs($v) that fall below the tol are set to 0. The use of a real positive value for tol will eliminate any small valued components. With tol, tolerance_svd will stop if any singular values are complex or negative.

Usage

1
tolerance_svd(x, nu = min(dim(x)), nv = min(dim(x)), tol = .Machine$double.eps)

Arguments

x

A data matrix of size for input to the singular value decomposition (svd)

nu

The number of left singular vectors to be computed. Default is min(dim(x))

nv

The number of right singular vectors to be computed. Default is min(dim(x))

tol

Default is .Machine$double.eps. A tolerance level for eliminating near machine precision components. Use of this parameter causes tolerance_svd to stop if negative or complex singular values are detected. The use of tol < 0, NA, NaN, Inf, -Inf, or NULL passes through to svd.

Value

A list with three elements (like svd):

d

A vector containing the singular values of x > tol.

u

A matrix whose columns contain the left singular vectors of x, present if nu > 0. Dimension min(c(nrow(x), nu, length(d)).

v

A matrix whose columns contain the right singular vectors of x, present if nv > 0. Dimension min(c(ncol(x), nv, length(d)).

Author(s)

Derek Beaton

See Also

svd

Examples

1
2
3
4
5
 data(wine)
 X <- scale(as.matrix(wine$objective))
 s_asis <- tolerance_svd(X)
 s_.Machine <- tolerance_svd(X, tol= .Machine$double.eps)
 s_000001 <- tolerance_svd(X, tol=.000001)

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