cfa output in lavaan not showing all the items for modification indices

340 views
Skip to first unread message

Seun Kolade

unread,
May 14, 2019, 3:48:35 AM5/14/19
to lavaan
Hello everyone,

I'm currently running a cfa model on lavaan. The modification indices items are not all showing. Lavaan says 183 rows are missing, I suppose due to the limit on the number of items that can be displayed. Is there a way I can see these remaining items? I think they may give me the information I need to covary the relevant indicator error terms.

Many thanks,
Seun

Seun Kolade

unread,
May 14, 2019, 4:09:35 AM5/14/19
to lavaan
Just a quick update. I’ve now figures out how to do this by using the SORT argument and setting to minimum of 15- to take out the smaller values.

car...@web.de

unread,
May 14, 2019, 4:15:28 AM5/14/19
to lav...@googlegroups.com
From my point of view, this has nothing to do with lavaan. With options you can influence the output behavior of R. Regardless, I don't think you really need all modification indices results. Probably it's enough to look at the really relevant results like this:
mi <- modindices(fit)
mi[mi$mi > 10,]
10 is arbitrary, of course.

Christopher David Desjardins

unread,
May 16, 2019, 3:40:08 PM5/16/19
to lavaan

On Tue, May 14, 2019 at 3:15 AM car...@web.de wrote:

From my point of view, this has nothing to do with lavaan.

This is correct. It’s an option in R, max.print.

library(lavaan)
model <- ' 
  # latent variable definitions
     ind60 =~ x1 + x2 + x3
     dem60 =~ y1 + a*y2 + b*y3 + c*y4
     dem65 =~ y5 + a*y6 + b*y7 + c*y8

  # regressions
  QA.GMF =~ ind60:dem60
    dem65 ~ QA.GMF
'

fit <- sem(model, data=PoliticalDemocracy)

# play around with printing settings, note this doesn't
# have to do with lavaan
options()$max.print
options(max.print = 100)
modindices(fit)
options(max.print = 500)
modindices(fit)
options(max.print = 1000)
modindices(fit)

With options you can influence the output behavior of R. Regardless, I don't think you really need all modification indices results. Probably it's enough to look at the really relevant results like this:
mi <- modindices(fit)
mi[mi$mi > 10,]
10 is arbitrary, of course.

--
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 https://groups.google.com/group/lavaan.
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/trinity-071d314d-0d8b-483a-81a4-efca15a3002f-1557821719808%40msvc-mesg-web002.
For more options, visit https://groups.google.com/d/optout.

Christopher David Desjardins

unread,
May 16, 2019, 3:42:23 PM5/16/19
to lavaan

Responded too quickly. This one is reproducible.

Note, that max.print is the pieces of information not the number of rows, but as your noted, sort is the argument to add.

library(lavaan)
model <- ' 
  # latent variable definitions
     ind60 =~ x1 + x2 + x3
     dem60 =~ y1 + a*y2 + b*y3 + c*y4
     dem65 =~ y5 + a*y6 + b*y7 + c*y8

  # regressions
    dem60 ~ ind60
    dem65 ~ ind60 + dem60
'


fit <- sem(model, data=PoliticalDemocracy)

# play around with printing settings, note this doesn't
# have to do with lavaan
options()$max.print
options(max.print = 100)
modindices(fit)
options(max.print = 500)
modindices(fit)
options(max.print = 1000)
modindices(fit)

car...@web.de

unread,
May 16, 2019, 3:43:48 PM5/16/19
to lav...@googlegroups.com
Hi, Christopher. Thanks for making that clear with source code. Next time I'll try a little harder to be more precise and easier to understand. Best.

Seun Kolade

unread,
May 16, 2019, 4:07:42 PM5/16/19
to lavaan
Thanks Christopher. I’d figured this out earlier.
Reply all
Reply to author
Forward
0 new messages