FitRwithPCAandWALS {Correlplot} | R Documentation |
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)
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 |
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.
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 |
Author(s)
Jan Graffelman (jan.graffelman@upc.edu)
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
See Also
Examples
data(HeartAttack)
X <- HeartAttack[,1:7]
X[,7] <- log(X[,7])
colnames(X)[7] <- "logPR"
R <- cor(X)
## Not run:
out <- FitRwithPCAandWALS(R)
## End(Not run)