wsvd: Weighted Singular Value Decomposition

Description Usage Arguments Value References Examples

View source: R/utilities.R

Description

The singular value decomposition of a matrix X solves the equation X = UDV', where U is the matrix of left singular vectors, D is a diagonal matrix of singular values (δ), and V is a matrix of right singular vectors.

Note that U is equivalent to the eigenvectors of the matrix XX' and V is equivalent to the eigenvectors of the matrix X'X. This implementation of singular value decomposition has three main features:

  1. The decomposition of X is sped up by first computing the SVD of either XX' (p>n) or X'X (p<n), rather than that of X. For the case of p>n, this is XX' = U D^2 U', and for the case of p<n, this is X'X = V D^2 V'. This respectively gives the left or right singular vectors. For p>n, the right singular vectors are then obtained via V = X'UD^-1, and for p<n the left singular vectors are obtained via U = X'VD^-1. The reason this approach improves speed of calculation for large data sets is that the SVD is only performed on a matrix with min(n,p) by min(n,p) dimensions, which can be substantially faster than performing SVD on a data set n by p dimensions.

  2. The observations going into the SVD are allowed to be weighted. Currently weights on the variables are not implemented. The weighted left singular vectors are defined as Ω = W^-0.5U. The resulting singular values Δ are then the singular values of the weighted data matrix Φ, where Φ = Ω Δ V'.

  3. Only the singular values and singular vectors corresponding to δ > tol, where tol is a tolerance for small values. Values less than or equal to tol are considered to be zero.

Usage

1
wsvd(x, weights = NULL, method = c("dc", "std"), tol = 1e-04)

Arguments

x

a matrix

weights

row weights. defaults to equal weights and returns the typical SVD.

method

whether the divide and conquer ("dc") or standard ("std") algorithm should be used for the SVD.

tol

tolerance for small singular values. values <= tol are considered zero and truncated.

Value

a list

References

Abdi, H. (2007) Singular Value Decomposition (SVD) and Generalized Singular Value Decomposition (GSVD). Encyclopedia of Measurement and Statistics.

Examples

1
wsvd(iris[,-5])

abnormally-distributed/cvreg documentation built on May 3, 2020, 3:45 p.m.