HeeDong,
Welcome! If there are two groups of unique participants, I would think to model them as separate groups instead of as random effects. In this case, it is possible to use the "group" argument along with the "cluster" argument:
cluster = "participant", group = "group"
Now you will have two sets of estimates, one for group 1 and one for group 2. You could constrain some parameters to be equal across groups, or you could obtain posterior intervals of the differences between parameters across groups. The latter could be facilitated by extracting the posterior samples from the fitted model:
samps <- do.call("rbind", blavInspect(fit, "mcmc"))
Ed
On Mon, 2024-09-09 at 23:41 -0700, HeeDong Yoon wrote:
Hi all,
>
Currently, I am teaching myself how to use blavaan and have
> encountered several questions regarding the multilevel SEM in
> blavaan.
>
First, this is a brief introduction of how my experiment was
> conducted. In my experiment, each participant completed multiple
> trials. For each trial, I collected their time_estimation, interest,
> and attention responses. Prior to the experiment, each participant
> conducted a quiz and a survey. Based on these quiz and survey scores,
> they were categorized into groups (group 1 or group 2).
>
A proportion of my data is shown in the mydata.png.
> My goal is to examine the role of encoding and event_boundary on
> time_estimation, but here I want to include the random effects of
> participant and group.
> From what I learned so far, I can put "participant" for cluster
> because I have multiple data points (rows) per participant. However,
> I also expect the data from participants of different groups (1 or 2)
> to differ. How can I apply this in my code? Since there are only one
> quiz and survey scores for each participant, I put them in the second
> level (i.e, between).
> Below is the code I have so far:
>
SEM model
>
time_model <- '
> level: within
> # Latent Variables
> encoding =~ interest + attention
> # Regression
> time_estimation ~ time_encoding + event_boundary
> level: between
> # Latent Variables
> encoding =~ interest + attention
> world_knowledge =~ quiz + survey
> # Regression
> time_estimation ~ encoding + event_boundary + world_knowledge
> '
>
Fit the model using blavaan
>
time_model_fit <- bsem(time_model,
> data = mydata,
> cluster = "participant",
> burnin = 1000,
> sample = 2000,
> n.chains = 4,
> dp = time_model_priors
> )
>
I am new to this, so any suggestions on the model or on the
> multilevel SEM in general is appreciated.
>
Thanks in advance.
> --
> 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/7f5e131d-5c0f-4142-b8ce-45f144b250efn%40googlegroups.com.
it is possible to use the "group" argument along with the "cluster" argument:
cluster = "participant", group = "group"
Terrence D. Jorgensen (he, him, his)
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam
http://www.uva.nl/profile/t.d.jorgensen
--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/b18c66ec-199d-4cc8-93aa-aa91f0bdb9c2n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blavaan/18417885-c335-4efd-a7cb-9ed458b108d6n%40googlegroups.com.