Hi there,
I am currently conducting a mediation SEM using lavaan in R. However, I’m conducting an integrative data analysis across multiple samples, and I am wanting to control for the main and interaction effects of sample (dummy coded variables). I’m running into trouble with creating interaction terms – it’s fine when creating an interaction term with my dummy coded sample indicator and another indicator variable in my model, but I can’t seem to create an interaction term with my dummy coded sample indicator and latent variables in my model.
I have tried to simply create the term in my model as with my indicator interaction terms (e.g., DC:Latent Variable) which doesn’t work, and I’ve tried to create this term outside my model by defining the interaction (e.g., DCLVX := DC*Latent Variable) and I get the following error:
Error in lav_data_full(data = data, group = group, cluster = cluster, :
lavaan ERROR: missing observed variables in dataset: EC1_SUP
I have had a browse of the other forum questions, and came across two solutions, that I’m not sure really get at what I am wanting:
1) I know there is the multigroup model approach, but the point of my analyses is to run a meta-analytic model rather than run the model for individual samples within my dataset.
2) I also read about the indProd function, but from my understanding this would create interaction terms between my dummy code variable(s) and ALL indicators of my latent variable(s)? I want to avoid this if possible because I have 20 indicators for my 5 latent variables, and 2 dummy coded variables, which would give me 100 interaction terms… I don’t think my model can handle all these over and above the rest of my model parameters. Is there a way to create an interaction term with the latent variable itself rather than the indicators?
Kind Regards,
Yuthika Girme
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/cc2db2de-8224-449e-ae3e-52475b4cd659n%40googlegroups.com.
Thank you, Pat! That seems to work great!
fit1<-sem(model,data=IDASem, group = "Dataset", group.equal = c("intercepts", "loadings", "means", "residuals", "lv.variances", "lv.covariances", "residual.covariances", "regressions"))
One last question – the output is all identical now across models. I do ask for indirect effect pathways, but I only get the output once at the end of the output rather than separately for each group. Is it fair to assume that these are the indirect effects across all samples/would be identical across groups too?
Yuthika
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/3f5d3f37-3b0d-4070-aa62-bc6107cf3e8cn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/366c9606-c2c7-491c-a565-e6d668faf131n%40googlegroups.com.