1
$\begingroup$

lavaan provides a function for measuring measurement invariance (measurementInvariance()). However, let's say that I want to test structural invariance (e.g. ch. 9 in Byrne 2016), how can I accomplish this?

If I want to constrain the latent slope parameter to be the same across two groups I can add the following on a separate row in my formula:

s ~ c(M.slope, M.slope)*1

However, how can I constrain the latent variance of the slope to be the same across groups? I can use group.equal=lv.variances, but that will constrain the latent variance of both the intercept and the slope, and I only want to constrain the variance of the slope.

library(RCurl)
library(lavaan)
x <- getURL("https://gist.githubusercontent.com/aronlindberg/dfa0115f1d80b84ebd48b3ed52f9c5ac/raw/3abf0f280a948d6273a61a75415796cc103f20e7/growth_data.csv")
growth_data <- read.csv(text = x)

model_regressions <- ' 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

# fixing error-variances
t8 ~~ 0.01*t8
t17 ~~ 0.01*t17
t18 ~~ 0.01*t18
# regressions
s ~ h_index
i ~ h_index'

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

References

Barbara Byrne, 2016, Structural Equation Modeling With AMOS: Basic Concepts, Applications, and Programming, Third Edition, Routledge.

$\endgroup$
-1
$\begingroup$

Your data might have issues. Although you wish to fit a growth model, some participants (n=6) do not have any growth at all and thus have no within-person variance. Fully 135 of participants have less than 10 unique observations.

> uniques=numeric(nrow(growth_data))
> for(i in  1:nrow(growth_data)){
+   length(unique(c(growth_data[i,2:21])))
+ }
> uniques=numeric(nrow(growth_data))
> for(i in  1:nrow(growth_data)){
+   uniques[i]=length(unique(c(growth_data[i,2:21])))
+ }
> uniques
  [1] 20 19 18 18  6 13 19 17 15  7 12 17 15  5 17 15 14 14 10 11  6  7 11 15 13 12 14 13 14 12 13 11 13 13 12 11 11 11 11 11 11  9 11  9
 [45] 10  9  8  9  8  9  8  6  7  6  6  6  6  6  6  6  4  5  5  5  5  2  4  4  4  3  3  2  2  3  3  3  2  2  2  2  2  1  2  2  2  1  1 14
 [89] 13 20 20 18 17 10 19 19 18 13 10 10 18 16 18 17 15 18 17 16 16 16 13 16 15 15 13 15 14 14 10  8 15 14 13 11 11  9  4  2 14 13 11  8
[133] 13 12 12 11 11  2 10 10 10 10  8  5  9  9  9  9  9  8  8  6  7  5  8  8  8  8  8  6  8  4  4  5  5  7  6  5  6  5  5  4  5  2  4  5
[177]  5  5  4  4  3  4  4  3  3  2  1  3  3  3  3  3  3  3  3  1  3  2  2  2  2  2  2  2  2  2  2  2  2  2  2  1
> sum(uniques==1)
[1] 6
> sum(uniques<=10)
    [1] 135
$\endgroup$
  • $\begingroup$ There is no problem with the data--this is how it is structured. $\endgroup$ – histelheim Jan 10 at 19:51

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.