Extracting factor correlation matrix with significance levels in R's lavaan for CFA

I’m working on a confirmatory factor analysis (CFA) for my survey using R’s lavaan package. I’ve managed to get the correlation matrix for the factors but I’m stuck on how to include the p-values for each correlation. Is there a way to get both in one go?

Here’s what I’ve tried so far:

model <- '
attention =~ q1 + q2 + q3
memory    =~ q4 + q5 + q6
logic     =~ q7 + q8 + q9
'

result <- cfa(model, data = my_dataset)
cor_matrix <- cov2cor(inspect(result, what = "est")$psi)

This gives me the correlation matrix, but I’m missing the significance levels. Any ideas on how to add those p-values to my output? Thanks for any help!

Hey there! :wave: I’m curious about your CFA project - sounds intriguing! Have you considered using the modindices() function? It might give you some extra insights.

Here’s a thought: what if you combined the standardizedSolution() approach Emma mentioned with modindices()? Something like:

std_solution <- standardizedSolution(result)
mod_indices <- modindices(result)

This could give you a more comprehensive view of your model. What kind of patterns are you expecting to see in your factor correlations? And have you thought about how you’ll visualize all this data?

I’m always fascinated by how different researchers interpret CFA results. What’s your take on balancing statistical significance with practical significance in your field? Would love to hear your thoughts!

Great question! I’ve encountered this issue before while working on a similar project. While lavaan doesn’t provide a direct method to get p-values for factor correlations, there’s a workaround using the parameterEstimates() function.

Try adding these lines after your existing code:

pe <- parameterEstimates(result)
factor_correlations <- subset(pe, op == "~~" & lhs != rhs)

This will give you a data frame with correlations and their p-values. You can then combine this with your correlation matrix for a complete picture.

Keep in mind that for large sample sizes, even small correlations might appear significant. It’s always good practice to consider effect sizes alongside p-values when interpreting your results.

Hope this helps! Let me know if you need any clarification.

hey, I’ve dealt with this before. u can use the standardizedSolution() function from lavaan. it gives u both the correlations and p-values in one go. just do:

standardizedSolution(result)

look for rows where op is ‘~~’ and lhs/rhs are different. thats ur factor correlations with p-values. hope this helps!