Dear Statalist users,

I would like to draw on your expertise to learn about whether it is possible to use -gsem- for fitting similar joint estimation of transition equation and selection equation as one would be using -xteprobit- (random-effects probit model with selection). I have been told by Stata Technical Support Staff that it is not possible to use -gsem- for this purpose (panel data and selection) but I have not been able to find alternatives and I have seen other Stata resources demonstrating the use of -gsem- for panel data and selection:
Drukke, D. M. (2014). Some Stata commands for endogeneity in nonlinear panel-data models: https://www.stata.com/meeting/german...ukker_gsem.pdf
Stata manual using sem for Heckman selection: https://www.stata.com/manuals13/semexample45g.pdf

I intend to model the transition into employment (binary variable named "employ") at t conditioned on lagged employment status at t-1 (also binary variable named "lagged_employ") (transition equation). To address endogeneity of lagged employment status at t-1, I introduce an instrument (named “iv”) (selection equation). Since I do not have Stata 16.1, I cannot run -xteprobit- so I would like to seek alternatives with other Stata programs, such as -gsem- (or if you would have other suggestions).

Initially I would have liked to fit the model with -xteprobit- as the following:
Code:
xtset id year
xteprobit employ i.education age, select(lagged_employ = iv) vce(robust)
To translate it to -gsem-, I tried the following code:
Code:
gsem (employ <- i.education age L M[id]@1 if lagged_employ==0, probit latent(L M))
     (lagged_employ <- iv L@1 M[id]@1, probit latent(L M))
     var(L@1 e.employ@a e.lagged_employ@a) vce(robust)
I have the following questions:

(1) How can I correctly incorporate selection and random effects using -gsem- corresponding to the specification in -xteprobit-? Can the above command do the job?
(2) Is var(M[id]) in the output to be interpreted as the correlation of the unobservables across the two equations?

Thank you very much indeed for sharing your knowledge.