Hi,
I am trying to estimate a longitudinal IRT model using GSEM in Stata 17. Using example data from https://www.stata-press.com/data/r17/gsem_cfa, I can estimate a cross-sectional IRT model accounting for the fact that students are nested within school (example 30g from the SEM manual)
Now, let’s say data are longitudinal and that students have repeated measurements of q1-q8 over time:
To model the fact that Math Ability may depend on time, we can write:
In this model, M1[id] is a random intercept (i.e. a latent variable mean 0 and variance var(M1[id])) which captures the between-student variability.
What I would to do is adding a random slope to this model, to specify that the effect of time on Math Ability may vary across students. I was thinking of doing it this way
but this generates the following error message “MathAb may not be the destination of a path from M1[id]”. I understand that is not possible to estimate the variance of both the random effects without setting additional constraints, but even when constraining the variance of the random intercept to be equal to 1 with the option var(M1[id]@1), I still get the same message.
Is there any way to add such a random slope?
Best,
I am trying to estimate a longitudinal IRT model using GSEM in Stata 17. Using example data from https://www.stata-press.com/data/r17/gsem_cfa, I can estimate a cross-sectional IRT model accounting for the fact that students are nested within school (example 30g from the SEM manual)
Code:
gsem (q1-q8 <- MathAb M1[school]), logit
Code:
gen time = school drop id rename school id
Code:
gsem (q1-q8 <- MathAb@1 M1[id]@1) (MathAb<-time), logit
What I would to do is adding a random slope to this model, to specify that the effect of time on Math Ability may vary across students. I was thinking of doing it this way
Code:
gsem (q1-q8 <- MathAb@1 M1[id]@1) (MathAb<-time M2[id]) , logit
Is there any way to add such a random slope?
Best,
Comment