blavaan ERROR: problem with translation from lavaan to MCMC syntax

I´m running a measurement invariance testing with blavaan but I´m getting de next error:

     [1] "Error in lamsign[l1, 1] : subscript out of bounds\n"
    attr(,"class")
    [1] "try-error"
    attr(,"condition")
    <subscriptOutOfBoundsError in lamsign[l1, 1]: subscript out of bounds>
    Error in blavaan(mod_sem_1, ordered = c("y3", "y4", "y6", "y7", "y8",  : 

  blavaan ERROR: problem with translation from lavaan to MCMC syntax.

I´m working on Rstudio with the code:

    mod_sem_1 <- '
              # Modelo de medicion
              # Parte endogena
              eta1 =~ y3 + y4 + y5 # Patron de consumo
              eta2 =~ y6 + y7 + y8 + y9 + y10 + y11 + y12 + y13 # Consumo problematico
              # Parte exógena
              xi1 =~ x14 + x15 + x16 # Factores individuales
              xi2 =~ x17 + x18 + x19 + x20 + x21 # Factores micro-sociales
              xi3 =~ x22 + x23 + x24 # Factores macro-sociales
            
            #Modelo estructural
            eta1 ~ xi1 + xi2 + xi3
            eta2 ~ eta1
            
            # Covariancias
            xi1 ~~ xi2
            xi1 ~~ xi3
            xi2 ~~ xi3
    '
    fit_mg_g3 <- bsem(mod_sem_1, 
                   ordered=c("y3","y4","y6","y7","y8","y9","y10","y11","y12","y13",
                             "x14","x16","x17","x18","x19","x20","x21","x22","x23","x24"),
                   std.lv=TRUE, dp=dpriors(lambda="normal(1,1)"), 
                   group = "genero",
                   group.equal = "loadings",
                   n.chains = 3, burnin = 9000, sample = 1000,
                   data=datos_imputados)

I already tried to re-install blavaan package and I´m sure that the code, variable and data are fine. Actually, the multigroup model without constraints run succesfully, only after I add the line "group.equal = "loadings" the error show up.

Consulting foros and R Github, I think that maybe the error is because a bug in the blavaan package but I tried to re-install the package and the error persist.

Leave a Comment