Learn R Programming

Correlplot (version 1.1.0)

FitRwithPCAandWALS: Calculate a low-rank approximation to the correlation matrix with four methods

Description

Function FitRwithPCAandWALS uses principal component analysis (PCA) and weighted alternating least squares (WALS) to calculate different low-rank approximations to the correlation matrix.

Usage

FitRwithPCAandWALS(R, nd = 2, itmaxout = 10000, itmaxin = 10000, eps = 1e-08)

Value

A list object with fields:

Rhat.pca

Low-rank approximation obtained by PCA

Rhat.pca.adj

Low-rank approximation obtained by PCA with adjustment

Rhat.wals

Low-rank approximation obtained by WALS without fitting the diagonal

Rhat.wals.adj

Low-rank approximation obtained by WALS without fitting the diagonal and with adjustment

Arguments

R

The correlation matrix

nd

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

itmaxout

Maximum number of iterations for the outer loop of the algorithm

itmaxin

Maximum number of iterations for the inner loop of the algorithm

eps

Numerical criterion for convergence of the outer loop

Author

Jan Graffelman (jan.graffelman@upc.edu)

Details

Four methods are run succesively: standard PCA; PCA with an additive adjustment; WALS avoiding the fit of the diagonal; WALS avoiding the fit of the diagonal and with an additive adjustment.

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 tools:::Rd_expr_doi("10.1080/00031305.2023.2186952")

See Also

wAddPCA

Examples

Run this code
data(HeartAttack)
X <- HeartAttack[,1:7]
X[,7] <- log(X[,7])
colnames(X)[7] <- "logPR"
R <- cor(X)
if (FALSE) {
out <- FitRwithPCAandWALS(R)
}

Run the code above in your browser using DataLab