Search code examples
rfactor-analysisr-lavaan

Extracting Individual trajectories in Lavaan Growth Curve Models


I have successfully modeled longitudinal data from a study using the growth() function in the Lavaan package for R. I cannot find it documented anywhere on how to extract the predicted trajectories for each participant. I can only find the predicted trajectory for the group as a whole (given under the "Intercepts" portion of the summary output).


Solution

  • Use lavPredict

    model.syntax <- '
    # intercept and slope with fixed coefficients
    i =~ 1*t1 + 1*t2 + 1*t3 + 1*t4
    s =~ 0*t1 + 1*t2 + 2*t3 + 3*t4
    
    # regressions
    i ~ x1 + x2
    s ~ x1 + x2
    
    # time-varying covariates
    t1 ~ c1
    t2 ~ c2
    t3 ~ c3
    t4 ~ c4
    '
    
    fit <- growth(model.syntax, data=Demo.growth)
    summary(fit)
    
    head(lavPredict(fit))
    

    Which will produce predicted estimates for each individual

                  i            s
    [1,]  1.1378809  0.676301228
    [2,] -2.5421940 -1.425974525
    [3,] -0.1279434  0.966734762
    [4,]  1.1682777  1.477200679
    [5,] -0.5141435  0.006995809
    [6,] -1.2646865  0.524024630