I’m trying to test longitudinal invariance for a two-factor model using the longInvariance function from the semTools package in R. I’ve successfully done this for a single-factor model, but I’m running into issues when I extend it to two factors.
The code returns an error indicating that the factor names in the elements of varList do not match. Has anyone encountered this issue before? What would be the correct way to set up this model and ensure proper configuration for a two-factor longitudinal invariance test?
I totally get your frustration with the two-factor longitudinal invariance test. It can be a real head-scratcher, right?
Have you considered tweaking your varList setup? From what I can see, the longInvariance function might be expecting factor-specific variable lists. Maybe try something like this:
This way, you’re grouping the variables by factor across time points. It might help the function match up the right variables with the right factors.
Also, have you checked out the measEq.syntax function from semTools? Sometimes it can be easier to generate the syntax for longitudinal invariance tests and then run it manually with lavaan.
What other approaches have you tried so far? I’m super curious to hear more about your research. What kind of data are you working with? Longitudinal studies are always fascinating!
I’ve encountered similar issues when working with multi-factor longitudinal invariance testing. One approach that’s worked for me is to explicitly define the factor structure in the model syntax for each time point. This can help lavaan correctly identify the factor relationships across time.
This explicit definition often resolves factor naming issues. Also, ensure your data frame column names exactly match the variable names in your model. If the issue persists, you might need to manually specify invariance constraints rather than relying on the auto-generation feature.