rmsePCAandWALS {Correlplot}R Documentation

Generate a table of root mean square error (RMSE) statistics for principal component analysis (PCA) and weighted alternating least squares (WALS).

Description

Function rmsePCAandWALS creates table with the RMSE for each variable, for a low-rank approximation to the correlation matrix obtained by PCA or WALS.

Usage

rmsePCAandWALS(R, output, digits = 4, omit.diagonals = c(FALSE,FALSE,TRUE,TRUE))

Arguments

R

The correlation matrix

output

A list object with four approximationst to the correlation matrix

digits

The number of digits used in the output

omit.diagonals

Vector of four logicals for omitting the diagonal of the correlation matrix for RMSE calculations. Defaults to c(FALSE,FALSE,TRUE,TRUE), to include the diagonal for PCA and exclude it for WALS

Value

A matrix with one row per variable and four columns for RMSE statistics.

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. doi:10.1080/00031305.2023.2186952

See Also

FitRwithPCAandWALS

Examples

data(HeartAttack)
X <- HeartAttack[,1:7]
X[,7] <- log(X[,7])
colnames(X)[7] <- "logPR"
R <- cor(X)
## Not run: 
out <- FitRwithPCAandWALS(R)
Results <- rmsePCAandWALS(R,out)

## End(Not run)

[Package Correlplot version 1.1.0 Index]