Thanks a lot for your reply!
Second, you are right, I did not declare the binary variables as one should do. The reason for this is, when I run the model I showed in post 1, it works (produces results). As soon as I declare the binary vars, the model breaks and no sensible output is produced. I am not sure why this happens.
Third, maybe this relates to the last aspect, the fixing of the values. Following your suggestions, I changed my code as follows.
RICLPM <- '# Create between components (random intercepts)
RImath =~ 1*math1 + 1*math2 + 1*math4
RIaspi =~ 1*aspi1 + 1*aspi2 + 1*aspi4
# Create within-person centered variables
#wmath1 =~ math1 line commented out
wmath2 =~ math2
wmath4 =~ math4
#waspi1 =~ aspi1 line commented out
waspi2 =~ aspi2
waspi4 =~ aspi4
#Changes
waspi1 =~ 1*aspi1
aspi1 ~~ 0*aspi1
waspi1 ~~ 1*waspi1
wmath1 =~ 1*math1
math1 ~~ 0*math1
wmath1 ~~ 1*wmath1
# Estimate the lagged effects between the within-person centered variables
wmath2 + waspi2 ~ wmath1 + waspi1
wmath4 + waspi4 ~ wmath2 + waspi2
# Adding control variables (effects may vary by wave)
math1 + math2 + math4 ~ logincome
aspi1 + aspi2 + aspi4 ~ logincome
# Estimate the covariance between the within-person centered variables at the first wave
wmath1 ~~ waspi1
# Estimate the covariances between the residuals of the within-person centered variables
wmath2 ~~ waspi2
wmath4 ~~ waspi4
# Estimate the variance and covariance of the random intercepts
RImath ~~ RImath
RIaspi ~~ RIaspi
RIaspi ~~ RImath
# Estimate the (residual) variance of the within-person centered variables
#wmath1 ~~ wmath1
wmath2 ~~ wmath2
wmath4 ~~ wmath4
#waspi1 ~~ waspi1
waspi2 ~~ waspi2
waspi4 ~~ waspi4'
#Test first without imputed data
testdata <- datalist[["imp28pv3"]] #Select one imputed dataset for testing the model
RICLPM.fit <- lavaan(RICLPM, data = testdata, meanstructure = T, int.ov.free = T, ordered = c("aspi1", "aspi2", "aspi4"))
summary(RICLPM.fit, standardized = FALSE, fit.measures = TRUE)
After estimation I receive the following errors:
1: In lav_samplestats_step2(UNI = FIT, wt = wt, ov.names = ov.names, :
lavaan WARNING: correlation between variables aspi2 and math4 is (nearly) 1.0
2: In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, :
lavaan WARNING:
Could not compute standard errors! The information matrix could
not be inverted. This may be a symptom that the model is not
identified.
3: In lav_object_post_check(object) :
lavaan WARNING: some estimated ov variances are negative
4: In lav_object_post_check(object) :
lavaan WARNING: some estimated lv variances are negative
Did I make an error when adapting my model or is there just something wrong with the estimation? Also, maybe it is a problem that the grades are not equal spaced (so t1, t2 and t4 with t3 missing). Any ideas on how to proceed are much appreciated, thanks.