View source: R/FitRwithPCAandWALS.R
FitRwithPCAandWALS | R Documentation |
Function FitRwithPCAandWALS
uses principal component analysis (PCA) and weighted alternating least squares (WALS) to
calculate different low-rank approximations to the correlation matrix.
FitRwithPCAandWALS(R, nd = 2, itmaxout = 10000, itmaxin = 10000, eps = 1e-08)
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 |
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.
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 |
Jan Graffelman (jan.graffelman@upc.edu)
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 \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/00031305.2023.2186952")}
wAddPCA
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.