I’m working on a Confirmatory Factor Analysis (CFA) for my survey using the lavaan package in R. I can get the correlation matrix of factors, but I’m struggling to find a way to include the p-values for these correlations. I’ve tried using cov2cor(inspect(fit, what = "est")$psi), but it only gives me the matrix without significance levels.
Here’s a basic example of my CFA model:
model <- '
factor1 =~ q1 + q2 + q3
factor2 =~ q4 + q5 + q6
factor3 =~ q7 + q8 + q9
'
results <- cfa(model, data = my_data,
auto.var = TRUE, auto.fix.first = TRUE,
auto.cov.lv.x = TRUE)
Does anyone know how to get both the correlation matrix and the associated p-values for the factors in this setup? I’d really appreciate any help or suggestions!
yo, have u tried the parameterEstimates() function? it might give u what ur looking for. just run it on ur fit object like parameterEstimates(results) and look for the rows where op is ‘~~’. that should show correlations between factors with p-values. hope this helps!
While lavaan doesn’t directly provide p-values for factor correlations, there’s a workaround you can try. After running your CFA, extract the standardized estimates and their standard errors:
std_est <- standardizedSolution(results)
factor_corr <- std_est[std_est$op == '~~' & std_est$lhs != std_est$rhs, ]
Then calculate z-scores and p-values:
factor_corr$z <- factor_corr$est.std / factor_corr$se
factor_corr$p <- 2 * (1 - pnorm(abs(factor_corr$z)))
This should give you the factor correlations with their corresponding p-values. Keep in mind that this method assumes normality, so interpret results cautiously if your data violates this assumption. Also, consider adjusting for multiple comparisons if you’re testing many correlations simultaneously.
Hey there DancingButterfly! 
I’ve been messing around with lavaan for my own research, and I totally get your frustration with those pesky p-values. Have you considered using the semTools package? It’s got some neat functions that play nice with lavaan and might solve your problem.
Try this out:
library(semTools)
factor_corr <- standardizedSolution(results)
factor_corr_table <- subset(factor_corr, op == '~~' & lhs != rhs)
This should give you a nice table with standardized correlations and p-values. It’s been a lifesaver for me!
Also, just curious - what kind of survey are you working on? Sounds interesting if you’ve got multiple factors. Mind sharing a bit about your research? I’m always eager to learn about what others are up to in the CFA world!