View source: R/utility_functions.R
extract_rmse | R Documentation |
Given two vectors of loadings, computes the root mean square between them.
extract_rmse(vector1, vector2)
vector1 |
First numerical vector of loadings for the calculation. |
vector2 |
Second numerical vector of loadings for the calculation. |
RMSE has been also used as a metric for factor matching (see ref). It is calculated as:
RMSE_{x,y} = sqrt( sum((x_{i}-y_{i})^2) / n)
Where n is the number of variables in both components x and y. A RMSE of 0 corresponds to a perfect match. The smaller the RMSE is, the more equivalent two components are.
Returns the root mean square (RMS) between vector1 and vector2.
Abel Torres Espin
Guadagnoli E, Velicer W. A Comparison of Pattern Matching Indices. Multivar Behav Res. 1991 Apr;26(2):323–43
data(mtcars) pca_mtcars_1<-prcomp(mtcars, center = TRUE, scale = TRUE) #Second pca with a subsetted mtcars as an example of comparing loading patterns #from two proximal datasets pca_mtcars_2<-prcomp(mtcars[1:20,], center = TRUE, scale = TRUE) s.loadings_1<-stand_loadings(pca = pca_mtcars_1, pca_data = mtcars) s.loadings_2<-stand_loadings(pca = pca_mtcars_2, pca_data = mtcars[1:20,]) extract_rmse(s.loadings_1[,1], s.loadings_2[,1])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.