Correlation Matrix

1,132 views
Skip to first unread message

Fawad Latif

unread,
Feb 2, 2021, 9:30:17 AM2/2/21
to lav...@googlegroups.com
Hi

How do i get Correlation Matrix for Latent Variables in Lavaan. Or i shall use
Std.lv in the Covariances as Correlation between latent variables. 

Thanks

Mauricio Garnier-Villarreal

unread,
Feb 2, 2021, 9:34:11 AM2/2/21
to lavaan
the std.all column are the factor correlations
If you want to extract the factor correlations matrix you can with

lavinspect(fit, "cor.lv")

Harmanjit Singh

unread,
May 19, 2021, 10:50:32 PM5/19/21
to lavaan
Hi

Is there a way to get p-values in the matrix output along with correlation after using lavInspect(fit, "cor.lv")?

balal izanloo

unread,
May 20, 2021, 3:43:40 AM5/20/21
to lav...@googlegroups.com
Greetings
I think this link is appropriate for what you want. 


--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/8e724d31-9717-485f-a3c5-f5188e0b9189n%40googlegroups.com.

Mauricio Garnier-Villarreal

unread,
May 20, 2021, 6:14:13 AM5/20/21
to lavaan
not with the lavinspect, but you can subselet the needed information from the parameterestimates output. Like this

HS.model <- ' visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9 '

fit <- cfa(HS.model, data = HolzingerSwineford1939, std.lv=T)
summary(fit, fit.measures = TRUE)


lavInspect(fit, "cor.lv")
pe <- parameterestimates(fit, standardized = T)

subset(pe, lhs != rhs & op == "~~")[,c("lhs","op","rhs","std.all","pvalue")]

Harmanjit Singh

unread,
May 21, 2021, 1:09:25 AM5/21/21
to lav...@googlegroups.com
Thanks Mauricio!
This was easy!

You received this message because you are subscribed to a topic in the Google Groups "lavaan" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lavaan/B2aCdAQJhWg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lavaan+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/d469b806-5fcf-4052-9dff-3f77f009b49bn%40googlegroups.com.

Mauricio Garnier-Villarreal

unread,
May 21, 2021, 7:11:57 AM5/21/21
to lavaan
just one clarification. The p-value is evaluating the unstandardized estimates, so its not the p-value of the correlaton but the pvalue of the covariances. Which is what should be, have to test the unstandardized parameter, and use the standardized as measure of effect size

Harmanjit Singh

unread,
May 21, 2021, 10:29:03 AM5/21/21
to lav...@googlegroups.com
Thanks for the clarification!

Harmanjit Singh

unread,
May 22, 2021, 4:24:44 AM5/22/21
to lavaan
In that case, are these the same p-values that we have to report for the correlation matrix, since correlations pertain to std.all column but as you mentioned these p-values pertain to unstandardized estimates. Just got confused over this.

Pat Malone

unread,
May 22, 2021, 7:19:30 AM5/22/21
to lav...@googlegroups.com
The covariance is the estimated statistic, and the p-values are for it (specifically, the test of the covariance against the null that it is zero). The correlation is a number derived from three estimated statistics (the covariance and the two variances), so, if you're able to test the covariance--as in SEM--a p for the correlation would have no real added value. (We learn in first-year stats how to generate a p-value via a t-test of a correlation coefficient, but that's usually from a much simpler "model," and it takes into account the sample size in a more direct way.)

Correlations are just an easily interpretable effect size, as Mauricio said. I don't personally know many people who can draw meaning from glancing at a variance/covariance matrix.

Pat



--
Patrick S. Malone, PhD
Sr Research Statistician, FAR HARBΦR
This message may contain confidential information; if you are not the intended recipient please notify the sender and delete the message.

Mauricio Garnier-Villarreal

unread,
May 22, 2021, 4:14:48 PM5/22/21
to lavaan
Seconding Pat, in short, we report the p-value and test the unstandardized parameter, but can use the correlation for easier interpretation.
Reply all
Reply to author
Forward
0 new messages