inspect(fit, "cov.lv") == inspect(fit, "cor.lv")?

1,040 views
Skip to first unread message

Eric Green

unread,
Jan 30, 2014, 2:48:14 PM1/30/14
to lav...@googlegroups.com
I get the warning that the covariance matrix of latent variables is not positive definite. When I run inspect(fit, "cov.lv") and inspect(fit, "cor.lv"), I get identical values. I'm not sure why, and the values for inspect(fit, "cor.lv") don't make sense to me because some off-diagonal values are greater than 1.

I think my problem is that the pairs of latent variables with high off-diagnonal values are too similar. My question is why inspect(fit, "cov.lv")==inspect(fit, "cor.lv") and how values in the correlation matrix can be greater than 1. Is this because we get the correlation matrix from the covariance matrix, but the process stops because the covariance matrix is not positive definite?

Edward Rigdon

unread,
Jan 30, 2014, 3:49:43 PM1/30/14
to lav...@googlegroups.com
    It could be that your syntax forces the factors to be standardized, so that cov.lv and cor.lv are the same.  The more usual default leaves factor variances free, but that default can be overridden by syntax. Unexpected results are usually a bad sign, but the problem may be just a typo somewhere.  Can we see your syntax?
--Ed Rigdon

Sent from my iPad

On Jan 30, 2014, at 2:48 PM, Eric Green <epg...@gmail.com> wrote:

I get the warning that the covariance matrix of latent variables is not positive definite. When I run inspect(fit, "cov.lv") and inspect(fit, "cor.lv"), I get identical values. I'm not sure why, and the values for inspect(fit, "cor.lv") don't make sense to me because some off-diagonal values are greater than 1.

I think my problem is that the pairs of latent variables with high off-diagnonal values are too similar. My question is why inspect(fit, "cov.lv")==inspect(fit, "cor.lv") and how values in the correlation matrix can be greater than 1. Is this because we get the correlation matrix from the covariance matrix, but the process stops because the covariance matrix is not positive definite?

--
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 post to this group, send email to lav...@googlegroups.com.
Visit this group at http://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/groups/opt_out.

Eric Green

unread,
Jan 30, 2014, 4:24:29 PM1/30/14
to lav...@googlegroups.com
Thanks. Running the following on dataset of 25 ordinal variables (0, 1, 2), n = 238 complete cases.

mod <-  '
         f1 =~  i1 + i2 + i3 + i4 + i5 + i6
         f2 =~  i7 + i8 + i9
         f3 =~  i10 + i11 + i12 + i13
         f4 =~  i14 + i15 + i16 + i17 + i18 + i19 + i20 + i21
         f5 =~  i22 + i23 + i24 + i25
         '
fit <- cfa(mod, data = input, ordered=names(input), std.lv=TRUE)

cov.lv == cor.lv when std.lv=TRUE

inspect(fit,"cov.lv")
        f1       f2       f3      f4      f5
f1 1.000                          
f2 0.391  1.000                   
f3     0.846  1.038  1.000            
f4     0.980  0.576  0.910 1.000      
f5     0.778  0.552  0.851 0.795 1.000

cor.lv != cor.lv when std.lv=FALSE...but still have a value greater than 1 in the correlation matrix

fit.b <- cfa(mod, data = input, ordered=names(input), std.lv=FALSE)

inspect(fit.b,"cor.lv")
      f1       f2       f3       f4     f5
f1   1.000                          
f2   0.391  1.000                   
f3   0.846  1.038  1.000            
f4   0.980  0.576  0.910 1.000      
f5   0.778  0.552  0.851 0.795 1.000

inspect(fit.b,"cov.lv")
      f1       f2       f3      f4       f5
f1   0.433                          
f2   0.186  0.521                   
f3   0.307  0.413  0.304            
f4   0.248  0.160  0.193 0.148      
f5   0.305  0.237  0.280 0.182 0.355

Thanks, Ed
Eric

Edward Rigdon

unread,
Jan 30, 2014, 4:58:14 PM1/30/14
to lav...@googlegroups.com
Eric--
     The scale or variance of ordinal indicators is arbitrary, so software sets the variances of factors with ordinal indicators to 1 by default (?).  Think about the ordinal distributions as well as the conceptual meanings.  Extreme ordinal distributions could be another reason for the very large factor correlations.
--Ed Rigdon

Sent from my iPad

Eric Green

unread,
Jan 30, 2014, 5:27:48 PM1/30/14
to lav...@googlegroups.com
Thanks, Ed. 

RE: The scale or variance of ordinal indicators is arbitrary, so software sets the variances of factors with ordinal indicators to 1 by default (?).

That makes sense. As far as I can tell, the documentation does not indicate what happens to factor variances when ordered is used. If using ordered, std.lv=TRUE should not be possible, right?

RE: Extreme ordinal distributions could be another reason for the very large factor correlations.

I believe this is the cause of my problems, but I'm still a little confused about how fit.b <- cfa(mod, data = input, ordered=names(input), std.lv=FALSE) can produce a correlation matrix with a value greater than 1. I know it tells me that the factors are indistinguishable, just not sure about the >1 bit.

Eric

Edward Rigdon

unread,
Jan 30, 2014, 6:04:36 PM1/30/14
to lav...@googlegroups.com
Eric--
     factor analysis can give you that based on the pattern of observed variable correlations.  Given your data, the best fit just happens to involve a factor correlation greater than 1.  If correlations among indicators of *different* factors are uniformly higher than correlations among indicators of the same factors, that implies a factor correlation above 1.  Remember, for a CFA, the general formula for an observed variable correlation (variable A, variable B) is:
Correlation = loading(A) * loading(B) * correlation between factors.
--Ed Rigdon

Sent from my iPad
--

Eric Green

unread,
Jan 30, 2014, 7:15:28 PM1/30/14
to lav...@googlegroups.com
Ed, this is helpful. I was thinking about the relationship between covariance and correlation matrices, and I did not consider the formula you referenced. Now I can see how the values can be greater than 1. 

Just to make sure I am clear on an earlier point, one should never use fit <- cfa(mod, data = input, ordered=names(input), std.lv=TRUE) but instead use fit <- cfa(mod, data = input, ordered=names(input), std.lv=FALSE) or more simply do not include std.lv. Is this correct? TRUE sets the variances to unity, which does not make sense in the ordinal case. FALSE (or not included) sets factor variances to 1 when ordered is specified. Is this correct?

Thanks again for your help.
Eric

Edward Rigdon

unread,
Jan 30, 2014, 8:35:16 PM1/30/14
to lav...@googlegroups.com
Eric--
     A factor derives its variance from its indicators, unless the variance is assigned directly (say, through standardization).  You must always do something to set the scale (that is, the variance) of your factors.  There are good statistical reason to use reference variables (set one indicator's loading to 1) rather than standardizing factors.  When indicators are ordinal, their own variance is arbitrary, so many packages will scale indicator variance to 1.
     I'm sorry, I got a little confused previously and made an incorrect connection.  Here is what happens.  You have an ordinal indicator y, and y's variance is arbitrarily scaled to 1.  It loads on factor f.  Then you have an equation like:
y = 1 * f + e
if you make y the factor's reference variable.  Here, e is "error."
Let's assume that y, f and e all have means of 0, and f and e are orthogonal.  Then this equation implies:
Variance(y) = 1 squared * Variance(f) + Variance(e)
or
1 = 1 squared * Variance(f) + Variance(e)
or
1 = Variance(f) + Variance(e)
or
Variance(f) = 1 - Variance(e)
and that is where the variance of the factor comes from, if you don't standardize the factor.
--Ed Rigdon
or
Variance(f) = Variance(f) + Variance(e)


Eric Green

unread,
Jan 30, 2014, 10:35:15 PM1/30/14
to lav...@googlegroups.com
Ed,

Thanks for sticking with me here.

RE: When indicators are ordinal, their own variance is arbitrary...

Which means that using std.lv=TRUE does not make sense, correct?

RE: ...so many packages will scale indicator variance to 1.

And this is what happens in lavaan when you specify fit <- cfa(mod, data = input, ordered=names(input), std.lv=FALSE) or by default when you do not include std.lv. Is this correct? Looks to be so in parameterEstimates(fit). Actually, I think it is the default behavior whenever std.lv is FALSE or omitted according to the documentation: "By default, lavaan will always fix the factor loading of the first indicator to 1."

E
Reply all
Reply to author
Forward
0 new messages