I am currently trying to cross-validate regression coefficients in a regularized structural equation model (s. Jacobucci, Grimm & McArdle, 2016). For this i'd like to first estimate the model in a training data set in order to then fix the parameters and estimate the model again in a test data set and repeat this process as it is done in k-fold cross-validation.
Now, as I'm using the lavaan-package and it's syntax to specify the models, I am wondering if there is any way to fix the parameters without doing it manually with every single one.
Is it maybe possible to make lavaan accept values from a vector as constraints for the model parameters?
I was thinking of something like this:
a <- c(1, 2, 3)
model <- "v =~ 1*x1 + a[2]*x2 + x3"
However, when the model is estimated, lavaan ignores that I specified "a" as a vector and simply uses it as a label.