Dear Statalist users,
data example at the bottom of the post.
I am unsure how to properly account for the specific structure of the dataset and happy for any help.
I run an experiment where I analyze teams of two members each which is identified by team in the example. Treatment is a random treatment on team level, i.e. each team either gets the treatment or not (0/1). Moderator_treat is another treatment on team level (0/1) which I expect to moderate the relationship between treatment and outcome_binary (or also the latent variable outcome). Team_process1, team_process2 and team_process3 are 3 different items (which measure a team process) and were asked to all participants (i.e. there is variation within the team) on a Likert-scale from 1-7. I also have a second outcome which is also measured by 3 items on a Likert-scale from 1-7. The graph below sums up the structure (only for the binary outcome).

I am trying the following code (or some variations similar to this one, but I am unsure whether it is correct):
Note: There might be some errors which might be an issue related to the data example since I plugged in random numbers.
data example at the bottom of the post.
I am unsure how to properly account for the specific structure of the dataset and happy for any help.
I run an experiment where I analyze teams of two members each which is identified by team in the example. Treatment is a random treatment on team level, i.e. each team either gets the treatment or not (0/1). Moderator_treat is another treatment on team level (0/1) which I expect to moderate the relationship between treatment and outcome_binary (or also the latent variable outcome). Team_process1, team_process2 and team_process3 are 3 different items (which measure a team process) and were asked to all participants (i.e. there is variation within the team) on a Likert-scale from 1-7. I also have a second outcome which is also measured by 3 items on a Likert-scale from 1-7. The graph below sums up the structure (only for the binary outcome).
I am trying the following code (or some variations similar to this one, but I am unsure whether it is correct):
Code:
* Interaction gen treat_mod = treatment * moderator_treat * Structure xtset team * Run multilevel SEM using gsem gsem /// (team_process1 team_process2 team_process3 <- Team_process@1) /// (outcome_binary <- treatment moderator_treat treat_mod Team_process), /// latent(Team_process) /// group(team) /// nocapslatent
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(treatment moderator_treat team team_process1 team_process2 team_process3 outcome_binary outcome1 outcome2 outcome3) 1 1 1 5 6 7 1 2 5 3 1 1 1 6 5 4 1 6 6 7 1 0 2 5 4 5 1 5 7 5 1 0 2 4 3 2 1 2 2 1 0 0 3 1 3 2 1 2 2 1 0 0 3 2 5 3 1 3 3 3 1 0 4 6 6 7 1 5 4 4 1 0 4 5 7 5 1 4 3 3 0 1 5 2 2 1 1 7 7 7 0 1 5 2 2 1 1 5 6 5 1 1 6 3 3 3 0 3 4 3 1 1 6 5 4 4 0 4 5 4 1 0 7 1 2 2 0 3 2 3 0 0 7 4 3 3 0 5 4 5 0 0 8 7 7 7 0 4 3 2 1 0 8 5 6 5 0 1 3 2 1 0 9 3 4 3 0 2 5 3 1 0 9 4 5 4 0 6 6 7 0 1 10 3 2 3 1 3 2 3 0 1 10 6 6 6 1 6 6 6 end
Comment