wAddPCA {Correlplot}R Documentation

Low-rank matrix approximation by weighted alternating least squares

Description

Function wAddPCA calculates a weighted least squares approximation of low rank to a given matrix.

Usage

wAddPCA(x, w = matrix(1, nrow(x), ncol(x)), p = 2, add = "all", bnd = "opt",
        itmaxout = 1000, itmaxin = 1000, epsout = 1e-06, epsin = 1e-06,
	verboseout = TRUE, verbosein = FALSE)

Arguments

x

The data matrix to be approximated

w

The weight matrix

p

The dimensionality of the low-rank solution (2 by default)

add

The additive adjustment to be employed. Can be "all" (default), "nul" (no adjustment), "one" (adjustment by a single scalar), "row" (adjustment by a row) or "col" (adjustment by a column).

bnd

Can be "opt" (default), "all", "row" or "col".

itmaxout

Maximum number of iterations for the outer loop of the algorithm

itmaxin

Maximum number of iterations for the inner loop of the algorithm

epsout

Numerical criterion for convergence of the outer loop

epsin

Numerical criterion for convergence of the inner loop

verboseout

Be verbose on the outer loop iterations

verbosein

Be verbose on the inner loop iterations

Value

A list object with fields:

a

The left matrix (A) of the factorization X = AB'

b

The right matrix (B) of the factorization X = AB'

z

The product AB'

f

The final value of the loss function

u

Vector for rows used to construct rank 1 weights

v

Vector for columns used to construct rank 1 weights

p

The vector with row adjustments

q

The vector with column adjustments

itel

Iterations needed for convergence

delta

The additive adjustment

y

The low-rank approximation to x

Author(s)

jan@deleeuwpdx.net

References

Graffelman, J. and De Leeuw, J. (2023) Improved approximation and visualization of the correlation matrix. The American Statistician pp. 1–20. Available online as latest article doi:10.1080/00031305.2023.2186952

https://jansweb.netlify

See Also

ipSymLS

Examples

data(HeartAttack)
X <- HeartAttack[,1:7]
X[,7] <- log(X[,7])
colnames(X)[7] <- "logPR"
R <- cor(X)
W <- matrix(1, 7, 7)
diag(W) <- 0
Wals.out <- wAddPCA(R, W, add = "nul", verboseout = FALSE) 
Rhat <- Wals.out$y

[Package Correlplot version 1.1.0 Index]