Search code examples
rr-lavaan

Constraining a covariate-path in lavaan


I have the following lavaan model:

model <- ' i =~ 1*t1 + 1*t2 + 1*t3 + 1*t4 + 1*t5 + 1*t6 + 1*t7 + 1*t8 + 1*t9 + 1*t10 + 1*t11 + 1*t12 + 1*t13+ 1*t14 + 1*t15 + 1*t16 + 1*t17 + 1*t18 + 1*t19 + 1*t20
s =~ 0*t1 + 1*t2 + 2*t3 + 3*t4 + 4*t5 + 5*t6 + 6*t7 + 7*t8 + 8*t9 + 9*t10 + 10*t11 + 11*t12 + 12*t13 + 13*t14 + 14*t15 + 15*t16 + 16*t17 + 17*t18 + 18*t19 + 19*t20
t8 ~~ 0.01*t8
t17 ~~ 0.01*t17
t18 ~~ 0.01*t18
# regressions
s ~ h_index
i ~ h_index'

fit_UNconstrained <- growth(model, data=growth_data, group = "type")
summary(fit_UNconstrained)

Now, I would like to create a model that constraints the paths s ~ h_index and i ~ h_index to be equal across all groups ("type"). How can I accomplish this?


Solution

  • I believe this works in the same way as it would for adding group-wise constraints to the indicators of a latent factor. And if that's the case, then all you need to do is to add a vector of labels next to the predictor you want to constrain across groups. In your case, you have two parameter estimates you want to constrain, so you'd add two vectors.

    The length of the vector is going to depend on the number of groups you have, and the label will be the same for all groups.

    Let's suppose you have three groups; then your code would look something like the following.

    model <- " 
      i =~ 1*t1 + 1*t2 + 1*t3 + 1*t4 + 1*t5 + 1*t6 + 1*t7 + 1*t8 + 1*t9 + 1*t10 + 1*t11 + 1*t12 + 1*t13+ 1*t14 + 1*t15 + 1*t16 + 1*t17 + 1*t18 + 1*t19 + 1*t20
      s =~ 0*t1 + 1*t2 + 2*t3 + 3*t4 + 4*t5 + 5*t6 + 6*t7 + 7*t8 + 8*t9 + 9*t10 + 10*t11 + 11*t12 + 12*t13 + 13*t14 + 14*t15 + 15*t16 + 16*t17 + 17*t18 + 18*t19 + 19*t20
    
      t8 ~~ 0.01*t8
      t17 ~~ 0.01*t17
      t18 ~~ 0.01*t18
    
      # regressions
      s ~ c(v1, v1, v1)*h_index
      i ~ c(v2, v2, v2)*h_index
    "
    fit_UNconstrained <- growth(model, data=growth_data, group = "type")
    summary(fit_UNconstrained)
    

    Here the vectors c(v1, v1, v1) and c(v2, v2, v2) are telling lavaan to constrain these parameter estimates to be equal across groups.

    I believe this should do what you have in mind.