Differences between revisions 1 and 2
Revision 1 as of 2025-04-04 03:03:57
Size: 1188
Comment: Initial commit
Revision 2 as of 2025-10-24 17:59:13
Size: 0
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Stata gsem =

The '''`gsem`''' command fits a [[Statistics/StructuralEquationModeling|SEM]]. It is a generalized version of [[Stata/Sem|sem]].

<<TableOfContents>>

----



== Usage ==

`gsem` is a generalization of [[Stata/Sem|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...
 * the inclusion of cuts of ''Y'' in terms of ''y1'' through ''y3''
 * the exclusion of variances for the ordinal observed variables ''y1'' through ''y3''

Note that [[R/Lavaan|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 ==

[[Stata/Sem|sem]]

[[https://www.stata.com/manuals/sem.pdf#semgsem|Stata manual for gsem]]



----
CategoryRicottone