How to use Latent Growth Curve Modeling I have data from a longitudinal study with variable X measured at 19 time points. In a follow-up questionnaire I have variable Y representing the results from a psychometric questionnaire.
Now I want to examine, how the development and the values of X over time impact variable Y.
Here I found that the approach of Latent Growth Curve Modeling would fit best for a research problem like mine. I tried to figure out how to use the lavaan package for building the model fitting for my data and my question, but I don't know how to apply it.
Thanks in advance for any kind of help.
Cheers
 A: Large edit: I misread the question.
For this analysis you need to fit a latent growth model, and use the slope and intercept of of X as predictors of Y. This is called using distal outcomes in a latent growth model.
This is a tricky model to fit (especially with 19 time points). I would first try to fit the growth model (which might need to include correlated errors, autocorrelation, or non-linear terms) and then add Y to the model.
Here's a paper that discusses it: https://www.tandfonline.com/doi/full/10.1080/10705511.2019.1604140 These models are also discussed in the book on latent growth models by Bollen and Curran.
A less rigorous approach, which you might use if this struggles, is to do the modeling in two stages. First fit the growth model with X as outcome and time as predictor, and then calculate the estimated intercept and slope for each case. You can then use these variables as predictors in a regular regression model.
(Old answer):
With 19 data points, I wouldn't use lavaan to do a latent growth model, I would use a multilevel (mixed model) approach. These can be equivalent - the multilevel approach is often better when you have a lot of data points.
Very (very!) briefly, you make the data long (if it isn't already), so each respondent has 19 rows in the data (for the SEM approach, you need the data to be wide.  I would then use the lmer() function in the lme4 package (but you have other choices) to fit a model. Essentially you regress Y on time and X (and possibly the interaction of time and X).
If you're not familiar with that, it's rather a lot to go into in a CV post. I like the book "Applied Longitudinal Data Analysis" by Singer and Willett, but there are a lot of other books out there.
