I want to understand how the principal() function in psych package calculate the $score element.
I want to try the covariance matrix rather than correlation matrix.
model <- principal(mtcars[8:11],nfactors=4, rotate='none', scores=T, cov=T)
Basically, the scores of the PCA should be linear combination of original centered data, using loading matrix as the weights, so I tried:
test <- scale(mtcars[8:11], center=T, scale=F) %*% model$loadings / model$scores
I understand that the principal()
function use some sort of scaling on loadings, however, the ratio should still be the same for each column, which is not the case here for test
.
If I use the correlation matrix, this will not be a problem. For example:
model <- principal(mtcars[8:11],nfactors=4, rotate='none', scores=T, cov=F)
test <- scale(mtcars[8:11], center=T, scale=T) %*% model$loadings / model$scores
The help document uses the terminology of factor analysis which confused me more. Hope somebody can enlighten me here.
Thank you in advance!