Re: the standardized covariance is not equal to the correlation coefficient

197 views
Skip to first unread message

Rönkkö, Mikko

unread,
May 26, 2024, 12:13:05 PM5/26/24
to lav...@googlegroups.com

Your understanding is correct. It's possible that you may have calculated the correlation incorrectly. It would be helpful to see the code and output to better understand the issue. Can you share the code and output that you used to calculate the correlation? That way we can help identify any potential errors or misunderstandings.

 

 

Best regards,

 

Mikko

 

From: lav...@googlegroups.com <lav...@googlegroups.com> on behalf of Serena <wsere...@gmail.com>
Date: Thursday, 23. May 2024 at 11.40
To: lavaan <lav...@googlegroups.com>
Subject: the standardized covariance is not equal to the correlation coefficient

Hi all,

To my understanding,

1) in simple linear regression, the standardized regression coefficient (beta coefficient) is equal to the correlation coefficient (Pearson's r) between the independent and dependent variables when both variables are standardized.

2) in bivariate scenarios (considering two variables), the standardized covariance and the correlation coefficient are numerically equivalent. This means that the value of the standardized covariance between two variables will be the same as the Pearson correlation coefficient between those variables.

But in R, I found
1) the standardized regression coefficient is not equal to the correlation coefficient;
2) the standardized covariance and the correlation coefficient are also not equivalent.

(I extracted these parameters through CFA (multiple variables) analysis.)


Is this because the calculated functions are different or other reasons? Or is my understanding incorrect? Or is it because these are analyzing multiple variables simultaneously?

Thanks in advance,

Serena

--
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/0113e6c5-4a98-4835-a94f-dbbfa8c73949n%40googlegroups.com.

Serena

unread,
May 28, 2024, 6:17:53 AM5/28/24
to lavaan
Hi Mikko,

I run a CFA model that includes all constructs I will use in my SEM model.

model <- "
#factor1
fac1 =~ var1 + var2 + var3 + var4 + var5

#factor2
fac2 =~ var6 + var7 + var8 + var9

# factors3-10
fac3 =~ var10 + var11 + var12 + var13
...
fac8 =~ var29 + var30 + var31 + var32

fac9 =~ fac3 + fac4 + fac5
fac10 =~ fac6 + fac7 + fac8
"
Then, I use cor_matrix <- lavInspect(fit, "cor.all") to get the correlations.

I use para_estmt <- parameterEstimates(fit, standardized = TRUE) to get the standard regression coefficients and covariances.

I found the results are not the same, but most are similar.

My understanding is that the CFA is analyzing multiple variables simultaneously, not just bivariate. Then there some variances are correlated and impact each other. Thus the coefficient is not the same?

Best,
Serena

Rönkkö, Mikko

unread,
May 28, 2024, 6:29:00 AM5/28/24
to lav...@googlegroups.com

Hi,

 

HS.model <- ' visual  =~ x1 + x2 + x3

              textual =~ x4 + x5 + x6

              speed   =~ x7 + x8 + x9 '

 

fit <- cfa(HS.model, data = HolzingerSwineford1939)

parameterEstimates(fit, standardized = TRUE)

lavInspect(fit, "cor.lv")

 

Gives

 

19  visual ~~  visual 0.809 0.145  5.564      0    0.524    1.094  1.000   1.000   1.000

20 textual ~~ textual 0.979 0.112  8.737      0    0.760    1.199  1.000   1.000   1.000

21   speed ~~   speed 0.384 0.086  4.451      0    0.215    0.553  1.000   1.000   1.000

22  visual ~~ textual 0.408 0.074  5.552      0    0.264    0.552  0.459   0.459   0.459

23  visual ~~   speed 0.262 0.056  4.660      0    0.152    0.373  0.471   0.471   0.471

24 textual ~~   speed 0.173 0.049  3.518      0    0.077    0.270  0.283   0.283   0.283

> lavInspect(fit, "cor.lv")

        visual textul speed

visual   1.000            

textual  0.459  1.000     

speed    0.471  0.283 1.000

 

The correlations, marked with colors, are the same as they should be. Without seeing your code or the output, it is difficult to say why that would be different in your case.

 

Best regards,

 

Mikko

 

Serena

unread,
May 28, 2024, 6:58:22 AM5/28/24
to lavaan
Hi Mikko,

Thank you for getting back to me quickly.

lavInspect(fit, "cor.all"):
            var1       var2      var3
var1 1
var2 -0.33 1
var3 -0.52 0.75 1

parameterEstimates(fit, standardized = TRUE):
var1 ~~ var2 -0.592 0.045 -13.061 0 -0.681 -0.503 -0.352 -0.352 -0.352
var1 ~~ var3 -0.856 0.059 -14.399 0 -0.973 -0.74 -0.544 -0.544 -0.544
var2 ~~ var3 1.595 0.065 24.642 0 1.468 1.722 0.803 0.803 0.803

I controlled the covariates in the model. But both lavInspect() and parameterEstimates() are used with the same model. 
Correlations and standard covariances are not the same in my case.

Best,
Serena

Rönkkö, Mikko

unread,
May 28, 2024, 7:02:06 AM5/28/24
to lav...@googlegroups.com

Hi,

 

Seeing the full model specification would be helpful.

 

Best regards,

 

Mikko

 

Serena

unread,
May 28, 2024, 7:26:24 AM5/28/24
to lavaan
Hi Mikko,

Here is my model.

model <- "
  fac1 =~var1 + var2 + var3 + var4 + var5

  fac2 =~ var6 + var7 + var8 + var9 + var10 + var11
  fac3 =~ var12 + var13 + var14 + var15 + var16 + var17
 
  fac4 =~ as1_t2 + as2_t2 + as3_t2 + as4_t2
  fac5 =~ af1_t2 + af2_t2 + af3_t2 + af4_t2
  fac6 =~ cs1_t2 + cs2_t2 + cs3_t2 + cs4_t2
  fac7 =~ cf1_t2 + cf2_t2 + cf3_t2 + cf4_t2
  fac8 =~ rs1_t2 + rs2_t2 + rs3_t2 + rs4_t2
  fac9 =~ rf1_t2 + rf2_t2 + rf3_t2 + rf4_t2

  higher_fac10 =~ fac4 + fac6 + fac8
  higher_fac11 =~ fac5 + fac7 + fac9

  fac12 =~ es + ts + tm + em + mc

  #regress latent factors on the covariates
  fac1 + fac2 + fac3 +  higher_fac10 + higher_fac11 + fac12 + performance ~ Age + Gender + Language
"

fit_all <- cfa(model, data = dataset, estimator = "MLR", cluster = "id")
summary(fit_all, fit.measures = TRUE, standardized = TRUE, rsquare = TRUE)

cor_matrix <- lavInspect(fit_all, "cor.all")

para_estmt <- parameterEstimates(fit_all, standardized = TRUE) 



Best,
Serena

Rönkkö, Mikko

unread,
May 28, 2024, 11:10:20 AM5/28/24
to lav...@googlegroups.com

Hi,

 

That clarifies a lot and if you had included the model in the first post, we could have resolved the issue right away.

 

Because you are regressing the factors on covariates, these parameters

 

parameterEstimates(fit, standardized = TRUE):

var1 ~~ var2 -0.592 0.045 -13.061 0 -0.681 -0.503 -0.352 -0.352 -0.352
var1 ~~ var3 -0.856 0.059 -14.399 0 -0.973 -0.74 -0.544 -0.544 -0.544
var2 ~~ var3 1.595 0.065 24.642 0 1.468 1.722 0.803 0.803 0.803

 

are not factor covariances but residual covariances. They differ from factor covariances because they are not the factors, but the residuals from the regressions of the factors on the observed covariates.

 

Best regards,

 

Mikko

 

Serena

unread,
May 28, 2024, 8:02:58 PM5/28/24
to lavaan
Hi Mikko,

I guess I got what you mean.

These parameters,

parameterEstimates(fit, standardized = TRUE):

var1 ~~ var2 -0.592 0.045 -13.061 0 -0.681 -0.503 -0.352 -0.352 -0.352
var1 ~~ var3 -0.856 0.059 -14.399 0 -0.973 -0.74 -0.544 -0.544 -0.544
var2 ~~ var3 1.595 0.065 24.642 0 1.468 1.722 0.803 0.803 0.803


do show the names of the factors. BUT they are factors' residual covariances, not the factor covariances, right?

Then if I want to get standard bivariate factor covariances from this CFA model, how could I get them?

Thank you,
Serena

Rönkkö, Mikko

unread,
May 29, 2024, 1:10:14 AM5/29/24
to lav...@googlegroups.com

Hi,

 

You can get the model implied correlations with

 

lavInspect(fit_all, "cor.all")

If you want to get the correlations directly from the model, you need to make sure that the factors are modeled as exogenous variables without any incoming regression paths.

 

Best regards,

 

Mikko

 

Serena

unread,
May 29, 2024, 10:47:25 PM5/29/24
to lavaan
Thank you so much, Mikko!
Reply all
Reply to author
Forward
0 new messages