how to identify second order cfa in lavaan

1,709 views
Skip to first unread message

Balal Ezanloo

unread,
Aug 18, 2019, 8:10:48 AM8/18/19
to lavaan
Hi folk

could any one show me with an example how to identify second order factor cfa in lavaan with appropriate constrain?

Best

Edward Rigdon

unread,
Aug 18, 2019, 10:04:56 AM8/18/19
to lav...@googlegroups.com
Baloo--
Here are 3 approaches. The first fixes the first higher order loading to 1, and constrains residual covariances of the first order factors to 0. (Fixing the first loading to 1 is a default for the cfa() and sem() functions.) The second frees the first higher order loading but fixes the variance of the higher order factor to 1. The third frees the first loading but forces the three higher order loadings to average 1. With only 3 first order factors, the higher order model is statistically equivalent to the CFA, as suggested by the equal fit and DF which this code produces.

library(lavaan)
# fix first higher order loading to 1
m1<-'
visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9
ho =~ 1*visual+textual+speed     # first loading explicitly fixed to 1
visual+textual ~~ 0*speed
visual ~~ 0*textual
'
fit.m1 <- sem(m1, data=HolzingerSwineford1939)
summary(fit.m1)

# fix variance of higher order factor to 1
m2<-'
visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9
ho =~ NA*visual+textual+speed  # free first loading, or sem will fix to 1
visual+textual ~~ 0*speed
visual ~~ 0*textual
ho ~~ 1*ho                     # fix variance of higher order factor to 1
'
fit.m2 <- sem(m2, data=HolzingerSwineford1939)
summary(fit.m2)

# fix average loading on higher order factor to 1
m3<-'
visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9
ho =~ NA*visual+a*visual+b*textual+c*speed    # NA to free first loading
visual+textual ~~ 0*speed
visual ~~ 0*textual
a == 3 - b - c                                # average loading = 1
'
fit.m3 <- sem(m3, data=HolzingerSwineford1939)
summary(fit.m3)

# base CFA model
mbase<-'
visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9
'
fit.mbase <- sem(mbase, data=HolzingerSwineford1939)
summary(fit.mbase)

--
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/c7779fcc-d56f-4379-a78b-59103836b99a%40googlegroups.com.

balal izanloo

unread,
Aug 18, 2019, 10:44:33 AM8/18/19
to lav...@googlegroups.com
Thanks 
What about second order cfa with just two factors in the first level? An example could be useful. 

Edward Rigdon

unread,
Aug 18, 2019, 11:08:09 AM8/18/19
to lav...@googlegroups.com
With only 2 first order factors, you must add an additional constraint, such as forcing the two higehr order loadings to equality:

# fix first higher order loading to 1
m1b<-'

visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
ho =~ 1*visual+1*textual     # equal higher order loadings
visual ~~ 0*textual
'
fit.m1b <- sem(m1b, data=HolzingerSwineford1939)
summary(fit.m1b)


# fix variance of higher order factor to 1
m2b<-'

visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
ho =~ NA*visual+a*visual+a*textual  # free first loading / equal loadings

visual ~~ 0*textual
ho ~~ 1*ho                     # fix variance of higher order factor to 1
'
fit.m2b <- sem(m2b, data=HolzingerSwineford1939)
summary(fit.m2b)

balal izanloo

unread,
Aug 18, 2019, 11:18:15 AM8/18/19
to lav...@googlegroups.com
Thanks for your reply to my question.

Best regards

yejip

unread,
Aug 18, 2019, 1:41:30 PM8/18/19
to lavaan
As a follow-up question on this, if I want to test measurement invariance across groups/timepoints for a second-order CFA with just 2 first-order factors, is there any additional constraint that should be added to defining second-order factor?
To unsubscribe from this group and stop receiving emails from it, send an email to lav...@googlegroups.com.

--
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 lav...@googlegroups.com.

--
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 lav...@googlegroups.com.

Edward Rigdon

unread,
Aug 18, 2019, 2:01:06 PM8/18/19
to lav...@googlegroups.com
There is no statistical reason to want to do that. Such a model would be statistically identical to a model with two correlated first order factors.

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/43dac06b-de06-4199-b671-176fe2486e5a%40googlegroups.com.

Nickname

unread,
Aug 19, 2019, 11:11:15 AM8/19/19
to lavaan

Yejip,
  Ed is of course correct that there is no purely statistical reason, but there could be a psychometric reason if the HO construct is what interests you and what serves as the basis of your research program.  If that is the case, then re-frame the methodological question.  Instead of asking yourself, what constraints you need to fit a particular model type to a particular data set, instead, ask yourself, what strengths and weaknesses your research design has with respect to answering your research questions.

  The first thing to note is that from a psychometric perspective you have crossed an important line from relatively innocuous identification constraints that merely fix the scale of a latent variable, to a potentially substantive constraint that the HO factor contributes equal amounts of variance (but not necessarily proportions of variance) to each first order factor.  You have been pushed into this by the limitations of your research design.

  A first strategy to improve your design would be to think about the residual variances of the first order factors in substantive terms rather than just treating them as errors of prediction or statistical fudge factors.  Remember that there is no such thing as a multidimensional factor, so the HO factor represents a single dimension held in common between the two first order factors.  In that light, the residual variances represent the substantive aspects of each factor (common to the factor's indicators) that make them unique and distinguish them from the HO factor.  If you think about the substance that makes each first order factor unique, then you can use that frame of reference to develop direct measures of the HO factor that measure the HO factor in ways that differ from both the first order factors.  This would be the most direct way to strengthen your design, and perhaps also the most resource intensive.  In the end, however, you get a better measure of the HO factor.

  As a more short-term ad-hoc strategy, remember that the same principles that apply to first order factors also apply to HO factors.  If you can identify auxiliary variables that you expect to correlate reasonably well with the HO factor but are not causally connected to the first order factors or their indicators, then these can strengthen your research design and allow you to estimate both second order loadings without an equality constraint.  Likewise, if you can embed your HO factor in a causal structure with variables that are not otherwise causally connected to the first order factors or indicators, this can serve the same purpose.  The goal is to strengthen the research design by introducing covariances in the data that provide information about the parameters of interest.

  The following example is misspecified for the data and produces an improper solution in group 1 (within sampling error), but suffices to illustrate the syntax.


 
# Ho factor with 2 first order factors and no equality constraint
m4
<-'
  X7 =~ 1*x7 # duplication of variables due to LISREL model
  X8 =~ 1*x8
  X9 =~ 1*x9
  visual =~ x1 + x2 + x3 # Two first order factors only

  textual =~ x4 + x5 + x6
  ho =~ 1*visual+textual # No equality constraint between loadings
  visual ~~ 0*textual
  x7 ~~ 0*x7 # no unique variances to equate latent versions with observed versions
  x8 ~~ 0*x8
  x9 ~~ 0*x9
  ho ~~ X7 + X8 + X9 # Covariances with ho
  X7 ~~ X8 + X9
  X8 ~~ X9
'
# end m4

fit
.m4 <- sem(m4, data=HolzingerSwineford1939, group='sex')
summary
(fit.m4)

 
 



  Once you have an identified configural model, the rest are more constrained special cases of that.  So, you will not loose identification by imposing constraints across groups.

Keith
------------------------
Keith A. Markus
John Jay College of Criminal Justice, CUNY
http://jjcweb.jjay.cuny.edu/kmarkus
Frontiers of Test Validity Theory: Measurement, Causation and Meaning.
http://www.routledge.com/books/details/9781841692203/



yejip

unread,
Aug 19, 2019, 1:36:12 PM8/19/19
to lavaan
Thank you, Ed and Keith, for the extremely clear and helpful answers!
Reply all
Reply to author
Forward
0 new messages