Stata gsem

The gsem command fits a SEM. It is a generalized version of sem.


Usage

gsem is a generalization of sem that can accommodate ordinal and binary variables. For example, given an ordinal Y, try:

. gsem (X -> x1 x2 x3) (Z -> z1 z2 z3) (Y -> y1 y2 y3, oprobit) (Y <- X Z), noanchor variance(X@1 Z@1 e.Y@1) noconstant

Note that the only modification to the sem example is the insertion of the oprobit option in the model of Y.

Comparing the output of the two, the only visual changes will be...

Note that lavaan estimates latent variances whereas gsem fits data to a model using maximum likelihood. While regression coefficients can be comparable, the methods are fundamentally not.


See also

sem

Stata manual for gsem


CategoryRicottone

Stata/Gsem (last edited 2025-04-04 03:03:57 by DominicRicottone)