Solved – How to perform factor and canonical correlation analysis on correlation matrices in R

correlationfactor analysismultivariate analysisr

I know how to do factor and canonical correlation analysis on raw data in R. But sometimes we only having correlation matrices for the data. I'd like to know any R functions which can take correlation matrices as input for factor and canonical correlation analysis. It is easy to write dedicated functions but it is nicer to have some built-in tested functions.

Best Answer

Ideas for factor analysis and PCA:

# get some Big 5 personality data and pretend we only have cor matrix and n
library(psych)
bfi <- na.omit(bfi[, 1:25])
xcor <- cor(bfi)
xn <- nrow(bfi)

# factor analysis using correlation matrix
factanal(covmat=xcor, n.obs=xn, factors=5)

# Principal components analysis using psych package
psych::principal(r=xcor, n.obs=xn, nfactors=5)

Canonical correlation analysis

  • I don't think CCA or cancor takes correlation matrices as input.
  • You could use one of the sem packages in R to perform canonical correlation analysis. I know that sem can take a correlation matrix as input.
Related Question