Experimental longitudinal

Hi everyone !

I am embarking on my first statistical analysis on R (after 5 years on SPSS). The study is a 2-week diary with a baseline and followup. Participants were assigned to 3 different conditions. The objective of my research project is to study the impacts of social comparison from above involved in Instagram use on youths' emotions, self-esteem, and depressed mood. This involves analyzing the effect over time of a mediation (the experimental condition = the type of Instagram -> self-esteem or emotions -> mood) that is moderated by the a priori level of depression.

I found that I can use the lavaan package for mediations but I can't combine a cross-laged pannel model with the moderated mediation. Could someone help me?

My script so far ...

model < - ' # direct effect
Y ~ c * X
# mediator
M ~ a * X
Y ~ b * M
# indirect effect (a * b)
ab : = a * b
# total effect
total : = c + (a * b)
'
fit <- sem(model, data=Data)
summary(fit)