measEq.syntax() Error in TEST[[2]] : subscript out of bounds

46 views
Skip to first unread message

João Marôco

unread,
Jun 27, 2019, 5:41:35 AM6/27/19
to lavaan
Dear Terence,
First, thank you so much for the new measEq.syntax() function in semTools. This is a really life saver!

I am using the example code in https://www.rdocumentation.org/packages/semTools/versions/0.5-1/topics/measEq.syntax to test for invariance in my second order model, but I am puzzled by the fact that there's a out-of-bound subscript error. I wonder if for ordinal data (my itens are 5 point likert) some other parametrization is required?

This is my configural model:

modelo = '
Cp =~  SE1 + SE2 + SE3 + SE4 + SE5
Em =~ SE6 + SE7 + SE8 + SE9 + SE10
Co =~ SE11 + SE12 + SE13 + SE14 + SE15
# fator de 2a ordem
eng =~ Cp + Em + Co
'

and this is the code from the rdocumentation page:

## compare several invariance models
grupo="Country"
test.seq <- c("thresholds","loadings","regressions","intercepts","means","residuals")
meq.list <- list()
for (i in 0L:length(test.seq)) {
  if (i == 0L) {
    meq.label <- "configural"
    group.equal <- ""
    long.equal <- ""
  } else {
    meq.label <- test.seq[i]
    group.equal <- test.seq[1:i]
    long.equal <- test.seq[1:i]
  }
  meq.list[[meq.label]] <- measEq.syntax(configural.model = modelo,
                                         data = bd,
                                         ordered = c("SE1","SE2","SE3","SE4","SE5","SE6","SE7","SE8","SE9","SE10",
                                                     "SE11","SE12","SE13","SE14","SE15"),
                                         parameterization = "theta",
                                         ID.fac = "ul",
                                         ID.cat = "Wu.Estabrook.2016",
                                         group = grupo,
                                         group.equal = group.equal,
                                         long.equal = long.equal,
                                         return.fit = TRUE)
}

compareFit(meq.list)


I get this error:

> compareFit(meq.list)
Error in TEST[[2]] : subscript out of bounds

Any idea of what I should do differently?

Thanks in advance!
João

Terrence Jorgensen

unread,
Jun 27, 2019, 5:38:54 PM6/27/19
to lavaan
I get this error:

> compareFit(meq.list)
Error in TEST[[2]] : subscript out of bounds

Any idea of what I should do differently?

Are you using the latest version of the software?

devtools::install_github("simsem/semTools/semTools")

Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

jpma...@gmail.com

unread,
Jun 27, 2019, 5:43:04 PM6/27/19
to lav...@googlegroups.com

I believe I am.
There are warnings about non positive definite variances... I guess that's why there's no results and an out of bound error?

João Marôco
[Sent from mulher not that smart smartphone, with more errors than usual]

--
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/eff72b34-ca5d-4c45-b93b-0fa042e06258%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

jpma...@gmail.com

unread,
Jun 28, 2019, 10:33:34 AM6/28/19
to lav...@googlegroups.com

Dear Terrence,

I installed both semTools and lavaan lastest versions from git_hub.

Still, have an error:

 

Warning messages:

1: In lav_model_vcov(lavmodel = lavmodel2, lavsamplestats = lavsamplestats,  :

  lavaan WARNING:

    Could not compute standard errors! The information matrix could

    not be inverted. This may be a symptom that the model is not

    identified.

2: In lav_test_satorra_bentler(lavobject = NULL, lavsamplestats = lavsamplestats,  :

  lavaan WARNING: could not invert information matrix

 

The models’ seems to be unidentified? I wonder if for ordinal items some other identification procedure (thresholds, or similar) needs to be done or if it’s just a problem with sample size (n=390, second order factor with 15 ordinal items, 8 groups) and polychoric correlation estimation…

I attach the rds database, if you care to try…

Thanks in advance!

João

 

From: lav...@googlegroups.com <lav...@googlegroups.com> On Behalf Of Terrence Jorgensen


Sent: 27 de junho de 2019 22:39
To: lavaan <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


To post to this group, send email to


To view this discussion on the web visit

bdUSEI390.rds

Terrence Jorgensen

unread,
Jun 29, 2019, 2:06:39 PM6/29/19
to lavaan

or if it’s just a problem with sample size (n=390, second order factor with 15 ordinal items, 8 groups) and polychoric correlation estimation…


You have divided n=390 into 8 groups?!  That is a small sample even for a single-group model with DWLS estimation.  And dividing into 8 groups (at best, your smallest n = 390/8 < 50) means the samples would be too small even with multivariate normal indicators.

Sorry, but sometimes you just need to accept that you do not have the data needed to test a hypothesis with any kind of justified confidence.

jpma...@gmail.com

unread,
Jun 29, 2019, 4:31:23 PM6/29/19
to lav...@googlegroups.com

No, no... 390 per group... But, yes... For measurement invariance with WLSMV does not suffice. It works fine with ML tough...
Thanks for your insights,

João Marôco
[Sent from mulher not that smart smartphone, with more errors than usual]



-------- Original Message --------
From: Terrence Jorgensen <tjorge...@gmail.com>
Sent: Saturday, June 29, 2019 07:06 PM
To: lavaan <lav...@googlegroups.com>
Subject: Re: measEq.syntax() Error in TEST[[2]] : subscript out of bounds

--
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/59b1708d-3a2b-458f-b855-9b8a4c811b87%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages