Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Multilevel SEM in blaavan?

378 views
Skip to first unread message

Tahani Fourah

unread,
Aug 29, 2018, 3:43:23 PM8/29/18
to blavaan
 Hi,

Could you please tell me how to conduct multilevel SEM in blaavan ?

Thanks!

Tahani

Ed Merkle

unread,
Aug 30, 2018, 12:50:16 PM8/30/18
to Tahani Fourah, blavaan
Tahani,

Multilevel SEM is not currently possible in blavaan (though it is on the TODO list). Your best bet is to export the jags or stan syntax of a one-level SEM via mcmcfile=TRUE, then edit it to be a multilevel SEM. But this admittedly requires some effort.

Best,
Ed



--
You received this message because you are subscribed to the Google Groups "blavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blavaan+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blavaan/6caa13e2-9ad6-4ab2-8222-ad92953f9036%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tahani Fourah

unread,
Aug 31, 2018, 4:21:35 AM8/31/18
to ecme...@gmail.com, bla...@googlegroups.com
Thanks! 

On Thu, Aug 30, 2018 at 7:50 PM Ed Merkle <ecme...@gmail.com> wrote:
Tahani,

Multilevel SEM is not currently possible in blavaan (though it is on the TODO list). Your best bet is to export the jags or stan syntax of a one-level SEM via mcmcfile=TRUE, then edit it to be a multilevel SEM. But this admittedly requires some effort.

Best,
Ed


On Wed, Aug 29, 2018 at 2:43 PM, Tahani Fourah <tfo...@gmail.com> wrote:
 Hi,

Could you please tell me how to conduct multilevel SEM in blaavan ?

Thanks!

Tahani

--
You received this message because you are subscribed to the Google Groups "blavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blavaan+u...@googlegroups.com.



--
Tahani Z. Fourah (Al Dahdouh)
PhD student
School of Education
University of Tampere
Mobile:  +358 417 053 597


Message has been deleted

Christopher Bratt

unread,
May 17, 2019, 4:05:10 AM5/17/19
to blavaan
I'd really like to use blavaan with Stan for multilevel modelling.
Of course, it is not an easy task to include multilevel modelling in lavaan. Is it at all possible to indicate how far up on the to do list multilevel modelling with categorical indicators is? I assume this will easily take a few years?
Love the work you are doing!

Christopher Bratt

Ed Merkle

unread,
May 19, 2019, 10:48:56 PM5/19/19
to Christopher Bratt, blavaan
Christopher,

Ordinal and multilevel are the two obvious next steps, to get
somewhere similar to lavaan's functionality. But I am currently
working to improve the existing Stan approach, so that the ordinal and
multilevel models become more feasible. (In my initial tests, the
ordinal and multilevel models have been painfully slow.)

I hope it is less than a few years, but time moves quickly!

Ed
> --
> You received this message because you are subscribed to the Google Groups
> "blavaan" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to blavaan+u...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/blavaan/69da693a-3a85-4b40-91f8-63d92cfbd97e%40googlegroups.com.

Carl Falk

unread,
Mar 19, 2024, 3:36:07 PM3/19/24
to blavaan
Hi Ed,

I see that some capability for multilevel SEM was recently added in 0.5-1. But, would I be correct that at the moment only random intercepts (i.e., not random coefficients) are supported?

Thank you very much!
Carl

Ed Merkle

unread,
Mar 20, 2024, 2:45:16 PM3/20/24
to Carl Falk, blavaan
Hi Carl, correct, only random intercepts are available at the moment. Random slopes are a future hurdle.

Ed

Carl Falk

unread,
Apr 25, 2024, 3:03:07 PM4/25/24
to blavaan
Thanks Ed,

One follow-up question. Is there a reason something like the below works in lavaan, but not in blavaan? I can post a dataset and/or if it's a bug put it in an issue on github.

Thanks!
Carl

model <- '
    level: within
        y ~ X1 + X2
    level: between
        y ~ 1
'
mod.blavaan <- bsem(model = model, data = dat, cluster = "g", seed=1234)

blavaan NOTE: two-level models are new, please report bugs! https://github.com/ecmerkle/blavaan/issues blavaan NOTE: test="none" by default for models with within-only ovs, because the metrics appear to be unstableError in eval(mc, parent.frame()) : Exception: mismatch in number dimensions declared and found in context; processing stage=data initialization; variable name=ov_idx2; dims declared=(1); dims found=() (in 'string', line 563, column 2 to column 30) failed to create the sampler; sampling not done Computing post-estimation metrics (including lvs if requested)... Stan model 'stanmarg' does not contain samples. Error in rowvec[samppar] <- which(grepl(stanvec[j], names(b.est)) & !(grepl("_c\\[", : replacement has length zero





Ed Merkle

unread,
Apr 25, 2024, 3:36:20 PM4/25/24
to Carl Falk, blavaan
Looks like a bug, it would be helpful to see the data if you can provide it.

Thanks, 
Ed

Ed Merkle

unread,
May 14, 2024, 12:43:44 PM5/14/24
to blavaan
Just following up on this thread: there was indeed a bug that was fixed on github: https://github.com/ecmerkle/blavaan/issues/76
Reply all
Reply to author
Forward
0 new messages