I created a SEM model in lavaan that produced a good fit to my data. I inspected the resulting covariance matrix using:
cov1 <- lavInspect(my_fit, what="fitted")$cov
which produced this matrix (the variables themselves are not of interest)
dpl cns par cbi med
dpl 0.046
cns 0.032 0.064
par 0.042 0.042 0.082
cbi 0.104 0.112 0.164 0.488
med 0.007 0.009 0.008 0.020 0.012
I converted this into a correlation matrix with cov2cor
cor1 <- cov2cor(cov1)
which produced this:
dpl cns par cbi med
dpl 1.000
cns 0.587 1.000
par 0.692 0.573 1.000
cbi 0.692 0.630 0.821 1.000
med 0.305 0.327 0.248 0.261 1.000
So far, so good. Just to test things out, I decided to use cor2cov
to see if it brought me back to the original corr matrix. For this, I needed both the correlations & the variable sd's out of cor1
. So
sd1 <- describe(cor1)$sd
cov2 <- cor2cov(cor1, sd1)
Here's the cov2
matrix:
dpl cns par cbi med
dpl 0.062
cns 0.035 0.058
par 0.049 0.039 0.080
cbi 0.047 0.042 0.064 0.075
med 0.024 0.025 0.023 0.023 0.103
Alas, cov2
is not identical to cov1
, which it probably should be. Any ideas as to why these functions produce different results, and more importantly, which one is the "right" cov matrix for further analysis?